Skip to content

Commit fd232c3

Browse files
committed
run-tests: Dump output of failing tests to files again.
This was a long-standing regression from converting script from sh to python.
1 parent e254809 commit fd232c3

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

tests/run-tests

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ else:
1212
CPYTHON3 = 'python3.3'
1313
MP_PY = '../unix/micropython'
1414

15+
def rm_f(fname):
16+
if os.path.exists(fname):
17+
os.remove(fname)
18+
1519
test_count = 0
1620
testcase_count = 0
1721
passed_count = 0
@@ -30,14 +34,20 @@ for test_file in tests:
3034
try:
3135
output_mupy = subprocess.check_output([MP_PY, test_file])
3236
except subprocess.CalledProcessError:
33-
output_mupy = 'CRASH'
37+
output_mupy = b'CRASH'
3438

3539
testcase_count += len(output_expected.splitlines())
3640

3741
if output_expected == output_mupy:
3842
print("pass ", test_file)
3943
passed_count += 1
44+
rm_f(os.path.basename(test_file + ".exp"))
45+
rm_f(os.path.basename(test_file + ".out"))
4046
else:
47+
with open(os.path.basename(test_file + ".exp"), "w") as f:
48+
f.write(str(output_expected, "ascii"))
49+
with open(os.path.basename(test_file + ".out"), "w") as f:
50+
f.write(str(output_mupy, "ascii"))
4151
print("FAIL ", test_file)
4252
failed_tests.append(test_name)
4353

0 commit comments

Comments
 (0)