Handle tests that just won't stop

This commit is contained in:
Jeff Epler 2022-10-14 16:40:10 -05:00
parent 963a51487a
commit 4f190c9228
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
1 changed files with 12 additions and 2 deletions

View File

@ -183,7 +183,17 @@ def run_micropython(pyb, args, test_file, is_special=False):
# run the actual test # run the actual test
try: 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: except subprocess.CalledProcessError as er:
had_crash = True had_crash = True
output_mupy = er.output + b"CRASH" output_mupy = er.output + b"CRASH"
@ -869,7 +879,7 @@ the last matching regex is used:
tests = args.files tests = args.files
if not args.keep_path: 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( os.environ["MICROPYPATH"] = os.pathsep.join(
[ [
"", "",