Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
96 lines (81 loc) · 2.63 KB

File metadata and controls

96 lines (81 loc) · 2.63 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#
# This is minimal MicroPython variant of run-tests script, which uses
# .exp files as generated by run-tests --write-exp. It is useful to run
# testsuite on systems which have neither CPython3 nor unix shell.
# This script is intended to be run by the same interpreter executable
# which is to be tested, so should use minimal language functionality.
#
import sys
import uos as os
tests = [
"basics", "micropython", "float", "import", "io",
" misc", "unicode", "extmod", "unix"
]
if sys.platform == 'win32':
MICROPYTHON = "micropython.exe"
else:
MICROPYTHON = "micropython"
def should_skip(test):
if test.startswith("native"):
return True
if test.startswith("viper"):
return True
test_count = 0
passed_count = 0
skip_count = 0
for suite in tests:
#print("Running in: %s" % suite)
if sys.platform == 'win32':
# dir /b prints only contained filenames, one on a line
# http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/dir.mspx
r = os.system("dir /b %s/*.py >tests.lst" % suite)
else:
r = os.system("ls %s/*.py | xargs -n1 basename >tests.lst" % suite)
assert r == 0
with open("tests.lst") as f:
testcases = f.readlines()
testcases = [l[:-1] for l in testcases]
assert testcases, "No tests found in dir '%s', which is implausible" % suite
#print(testcases)
for t in testcases:
if t == "native_check.py":
continue
qtest = "%s/%s" % (suite, t)
if should_skip(t):
print("skip " + qtest)
skip_count += 1
continue
exp = None
try:
f = open(qtest + ".exp")
exp = f.read()
f.close()
except OSError:
pass
if exp is not None:
#print("run " + qtest)
r = os.system(MICROPYTHON + " %s >.tst.out" % qtest)
if r == 0:
f = open(".tst.out")
out = f.read()
f.close()
else:
out = "CRASH"
if out == "SKIP\n":
print("skip " + qtest)
skip_count += 1
else:
if out == exp:
print("pass " + qtest)
passed_count += 1
else:
print("FAIL " + qtest)
test_count += 1
else:
skip_count += 1
print("%s tests performed" % test_count)
print("%s tests passed" % passed_count)
if test_count != passed_count:
print("%s tests failed" % (test_count - passed_count))
if skip_count:
print("%s tests skipped" % skip_count)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.