run_tests: flush output

On GitHub, the output of external processes such as isabelle overtake
the stdout/stderr output of the test driver. Flushing stdout/stderr
in the right spots avoids that.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
This commit is contained in:
Gerwin Klein 2021-07-15 13:20:14 +10:00 committed by Gerwin Klein
parent 0ac43566d7
commit 115b12f1e2
2 changed files with 6 additions and 0 deletions

View File

@ -180,6 +180,7 @@ def run_test(test, status_queue, kill_switch,
else:
path = ""
print(" command: %s%s" % (test.command, path))
sys.stdout.flush()
# Determine where stdout should go. We can't print it live to stdout and
# also capture it, unfortunately.
@ -198,6 +199,7 @@ def run_test(test, status_queue, kill_switch,
output = "Exception while running test:\n\n%s" % (traceback.format_exc())
if verbose:
print(output)
sys.stdout.flush()
status_queue.put({'name': test.name,
'status': ERROR,
'output': output,
@ -324,6 +326,7 @@ def run_test(test, status_queue, kill_switch,
if verbose and github:
print("::endgroup::")
sys.stdout.flush()
status_queue.put({'name': test.name,
'status': test_status[0],
@ -541,6 +544,7 @@ def main():
if bad_names:
sys.stderr.write("Warning: These tests are excluded/removed, but do not exist: %s\n" %
(", ".join(sorted(bad_names))))
sys.stderr.flush()
if args.dry_run:
if args.dot:

View File

@ -111,6 +111,8 @@ for arch in archs:
elif "L4V_ARCH_IS_ARM" in os.environ:
del os.environ["L4V_ARCH_IS_ARM"]
sys.stdout.flush()
# Arguments:
args = ['./misc/regression/run_tests.py'] # Script name
args += [r for t in EXCLUDE[arch] for r in ['-r', t]] # Exclusion list