Skip to content

Commit 3fe33e0

Browse files
authored
Merge pull request #3702 from boegel/skip_extensions
add support for --skip-extensions
2 parents 86c6764 + 717a154 commit 3fe33e0

File tree

5 files changed

+63
-9
lines changed

5 files changed

+63
-9
lines changed

easybuild/framework/easyblock.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2912,9 +2912,12 @@ def _sanity_check_step_extensions(self):
29122912
"""Sanity check on extensions (if any)."""
29132913
failed_exts = []
29142914

2915-
# class instances for extensions may not be initialized yet here,
2916-
# for example when using --module-only or --sanity-check-only
2917-
if not self.ext_instances:
2915+
if build_option('skip_extensions'):
2916+
self.log.info("Skipping sanity check for extensions since skip-extensions is enabled...")
2917+
return
2918+
elif not self.ext_instances:
2919+
# class instances for extensions may not be initialized yet here,
2920+
# for example when using --module-only or --sanity-check-only
29182921
self.prepare_for_extensions()
29192922
self.init_ext_instances()
29202923

@@ -3306,6 +3309,8 @@ def skip_step(self, step, skippable):
33063309
force = build_option('force')
33073310
module_only = build_option('module_only')
33083311
sanity_check_only = build_option('sanity_check_only')
3312+
skip_extensions = build_option('skip_extensions')
3313+
skip_test_step = build_option('skip_test_step')
33093314
skipsteps = self.cfg['skipsteps']
33103315

33113316
# under --skip, sanity check is not skipped
@@ -3332,10 +3337,19 @@ def skip_step(self, step, skippable):
33323337
self.log.info("Skipping %s step because of sanity-check-only mode", step)
33333338
skip = True
33343339

3340+
elif skip_extensions and step == EXTENSIONS_STEP:
3341+
self.log.info("Skipping %s step as requested via skip-extensions", step)
3342+
skip = True
3343+
3344+
elif skip_test_step and step == TEST_STEP:
3345+
self.log.info("Skipping %s step as requested via skip-test-step", step)
3346+
skip = True
3347+
33353348
else:
33363349
msg = "Not skipping %s step (skippable: %s, skip: %s, skipsteps: %s, module_only: %s, force: %s, "
3337-
msg += "sanity_check_only: %s)"
3338-
self.log.debug(msg, step, skippable, self.skip, skipsteps, module_only, force, sanity_check_only)
3350+
msg += "sanity_check_only: %s, skip_extensions: %s, skip_test_step: %s)"
3351+
self.log.debug(msg, step, skippable, self.skip, skipsteps, module_only, force,
3352+
sanity_check_only, skip_extensions, skip_test_step)
33393353

33403354
return skip
33413355

@@ -3599,10 +3613,6 @@ def build_and_install_one(ecdict, init_env):
35993613
_log.debug("Skip set to %s" % skip)
36003614
app.cfg['skip'] = skip
36013615

3602-
if build_option('skip_test_step'):
3603-
_log.debug('Adding test_step to skipped steps')
3604-
app.cfg.update('skipsteps', TEST_STEP, allow_duplicate=False)
3605-
36063616
# build easyconfig
36073617
errormsg = '(no error)'
36083618
# timing info

easybuild/tools/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ def mk_full_default_path(name, prefix=DEFAULT_PREFIX):
263263
'search_paths',
264264
'sequential',
265265
'set_gid_bit',
266+
'skip_extensions',
266267
'skip_test_cases',
267268
'skip_test_step',
268269
'generate_devel_module',

easybuild/tools/options.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ def override_options(self):
466466
'set-gid-bit': ("Set group ID bit on newly created directories", None, 'store_true', False),
467467
'silence-deprecation-warnings': ("Silence specified deprecation warnings", 'strlist', 'extend', None),
468468
'sticky-bit': ("Set sticky bit on newly created directories", None, 'store_true', False),
469+
'skip-extensions': ("Skip installation of extensions", None, 'store_true', False),
469470
'skip-test-cases': ("Skip running test cases", None, 'store_true', False, 't'),
470471
'skip-test-step': ("Skip running the test step (e.g. unit tests)", None, 'store_true', False),
471472
'generate-devel-module': ("Generate a develop module file, implies --force if disabled",

test/framework/options.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5893,6 +5893,42 @@ def test_sanity_check_only(self):
58935893
regex = re.compile(error_pattern)
58945894
self.assertTrue(regex.search(error_msg), "Pattern '%s' should be found in: %s" % (regex.pattern, error_msg))
58955895

5896+
# failing sanity check for extension can be bypassed via --skip-extensions
5897+
outtxt = self.eb_main(args + ['--skip-extensions'], do_build=True, raise_error=True)
5898+
self.assertTrue("Sanity check for toy successful" in outtxt)
5899+
5900+
def test_skip_extensions(self):
5901+
"""Test use of --skip-extensions."""
5902+
topdir = os.path.abspath(os.path.dirname(__file__))
5903+
toy_ec = os.path.join(topdir, 'easyconfigs', 'test_ecs', 't', 'toy', 'toy-0.0.eb')
5904+
5905+
# add extension, which should be skipped
5906+
test_ec = os.path.join(self.test_prefix, 'test.ec')
5907+
test_ec_txt = read_file(toy_ec)
5908+
test_ec_txt += '\n' + '\n'.join([
5909+
"exts_list = [",
5910+
" ('barbar', '0.0', {",
5911+
" 'start_dir': 'src',",
5912+
" 'exts_filter': ('ls -l lib/lib%(ext_name)s.a', ''),",
5913+
" })",
5914+
"]",
5915+
])
5916+
write_file(test_ec, test_ec_txt)
5917+
5918+
args = [test_ec, '--force', '--skip-extensions']
5919+
self.eb_main(args, do_build=True, return_error=True)
5920+
5921+
toy_mod = os.path.join(self.test_installpath, 'modules', 'all', 'toy', '0.0')
5922+
if get_module_syntax() == 'Lua':
5923+
toy_mod += '.lua'
5924+
5925+
self.assertTrue(os.path.exists(toy_mod), "%s should exist" % toy_mod)
5926+
5927+
toy_installdir = os.path.join(self.test_installpath, 'software', 'toy', '0.0')
5928+
for path in (os.path.join('bin', 'barbar'), os.path.join('lib', 'libbarbar.a')):
5929+
path = os.path.join(toy_installdir, path)
5930+
self.assertFalse(os.path.exists(path), "Path %s should not exist" % path)
5931+
58965932
def test_fake_vsc_include(self):
58975933
"""Test whether fake 'vsc' namespace is triggered for modules included via --include-*."""
58985934

test/framework/toy_build.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,6 +1742,12 @@ def test_module_only_extensions(self):
17421742
do_build=True, raise_error=True)
17431743
self.assertFalse(os.path.exists(toy_mod))
17441744

1745+
# failing sanity check for barbar extension is ignored when using --module-only --skip-extensions
1746+
for extra_args in (['--module-only'], ['--module-only', '--rebuild']):
1747+
self.eb_main([test_ec, '--skip-extensions'] + extra_args, do_build=True, raise_error=True)
1748+
self.assertTrue(os.path.exists(toy_mod))
1749+
remove_file(toy_mod)
1750+
17451751
# we can force module generation via --force (which skips sanity check entirely)
17461752
self.eb_main([test_ec, '--module-only', '--force'], do_build=True, raise_error=True)
17471753
self.assertTrue(os.path.exists(toy_mod))

0 commit comments

Comments
 (0)