Skip to content

Commit c744a1d

Browse files
committed
Fix missing command output in test_step
1 parent f07fbde commit c744a1d

File tree

4 files changed

+40
-3
lines changed

4 files changed

+40
-3
lines changed

easybuild/framework/easyblock.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2139,10 +2139,11 @@ def build_step(self):
21392139

21402140
def test_step(self):
21412141
"""Run unit tests provided by software (if any)."""
2142-
if self.cfg['runtest']:
2142+
unit_test_cmd = self.cfg['runtest']
2143+
if unit_test_cmd:
21432144

2144-
self.log.debug("Trying to execute %s as a command for running unit tests...")
2145-
(out, _) = run_cmd(self.cfg['runtest'], log_all=True, simple=False)
2145+
self.log.debug("Trying to execute %s as a command for running unit tests...", unit_test_cmd)
2146+
(out, _) = run_cmd(unit_test_cmd, log_all=True, simple=False)
21462147

21472148
return out
21482149

@@ -3310,6 +3311,10 @@ def build_and_install_one(ecdict, init_env):
33103311
_log.debug("Skip set to %s" % skip)
33113312
app.cfg['skip'] = skip
33123313

3314+
if build_option('skip_test_step'):
3315+
_log.debug('Adding test_step to skipped steps')
3316+
app.cfg.update('skipsteps', TEST_STEP, allow_duplicate=False)
3317+
33133318
# build easyconfig
33143319
errormsg = '(no error)'
33153320
# timing info

easybuild/tools/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ def mk_full_default_path(name, prefix=DEFAULT_PREFIX):
253253
'sequential',
254254
'set_gid_bit',
255255
'skip_test_cases',
256+
'skip_test_step',
256257
'generate_devel_module',
257258
'sticky_bit',
258259
'trace',

easybuild/tools/options.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ def override_options(self):
439439
'silence-deprecation-warnings': ("Silence specified deprecation warnings", 'strlist', 'extend', None),
440440
'sticky-bit': ("Set sticky bit on newly created directories", None, 'store_true', False),
441441
'skip-test-cases': ("Skip running test cases", None, 'store_true', False, 't'),
442+
'skip-test-step': ("Skip running the test step (e.g. unit tests)", None, 'store_true', False),
442443
'generate-devel-module': ("Generate a develop module file, implies --force if disabled",
443444
None, 'store_true', True),
444445
'sysroot': ("Location root directory of system, prefix for standard paths like /usr/lib and /usr/include",

test/framework/options.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,36 @@ def test_skip(self):
340340

341341
self.assertEqual(len(glob.glob(toy_mod_glob)), 1)
342342

343+
def test_skip_test_step(self):
344+
"""Test skipping testing the build (--skip-test-step)."""
345+
346+
topdir = os.path.abspath(os.path.dirname(__file__))
347+
toy_ec = os.path.join(topdir, 'easyconfigs', 'test_ecs', 't', 'toy', 'toy-0.0-test.eb')
348+
349+
# check log message without --skip-test-step
350+
args = [
351+
toy_ec,
352+
'--extended-dry-run',
353+
'--force',
354+
'--debug',
355+
]
356+
outtxt = self.eb_main(args, do_build=True)
357+
found_msg = "Running method test_step part of step test"
358+
found = re.search(found_msg, outtxt)
359+
test_run_msg = "execute make_test dummy_cmd as a command for running unit tests"
360+
self.assertTrue(found, "Message about test step being run is present, outtxt: %s" % outtxt)
361+
found = re.search(test_run_msg, outtxt)
362+
self.assertTrue(found, "Test execution command is present, outtxt: %s" % outtxt)
363+
364+
# And now with the argument
365+
args.append('--skip-test-step')
366+
outtxt = self.eb_main(args, do_build=True)
367+
found_msg = "Skipping test step"
368+
found = re.search(found_msg, outtxt)
369+
self.assertTrue(found, "Message about test step being skipped is present, outtxt: %s" % outtxt)
370+
found = re.search(test_run_msg, outtxt)
371+
self.assertFalse(found, "Test execution command is NOT present, outtxt: %s" % outtxt)
372+
343373
def test_job(self):
344374
"""Test submitting build as a job."""
345375

0 commit comments

Comments
 (0)