Skip to content

Commit 4845565

Browse files
authored
Merge pull request #3316 from boegel/fix_trace_msg_sanity_check_command
print trace message for sanity check command before running it
2 parents 9090e1a + 7d3b93b commit 4845565

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

easybuild/framework/easyblock.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2650,6 +2650,9 @@ def xs2str(xs):
26502650

26512651
# run sanity check commands
26522652
for command in commands:
2653+
2654+
trace_msg("running command '%s' ..." % command)
2655+
26532656
out, ec = run_cmd(command, simple=False, log_ok=False, log_all=False, trace=False)
26542657
if ec != 0:
26552658
fail_msg = "sanity check command %s exited with code %s (output: %s)" % (command, ec, out)
@@ -2658,7 +2661,7 @@ def xs2str(xs):
26582661
else:
26592662
self.log.info("sanity check command %s ran successfully! (output: %s)" % (command, out))
26602663

2661-
trace_msg("running command '%s': %s" % (command, ('FAILED', 'OK')[ec == 0]))
2664+
trace_msg("result for command '%s': %s" % (command, ('FAILED', 'OK')[ec == 0]))
26622665

26632666
# also run sanity check for extensions (unless we are an extension ourselves)
26642667
if not extension:

test/framework/toy_build.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2256,9 +2256,16 @@ def test_toy_modaltsoftname(self):
22562256

22572257
def test_toy_build_trace(self):
22582258
"""Test use of --trace"""
2259+
2260+
topdir = os.path.dirname(os.path.abspath(__file__))
2261+
toy_ec_file = os.path.join(topdir, 'easyconfigs', 'test_ecs', 't', 'toy', 'toy-0.0.eb')
2262+
2263+
test_ec = os.path.join(self.test_prefix, 'test.eb')
2264+
write_file(test_ec, read_file(toy_ec_file) + '\nsanity_check_commands = ["toy"]')
2265+
22592266
self.mock_stderr(True)
22602267
self.mock_stdout(True)
2261-
self.test_toy_build(extra_args=['--trace', '--experimental'], verify=False, testing=False)
2268+
self.test_toy_build(ec_file=test_ec, extra_args=['--trace', '--experimental'], verify=False, testing=False)
22622269
stderr = self.get_stderr()
22632270
stdout = self.get_stdout()
22642271
self.mock_stderr(False)
@@ -2283,6 +2290,8 @@ def test_toy_build_trace(self):
22832290
r"== sanity checking\.\.\.",
22842291
r" >> file 'bin/yot' or 'bin/toy' found: OK",
22852292
r" >> \(non-empty\) directory 'bin' found: OK",
2293+
r" >> running command 'toy' \.\.\.",
2294+
r" >> result for command 'toy': OK",
22862295
]) + r'$',
22872296
r"^== creating module\.\.\.\n >> generating module file @ .*/modules/all/toy/0\.0(?:\.lua)?$",
22882297
]

0 commit comments

Comments
 (0)