@@ -12,27 +12,29 @@ else:
12
12
CPYTHON3 = 'python3.3'
13
13
MP_PY = '../unix/micropython'
14
14
15
-
16
15
test_count = 0
17
16
testcase_count = 0
18
17
passed_count = 0
19
18
failed_tests = []
20
19
tests = []
21
20
22
21
if not sys .argv [1 :]:
23
- tests = glob ('basics/*.py' ) + glob ('io/*.py' )
22
+ tests = sorted ( glob ('basics/*.py' ) + glob ('io/*.py' ) )
24
23
else :
25
24
tests = sys .argv [1 :]
26
25
27
26
for test_file in tests :
28
27
test_name = os .path .splitext (os .path .basename (test_file ))[0 ]
29
28
30
29
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'
32
34
33
35
testcase_count += len (output_expected .splitlines ())
34
36
35
- if output_expected != output_mypy :
37
+ if output_expected == output_mupy :
36
38
print ("pass " , test_file )
37
39
passed_count += 1
38
40
else :
@@ -41,11 +43,9 @@ for test_file in tests:
41
43
42
44
test_count += 1
43
45
44
- print ("{} tests performed ({} individual testcases)" .format (test_count ,
45
- testcase_count ))
46
+ print ("{} tests performed ({} individual testcases)" .format (test_count , testcase_count ))
46
47
print ("{} tests passed" .format (passed_count ))
47
48
48
49
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 )))
51
51
sys .exit (1 )
0 commit comments