From 4f190c9228dfeb7c42d6ff8e6a300653aae82cc9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 14 Oct 2022 16:40:10 -0500 Subject: [PATCH] Handle tests that just won't stop --- tests/run-tests.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/run-tests.py b/tests/run-tests.py index 15e9899e89..ed0cf18e45 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -183,7 +183,17 @@ def run_micropython(pyb, args, test_file, is_special=False): # run the actual test try: - output_mupy = subprocess.check_output(cmdlist, stderr=subprocess.STDOUT) + result = subprocess.run( + cmdlist, + stderr=subprocess.STDOUT, + stdout=subprocess.PIPE, + check=True, + timeout=10, + ) + output_mupy = result.stdout + except subprocess.TimeoutExpired as er: + had_crash = True + output_mupy = (er.output or b"") + b"TIMEOUT" except subprocess.CalledProcessError as er: had_crash = True output_mupy = er.output + b"CRASH" @@ -869,7 +879,7 @@ the last matching regex is used: tests = args.files if not args.keep_path: - # clear search path to make sure tests use only builtin modules and those in extmod + # clear search path to make sure tests use only builtin modules and those that can be frozen os.environ["MICROPYPATH"] = os.pathsep.join( [ "",