Skip to content

Commit 4a74d31

Browse files
committed
run-tests can handle segfault.
1 parent 14b929f commit 4a74d31

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/run-tests

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,29 @@ else:
1212
CPYTHON3 = 'python3.3'
1313
MP_PY = '../unix/micropython'
1414

15-
1615
test_count = 0
1716
testcase_count = 0
1817
passed_count = 0
1918
failed_tests = []
2019
tests = []
2120

2221
if not sys.argv[1:]:
23-
tests = glob('basics/*.py') + glob('io/*.py')
22+
tests = sorted(glob('basics/*.py') + glob('io/*.py'))
2423
else:
2524
tests = sys.argv[1:]
2625

2726
for test_file in tests:
2827
test_name = os.path.splitext(os.path.basename(test_file))[0]
2928

3029
output_expected = subprocess.check_output([CPYTHON3, '-B', test_file])
31-
output_mypy = subprocess.check_output([MP_PY, test_file])
30+
try:
31+
output_mupy = subprocess.check_output([MP_PY, test_file])
32+
except subprocess.CalledProcessError:
33+
output_mupy = 'CRASH'
3234

3335
testcase_count += len(output_expected.splitlines())
3436

35-
if output_expected != output_mypy:
37+
if output_expected == output_mupy:
3638
print("pass ", test_file)
3739
passed_count += 1
3840
else:
@@ -41,11 +43,9 @@ for test_file in tests:
4143

4244
test_count += 1
4345

44-
print("{} tests performed ({} individual testcases)".format(test_count,
45-
testcase_count))
46+
print("{} tests performed ({} individual testcases)".format(test_count, testcase_count))
4647
print("{} tests passed".format(passed_count))
4748

4849
if len(failed_tests) > 0:
49-
print("{} tests failed: {}".format(len(failed_tests),
50-
' '.join(failed_tests)))
50+
print("{} tests failed: {}".format(len(failed_tests), ' '.join(failed_tests)))
5151
sys.exit(1)

0 commit comments

Comments
 (0)