summaryrefslogtreecommitdiff
path: root/tests/run-tests.py
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-12-03 12:31:50 +1100
committerDamien George <damien@micropython.org>2024-12-06 13:47:21 +1100
commita8422439ab5e86eeaceae09c4655101225fe5fce (patch)
tree93036aa9304cefefb61f31c2d84929bf89b659fa /tests/run-tests.py
parenta2554f09573e0a856d9abf9e718bac9977a510db (diff)
tests/run-tests.py: Print .out file when there is no .exp file.
So that a failing unittest-based test has its entire log printed when using `run-tests.py --print-failures`. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/run-tests.py')
-rwxr-xr-xtests/run-tests.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/run-tests.py b/tests/run-tests.py
index 0e491ccd6..6fe45707b 100755
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1154,11 +1154,18 @@ the last matching regex is used:
args = cmd_parser.parse_args()
if args.print_failures:
- for exp in glob(os.path.join(args.result_dir, "*.exp")):
- testbase = exp[:-4]
+ for out in glob(os.path.join(args.result_dir, "*.out")):
+ testbase = out[:-4]
print()
print("FAILURE {0}".format(testbase))
- os.system("{0} {1}.exp {1}.out".format(DIFF, testbase))
+ if os.path.exists(testbase + ".exp"):
+ # Show diff of expected and actual output.
+ os.system("{0} {1}.exp {1}.out".format(DIFF, testbase))
+ else:
+ # No expected output, just show the actual output (eg from a unittest).
+ with open(out) as f:
+ for line in f:
+ print(line, end="")
sys.exit(0)