Skip to content

Commit 292498f

Browse files
committed
add test for processing an easystack file that relies on wiping of easyconfig caches in process_easystack
1 parent e2fbdd2 commit 292498f

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

easybuild/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def process_easystack(easystack_path, args, logfile, testing, init_session_state
240240
do_cleanup = True
241241
for (path, ec_opts) in easystack.ec_opt_tuples:
242242
_log.debug("Starting build for %s" % path)
243-
# Whipe easyconfig caches
243+
# wipe easyconfig caches
244244
easyconfig._easyconfigs_cache.clear()
245245
easyconfig._easyconfig_files_cache.clear()
246246

test/framework/options.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6605,6 +6605,49 @@ def test_easystack_opts(self):
66056605
self.assertTrue(build_option('force'))
66066606
self.assertEqual(build_option('robot'), [robot_paths, self.test_prefix])
66076607

6608+
def test_easystack_easyconfigs_cache(self):
6609+
"""
6610+
Test for easystack file that specifies same easyconfig twice,
6611+
but from a different location.
6612+
"""
6613+
topdir = os.path.abspath(os.path.dirname(__file__))
6614+
libtoy_ec = os.path.join(topdir, 'easyconfigs', 'test_ecs', 'l', 'libtoy', 'libtoy-0.0.eb')
6615+
toy_ec = os.path.join(topdir, 'easyconfigs', 'test_ecs', 't', 'toy', 'toy-0.0.eb')
6616+
6617+
test_ec = os.path.join(self.test_prefix, 'toy-0.0.eb')
6618+
test_ec_txt = read_file(toy_ec)
6619+
test_ec_txt += "\ndependencies = [('libtoy', '0.0')]"
6620+
write_file(test_ec, test_ec_txt)
6621+
6622+
test_subdir = os.path.join(self.test_prefix, 'deps')
6623+
mkdir(test_subdir, parents=True)
6624+
copy_file(libtoy_ec, test_subdir)
6625+
6626+
test_es_txt = '\n'.join([
6627+
"easyconfigs:",
6628+
" - toy-0.0",
6629+
" - toy-0.0:",
6630+
" options:",
6631+
" robot: %s:%s" % (test_subdir, self.test_prefix),
6632+
])
6633+
test_es_path = os.path.join(self.test_prefix, 'test.yml')
6634+
write_file(test_es_path, test_es_txt)
6635+
6636+
args = [
6637+
'--experimental',
6638+
'--easystack', test_es_path,
6639+
'--dry-run',
6640+
'--robot=%s' % self.test_prefix,
6641+
]
6642+
stdout = self.eb_main(args, do_build=True, raise_error=True, redo_init_config=False)
6643+
6644+
# check whether libtoy-0.0.eb comes from 2nd
6645+
regex = re.compile(r"^ \* \[ \] %s" % libtoy_ec, re.M)
6646+
self.assertTrue(regex.search(stdout), "Pattern '%s' should be found in: %s" % (regex.pattern, stdout))
6647+
6648+
regex = re.compile(r"^ \* \[ \] %s" % os.path.join(test_subdir, 'libtoy-0.0.eb'), re.M)
6649+
self.assertTrue(regex.search(stdout), "Pattern '%s' should be found in: %s" % (regex.pattern, stdout))
6650+
66086651
def test_set_up_configuration(self):
66096652
"""Tests for set_up_configuration function."""
66106653

0 commit comments

Comments
 (0)