Skip to content

Commit d8e30da

Browse files
committed
tests: runtime: Print BEFORE/AFTER logs on CLEANUP failure
CLEANUP can fail if BEFORE/AFTER commands fail. Thus, we should print their logs on CLEANUP failure to assist with debugging.
1 parent 988203b commit d8e30da

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/runtime/engine/runner.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -496,11 +496,6 @@ def found_all_children(lines):
496496
os.killpg(os.getpgid(after.pid), signal.SIGKILL)
497497
after_output = after.communicate()[0]
498498

499-
if test.cleanup:
500-
cleanup = Runner.__setup_cleanup(test, setup=False)
501-
if cleanup:
502-
return cleanup
503-
504499
def to_utf8(s):
505500
return s.encode("unicode_escape").decode("utf-8")
506501

@@ -511,6 +506,12 @@ def print_befores_and_after_output():
511506
if after_output is not None:
512507
print(f"\tAfter cmd output: {to_utf8(after_output)}")
513508

509+
if test.cleanup:
510+
cleanup = Runner.__setup_cleanup(test, setup=False)
511+
if cleanup:
512+
print_befores_and_after_output()
513+
return cleanup
514+
514515
elapsed = math.ceil((time.time() - start_time) * 1000)
515516
label = f"{test.suite}.{test.name} ({elapsed} ms)"
516517

0 commit comments

Comments
 (0)