summaryrefslogtreecommitdiff
path: root/tests/run-tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run-tests')
-rwxr-xr-xtests/run-tests32
1 files changed, 23 insertions, 9 deletions
diff --git a/tests/run-tests b/tests/run-tests
index f24fc0961..a45477dea 100755
--- a/tests/run-tests
+++ b/tests/run-tests
@@ -123,9 +123,13 @@ def run_micropython(pyb, args, test_file, is_special=False):
cmdlist.append(test_file)
# run the actual test
- try:
- output_mupy = subprocess.check_output(cmdlist)
- except subprocess.CalledProcessError:
+ e = {"MICROPYPATH": os.getcwd() + ":", "LANG": "en_US.UTF-8"}
+ p = subprocess.Popen(cmdlist, env=e, stdout=subprocess.PIPE)
+ output_mupy = b''
+ while p.poll() is None:
+ output_mupy += p.stdout.read()
+ output_mupy += p.stdout.read()
+ if p.returncode != 0:
output_mupy = b'CRASH'
# clean up if we had an intermediate .mpy file
@@ -368,13 +372,19 @@ def run_tests(pyb, tests, args, base_path="."):
output_expected = f.read()
else:
# run CPython to work out expected output
- try:
- output_expected = subprocess.check_output([CPYTHON3, '-B', test_file])
- if args.write_exp:
- with open(test_file_expected, 'wb') as f:
- f.write(output_expected)
- except subprocess.CalledProcessError:
+ e = {"PYTHONPATH": os.getcwd(),
+ "PATH": os.environ["PATH"],
+ "LANG": "en_US.UTF-8"}
+ p = subprocess.Popen([CPYTHON3, '-B', test_file], env=e, stdout=subprocess.PIPE)
+ output_expected = b''
+ while p.poll() is None:
+ output_expected += p.stdout.read()
+ output_expected += p.stdout.read()
+ if p.returncode != 0:
output_expected = b'CPYTHON3 CRASH'
+ elif args.write_exp:
+ with open(test_file_expected, 'wb') as f:
+ f.write(output_expected)
# canonical form for all host platforms is to use \n for end-of-line
output_expected = output_expected.replace(b'\r\n', b'\n')
@@ -405,6 +415,10 @@ def run_tests(pyb, tests, args, base_path="."):
f.write(output_expected)
with open(filename_mupy, "wb") as f:
f.write(output_mupy)
+ print("### Expected")
+ print(output_expected)
+ print("### Actual")
+ print(output_mupy)
print("FAIL ", test_file)
failed_tests.append(test_name)