Ensure log file is fully written before reading it
authorTim Newsome <tim@sifive.com>
Mon, 20 Nov 2017 04:54:33 +0000 (20:54 -0800)
committerTim Newsome <tim@sifive.com>
Mon, 20 Nov 2017 04:54:33 +0000 (20:54 -0800)
Fixes --print-failures sometimes not actually printing out details about
failures.

debug/testlib.py

index 90702bf605652b08372a3a96f2b0b4af07403cf7..5fc384aa66af3e1ff727f120c01d0f2a6efba523 100644 (file)
@@ -606,6 +606,7 @@ def run_tests(parsed, target, todo):
         finally:
             sys.stdout = real_stdout
             log_fd.write("Time elapsed: %.2fs\n" % (time.time() - start))
+            log_fd.flush()
         print "[%s] %s in %.2fs" % (name, result, time.time() - start)
         if result not in good_results and parsed.print_failures:
             sys.stdout.write(open(log_name).read())