From 49e0dd54e650295fcb46b2a47ae08f369e5cfdac Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 14 Feb 2018 17:19:44 +1100 Subject: [PATCH] tests/run-tests: Capture any output from a crashed uPy execution. Instead of putting just 'CRASH' in the .py.out file, this patch makes it so any output from uPy that led to the crash is stored in the .py.out file, as well as the 'CRASH' message at the end. --- tests/run-tests | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/run-tests b/tests/run-tests index 8719befbda..627fa40dac 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -54,6 +54,7 @@ def run_micropython(pyb, args, test_file, is_special=False): 'micropython/meminfo.py', 'basics/bytes_compare3.py', 'basics/builtin_help.py', 'thread/thread_exc2.py', ) + had_crash = False if pyb is None: # run on PC if test_file.startswith(('cmdline/', 'feature_check/')) or test_file in special_tests: @@ -128,8 +129,9 @@ def run_micropython(pyb, args, test_file, is_special=False): # run the actual test try: output_mupy = subprocess.check_output(cmdlist, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError: - output_mupy = b'CRASH' + except subprocess.CalledProcessError as er: + had_crash = True + output_mupy = er.output + b'CRASH' # clean up if we had an intermediate .mpy file if args.via_mpy: @@ -142,13 +144,14 @@ def run_micropython(pyb, args, test_file, is_special=False): try: output_mupy = pyb.execfile(test_file) except pyboard.PyboardError: + had_crash = True output_mupy = b'CRASH' # canonical form for all ports/platforms is to use \n for end-of-line output_mupy = output_mupy.replace(b'\r\n', b'\n') # don't try to convert the output if we should skip this test - if output_mupy in (b'SKIP\n', b'CRASH'): + if had_crash or output_mupy in (b'SKIP\n', b'CRASH'): return output_mupy if is_special or test_file in special_tests: