Skip to content

Commit

Permalink
Fix some tests using new module_depends_on being true by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Micket committed Sep 18, 2024
1 parent 9361e6e commit 413ec3e
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions test/framework/toy_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,9 +873,9 @@ def test_toy_hierarchical(self):
# check that toolchain load is expanded to loads for toolchain dependencies,
# except for the ones that extend $MODULEPATH to make the toy module available
if get_module_syntax() == 'Tcl':
load_regex_template = "load %s"
load_regex_template = "(load|depends-on) %s"
elif get_module_syntax() == 'Lua':
load_regex_template = r'load\("%s/.*"\)'
load_regex_template = r'(load|depends_on)\("%s/.*"\)'
else:
self.fail("Unknown module syntax: %s" % get_module_syntax())

Expand Down Expand Up @@ -1739,8 +1739,10 @@ def test_module_only(self):

# make sure load statements for dependencies are included in additional module file generated with --module-only
modtxt = read_file(toy_mod)
self.assertTrue(re.search('load.*intel/2018a', modtxt), "load statement for intel/2018a found in module")
self.assertTrue(re.search('load.*GCC/6.4.0-2.28', modtxt), "load statement for GCC/6.4.0-2.28 found in module")
self.assertTrue(re.search('(load|depends[-_]on).*intel/2018a', modtxt),
"load statement for intel/2018a found in module")
self.assertTrue(re.search('(load|depends[-_]on).*GCC/6.4.0-2.28', modtxt),
"load statement for GCC/6.4.0-2.28 found in module")

os.remove(toy_mod)

Expand Down Expand Up @@ -1782,7 +1784,7 @@ def test_module_only(self):

# make sure load statements for dependencies are included
modtxt = read_file(toy_core_mod)
self.assertTrue(re.search('load.*intel/2018a', modtxt), "load statement for intel/2018a found in module")
self.assertTrue(re.search('(load|depends[-_]on).*intel/2018a', modtxt), "load statement for intel/2018a found in module")

# Test we can create a module even for an installation where we don't have write permissions
os.remove(toy_core_mod)
Expand All @@ -1800,7 +1802,7 @@ def test_module_only(self):

# make sure load statements for dependencies are included
modtxt = read_file(toy_core_mod)
self.assertTrue(re.search('load.*intel/2018a', modtxt), "load statement for intel/2018a found in module")
self.assertTrue(re.search('(load|depends[-_]on).*intel/2018a', modtxt), "load statement for intel/2018a found in module")

os.remove(toy_core_mod)
os.remove(toy_mod)
Expand Down Expand Up @@ -3176,6 +3178,7 @@ def test_toy_multi_deps(self):
test_ec_txt += "\nexts_list = [('barbar', '1.2', {'start_dir': 'src'})]"

test_ec_txt += "\nmulti_deps = {'GCC': ['4.6.3', '7.3.0-2.30']}"

write_file(test_ec, test_ec_txt)

test_mod_path = os.path.join(self.test_installpath, 'modules', 'all')
Expand Down Expand Up @@ -3204,8 +3207,10 @@ def test_toy_multi_deps(self):
# check whether (guarded) load statement for first version listed in multi_deps is there
if get_module_syntax() == 'Lua':
expected = '\n'.join([
'if not ( isloaded("GCC/4.6.3") ) and not ( isloaded("GCC/7.3.0-2.30") ) then',
' load("GCC/4.6.3")',
'if mode() == "unload" or isloaded("GCC/7.3.0-2.30") then',
' depends_on("GCC")',
'else',
' depends_on("GCC/4.6.3")',
'end',
])
else:
Expand Down

0 comments on commit 413ec3e

Please sign in to comment.