Skip to content

Commit 1f83910

Browse files
rename some functions
move variables inside class buildtest_menu
1 parent 6ba2052 commit 1f83910

File tree

7 files changed

+152
-197
lines changed

7 files changed

+152
-197
lines changed

config.example.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ BUILDTEST_JOB_TEMPLATE: template/job.slurm
66
BUILDTEST_MODULE_ROOT:
77
- /nfs/grid/software/RHEL6/general
88
- /nfs/grid/software/RHEL6/chemistry
9-
- /nfs/grid/software/RHEL7/non-easybuild/modules/all
10-
- /nfs/grid/software/easybuild/IvyBridge/redhat/7.3/modules/all
11-
# - /nfs/grid/software/easybuild/Haswell/redhat/7.3/modules/all
12-
# - /nfs/grid/software/easybuild/Broadwell/redhat/7.3/modules/all
13-
# - /nfs/grid/software/easybuild/SkyLake/redhat/7.3/modules/all
14-
- /nfs/grid/software/easybuild/commons/modules/all
15-
- /nfs/grid/software/RHEL7/medsci/modules/all
16-
- /nfs/grid/software/RHEL7/easybuild/modules/all
179

1810
BUILDTEST_CONFIGS_REPO: /lustre/workspace/home/siddis14/buildtest-configs
1911
BUILDTEST_TCL_REPO: /lustre/workspace/home/siddis14/Tcl-buildtest-config

config.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ BUILDTEST_JOB_TEMPLATE: template/job.slurm
77
BUILDTEST_MODULE_ROOT:
88
- /nfs/grid/software/RHEL6/general
99
- /nfs/grid/software/RHEL6/chemistry
10-
- /nfs/grid/software/RHEL7/non-easybuild/modules/all
11-
- /nfs/grid/software/easybuild/IvyBridge/redhat/7.3/modules/all
12-
# - /nfs/grid/software/easybuild/Haswell/redhat/7.3/modules/all
13-
# - /nfs/grid/software/easybuild/Broadwell/redhat/7.3/modules/all
14-
# - /nfs/grid/software/easybuild/SkyLake/redhat/7.3/modules/all
15-
- /nfs/grid/software/easybuild/commons/modules/all
16-
- /nfs/grid/software/RHEL7/medsci/modules/all
17-
- /nfs/grid/software/RHEL7/easybuild/modules/all
1810

1911
BUILDTEST_CONFIGS_REPO: /lustre/workspace/home/siddis14/buildtest-configs
2012
BUILDTEST_TCL_REPO: /lustre/workspace/home/siddis14/Tcl-buildtest-config

framework/main.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,13 @@
3636

3737

3838

39-
from framework.env import BUILDTEST_ROOT, BUILDTEST_JOB_EXTENSION, logID, config_opts
40-
from framework.runtest import runtest_menu
39+
from framework.env import config_opts
4140
from framework.test.binarytest import generate_binary_test
4241
from framework.test.function import clean_tests
4342
from framework.test.job import submit_job_to_scheduler, update_job_template
4443
from framework.test.sourcetest import recursive_gen_test
4544
from framework.test.testsets import run_testset
46-
from framework.tools.check_setup import check_buildtest_setup
47-
from framework.tools.config import show_configuration
45+
from framework.tools.config import check_configuration, show_configuration
4846
from framework.tools.file import create_dir
4947
from framework.tools.find import find_all_yaml_configs, find_yaml_configs_by_arg
5048
from framework.tools.find import find_all_tests, find_tests_by_arg
@@ -53,13 +51,13 @@
5351
from framework.tools.log import init_log, clean_logs
5452
from framework.tools.menu import buildtest_menu
5553
from framework.tools.modules import diff_trees
56-
from framework.tools.options import override_options_env_vars
54+
from framework.tools.options import override_configuration
5755
from framework.tools.print_functions import print_software_version_relation, print_software, print_toolchain
5856
from framework.tools.scan import scantest
5957
from framework.tools.software import get_unique_software, software_version_relation
6058
from framework.tools.utility import get_appname, get_appversion, get_toolchain_name, get_toolchain_version
6159
from framework.tools.version import buildtest_version
62-
60+
from framework.runtest import runtest_menu
6361

6462
# column width for linewrap for argparse library
6563
os.environ['COLUMNS'] = "120"
@@ -69,13 +67,13 @@ def main():
6967

7068
IGNORE_EASYBUILD=False
7169

70+
override_configuration()
71+
check_configuration()
7272

73+
BUILDTEST_CONFIGS_REPO = config_opts['BUILDTEST_CONFIGS_REPO']
74+
print BUILDTEST_CONFIGS_REPO
7375
parser = buildtest_menu()
7476
bt_opts = parser.parse_options()
75-
override_options_env_vars()
76-
check_buildtest_setup()
77-
78-
BUILDTEST_CONFIGS_REPO = config_opts['BUILDTEST_CONFIGS_REPO']
7977

8078
if config_opts.get('BUILDTEST_IGNORE_EASYBUILD'):
8179
IGNORE_EASYBUILD=config_opts['BUILDTEST_IGNORE_EASYBUILD']
@@ -233,7 +231,7 @@ def main():
233231
tcversion = get_toolchain_version()
234232

235233
print "Detecting Software: ", os.path.join(appname,appversion)
236-
234+
237235
logger.debug("Generating Test from EB Application")
238236

239237
logger.debug("Software: %s", appname)

framework/tools/check_setup.py

Lines changed: 0 additions & 154 deletions
This file was deleted.

framework/tools/config.py

Lines changed: 123 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,129 @@
2222

2323
import os
2424
import sys
25-
from framework.env import config_opts
25+
import time
26+
import logging
27+
import subprocess
28+
from framework.env import config_opts, BUILDTEST_ROOT, BUILDTEST_SHELLTYPES, BUILDTEST_JOB_EXTENSION
29+
30+
def check_configuration():
31+
"""
32+
Reports buildtest configuration and checks each BUILDTEST environment variable and check
33+
for module environment
34+
"""
35+
36+
BUILDTEST_MODULE_ROOT = config_opts['BUILDTEST_MODULE_ROOT']
37+
BUILDTEST_MODULE_NAMING_SCHEME = config_opts['BUILDTEST_MODULE_NAMING_SCHEME']
38+
BUILDTEST_TESTDIR = config_opts['BUILDTEST_TESTDIR']
39+
BUILDTEST_CONFIGS_REPO = config_opts['BUILDTEST_CONFIGS_REPO']
40+
BUILDTEST_PYTHON_REPO = config_opts['BUILDTEST_PYTHON_REPO']
41+
BUILDTEST_PERL_REPO = config_opts['BUILDTEST_PERL_REPO']
42+
BUILDTEST_R_REPO = config_opts['BUILDTEST_R_REPO']
43+
BUILDTEST_RUBY_REPO = config_opts['BUILDTEST_RUBY_REPO']
44+
BUILDTEST_TCL_REPO = config_opts['BUILDTEST_TCL_REPO']
45+
BUILDTEST_IGNORE_EASYBUILD = config_opts['BUILDTEST_IGNORE_EASYBUILD']
46+
BUILDTEST_SHELL = config_opts['BUILDTEST_SHELL']
47+
BUILDTEST_JOB_TEMPLATE = config_opts['BUILDTEST_JOB_TEMPLATE']
48+
49+
#print "Checking buildtest environment variables ..."
50+
51+
ec = 0
52+
53+
time.sleep(0.1)
54+
if not os.path.exists(BUILDTEST_ROOT):
55+
ec = 1
56+
print "ERROR: \t BUILDTEST_ROOT: ", BUILDTEST_ROOT, " does not exist"
57+
58+
59+
60+
time.sleep(0.1)
61+
if not os.path.exists(BUILDTEST_CONFIGS_REPO):
62+
ec = 1
63+
print "ERROR: \t BUILDTEST_CONFIGS_REPO: ", BUILDTEST_CONFIGS_REPO, " does not exist"
64+
65+
66+
time.sleep(0.1)
67+
for tree in BUILDTEST_MODULE_ROOT:
68+
if not os.path.exists(tree):
69+
ec = 1
70+
print "ERROR: \t BUILDTEST_MODULE_ROOT:",tree, "does not exists "
71+
72+
73+
74+
time.sleep(0.1)
75+
if BUILDTEST_MODULE_NAMING_SCHEME not in ["FNS", "HMNS"]:
76+
ec = 1
77+
print "ERROR: \t BUILDTEST_MODULE_NAMING_SCHEME:", BUILDTEST_MODULE_NAMING_SCHEME, " valid values are {HMNS, FNS}"
78+
79+
time.sleep(0.1)
80+
81+
if BUILDTEST_IGNORE_EASYBUILD not in ["True", "False"]:
82+
ec = 1
83+
print "ERROR: \t BUILDTEST_IGNORE_EASYBUILD:", BUILDTEST_IGNORE_EASYBUILD, " valid values are {True, False} "
84+
85+
time.sleep(0.1)
86+
if not os.path.exists(BUILDTEST_R_REPO):
87+
ec = 1
88+
print "ERROR: \t BUILDTEST_R_REPO: ", BUILDTEST_R_REPO, " does not exist"
89+
90+
time.sleep(0.1)
91+
if not os.path.exists(BUILDTEST_PERL_REPO):
92+
ec = 1
93+
print "ERROR: \t BUILDTEST_PERL_REPO: ", BUILDTEST_PERL_REPO, " does not exist"
94+
95+
96+
97+
time.sleep(0.1)
98+
if not os.path.exists(BUILDTEST_PYTHON_REPO):
99+
ec = 1
100+
print "ERROR: \t BUILDTEST_PYTHON_REPO: ", BUILDTEST_PYTHON_REPO, " does not exist"
101+
102+
103+
time.sleep(0.1)
104+
if not os.path.exists(BUILDTEST_RUBY_REPO):
105+
ec = 1
106+
print "ERROR: \t BUILDTEST_RUBY_REPO: ", BUILDTEST_RUBY_REPO, " does not exist"
107+
108+
109+
110+
time.sleep(0.1)
111+
if not os.path.exists(BUILDTEST_TCL_REPO):
112+
ec = 1
113+
print "ERROR: \t BUILDTEST_TCL_REPO: ", BUILDTEST_TCL_REPO, " does not exist"
114+
115+
116+
time.sleep(0.1)
117+
if BUILDTEST_SHELL not in BUILDTEST_SHELLTYPES:
118+
ec = 1
119+
print "ERROR: \t BUILDTEST_SHELL:", BUILDTEST_SHELL, " not a valid value, must be one of the following:", BUILDTEST_SHELLTYPES
120+
121+
time.sleep(0.1)
122+
123+
124+
if not os.path.exists(BUILDTEST_JOB_TEMPLATE):
125+
ec = 1
126+
print "ERROR:\t BUILDTEST_JOB_TEMPLATE: ", BUILDTEST_JOB_TEMPLATE, " does not exist"
127+
128+
time.sleep(0.1)
129+
130+
if os.path.splitext(BUILDTEST_JOB_TEMPLATE)[1] not in BUILDTEST_JOB_EXTENSION:
131+
print "Invalid file extension:", BUILDTEST_JOB_EXTENSION, ", must be one of the following extension", BUILDTEST_JOB_EXTENSION
132+
133+
time.sleep(0.1)
134+
135+
if ec != 0:
136+
print "Please fix your BUILDTEST configuration"
137+
sys.exit(1)
138+
139+
cmd = "module --version"
140+
ret = subprocess.Popen(cmd,shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
141+
(outputmsg,errormsg) = ret.communicate()
142+
ec = ret.returncode
143+
144+
if ec != 0:
145+
print "module commmand not found in system"
146+
print outputmsg, errormsg
147+
sys.exit(1)
26148

27149
def show_configuration():
28150
""" show buildtest configuration """

0 commit comments

Comments
 (0)