Skip to content

Commit

Permalink
add test for processing an easystack file that relies on wiping of ea…
Browse files Browse the repository at this point in the history
…syconfig caches in process_easystack
  • Loading branch information
boegel committed Oct 21, 2022
1 parent e2fbdd2 commit 10bbb3c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion easybuild/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def process_easystack(easystack_path, args, logfile, testing, init_session_state
do_cleanup = True
for (path, ec_opts) in easystack.ec_opt_tuples:
_log.debug("Starting build for %s" % path)
# Whipe easyconfig caches
# wipe easyconfig caches
easyconfig._easyconfigs_cache.clear()
easyconfig._easyconfig_files_cache.clear()

Expand Down
45 changes: 45 additions & 0 deletions test/framework/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -6605,6 +6605,51 @@ def test_easystack_opts(self):
self.assertTrue(build_option('force'))
self.assertEqual(build_option('robot'), [robot_paths, self.test_prefix])

def test_easystack_easyconfigs_cache(self):
"""
Test for easystack file that specifies same easyconfig twice,
but from a different location.
"""
robot_paths = os.environ['EASYBUILD_ROBOT_PATHS']

topdir = os.path.abspath(os.path.dirname(__file__))
libtoy_ec = os.path.join(topdir, 'easyconfigs', 'test_ecs', 'l', 'libtoy', 'libtoy-0.0.eb')
toy_ec = os.path.join(topdir, 'easyconfigs', 'test_ecs', 't', 'toy', 'toy-0.0.eb')

test_ec = os.path.join(self.test_prefix, 'toy-0.0.eb')
test_ec_txt = read_file(toy_ec)
test_ec_txt += "\ndependencies = [('libtoy', '0.0')]"
write_file(test_ec, test_ec_txt)

test_subdir = os.path.join(self.test_prefix, 'deps')
mkdir(test_subdir, parents=True)
copy_file(libtoy_ec, test_subdir)

test_es_txt = '\n'.join([
"easyconfigs:",
" - toy-0.0",
" - toy-0.0:",
" options:",
" robot: %s:%s" % (test_subdir, self.test_prefix),
])
test_es_path = os.path.join(self.test_prefix, 'test.yml')
write_file(test_es_path, test_es_txt)

args = [
'--experimental',
'--easystack', test_es_path,
'--dry-run',
'--robot=%s' % self.test_prefix,
]
stdout = self.eb_main(args, do_build=True, raise_error=True, redo_init_config=False)

# check whether libtoy-0.0.eb comes from 2nd
regex = re.compile(r"^ \* \[ \] %s" % libtoy_ec, re.M)
self.assertTrue(regex.search(stdout), "Pattern '%s' should be found in: %s" % (regex.pattern, stdout))

regex = re.compile(r"^ \* \[ \] %s" % os.path.join(test_subdir, 'libtoy-0.0.eb'), re.M)
self.assertTrue(regex.search(stdout), "Pattern '%s' should be found in: %s" % (regex.pattern, stdout))

def test_set_up_configuration(self):
"""Tests for set_up_configuration function."""

Expand Down

0 comments on commit 10bbb3c

Please sign in to comment.