-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_all.py
executable file
·216 lines (169 loc) · 6.19 KB
/
run_all.py
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#!/usr/bin/env python3.7
""" Runner for CPython 3.7 test suite comparing against Nuitka.
Not every test of CPython has to pass, but instead it should fail just
the same with Nuitka.
"""
import os
import sys
# Find nuitka package relative to us.
sys.path.insert(
0,
os.path.normpath(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..")
),
)
# isort:start
from nuitka.tools.testing.Common import (
addToPythonPath,
compareWithCPython,
createSearchMode,
my_print,
reportSkip,
setup,
setupCacheHashSalt,
)
def checkPath(dirname, filename):
# Complex stuff, pylint: disable=too-many-branches,too-many-return-statements,too-many-statements
extra_flags = [
"remove_output",
# Import test_support which won't be included and potentially others.
"binary_python_path",
# We mean to compile only that one module
"recurse_none",
# Keep us informed about timing, even if concurrent runs spoil the
# accuracy.
"timing",
# Use the original __file__ value, at least one case warns about things
# with filename included.
"original_file",
# Cache the CPython results for reuse, they will normally not change.
"cpython_cache",
]
# TODO: This deadlocks, likely a threading problem.
if python_version >= (3, 4) and filename == "test_concurrent_futures.py":
reportSkip("Skipping (due to threading issue)", dirname, filename)
return
# TODO: This fails to compile, super is not fully solved.
if python_version >= (3, 4) and filename == "test_super.py":
my_print("Skipping (due to compilation issue)", filename)
return
if dirname == "doctest_generated":
if python_version >= (3, 7):
extra_flags.append("expect_success")
if filename == "test_generators.py":
extra_flags.append("ignore_stderr")
# On Windows with 32 bit, the MemoryError breaks the test
if os.name == "nt":
reportSkip(
"not enough memory with 32 bits on Windows", dirname, filename
)
return
if filename in ("test_platform.py", "test_dataclasses.py", "test_asyncgen.py"):
extra_flags.append("ignore_stderr")
# TODO: Delayed, get it to work.
if filename == "test_exceptions.py":
reportSkip("KNOWN BUGGY", dirname, filename)
return
if filename == "test_gc.py" and python_version == (3, 7, 0):
reportSkip("Bug in CPython 3.7.0 affects gc.", dirname, filename)
return
if filename == "test_os.py" and os.name == "nt":
reportSkip("Bug in CPython 3.7.x causes spurious segfaults to CPython.", dirname, filename)
return
if filename == "test_datetime.py":
extra_flags.append("recurse_to:test.datetimetester")
if python_version == (3, 7, 0):
reportSkip("Bug in CPython 3.7.0 affects test.", dirname, filename)
return
if python_version < (3, 7):
if filename in ("test_abc.py", "test_os.py"):
reportSkip("Not useful with older Python", dirname, filename)
return
if filename in (
"test_compile.py",
"test_codeccallbacks.py",
"test_datetime.py",
"test_random.py",
):
reportSkip("Crashes with older Python", dirname, filename)
return
if filename == "test_difflib.py":
reportSkip("Hangs with older Python", dirname, filename)
return
if filename == "test_imp.py":
reportSkip("Not bug compatible with older Python", dirname, filename)
return
if filename == "test_xmlrpc.py":
reportSkip("Hangs occasionally with older Python", dirname, filename)
return
if filename == "test_types.py":
reportSkip(
"Fails due to very minor incompatibility with older Python",
dirname,
filename,
)
return
if filename == "test_xml_etree_c.py":
reportSkip(
"Fails due exception differences in SystemError cases",
dirname,
filename,
)
return
if filename == "test_asyncgen.py":
# SyntaxError.
extra_flags.append("expect_failure")
if python_version >= (3, 8):
if filename == "test_ast.py":
reportSkip(
"Fails due ast module changes of newer Python.", dirname, filename
)
return
if filename == "test_capi.py":
reportSkip(
"Fails due test_capi module changes of newer Python.", dirname, filename
)
return
if filename == "test_ipaddress.py":
reportSkip(
"Fails due constructor error being different with Nuitka.",
dirname,
filename,
)
return
if filename in (
"test_dict_version.py",
"test_tracemalloc.py",
"test_xml_etree.py",
):
reportSkip(
"Fails due to random output for errors with newer Python.",
dirname,
filename,
)
return
if filename in ("test_asyncgen.py", "test_xmlrpc.py"):
reportSkip("Hangs with newer Python.", dirname, filename)
return
compareWithCPython(
dirname=dirname,
filename=filename,
extra_flags=extra_flags,
search_mode=search_mode,
)
def checkDir(dirname):
for filename in sorted(os.listdir(dirname)):
if not filename.endswith(".py") or not filename.startswith("test_"):
continue
if filename == "test_support.py":
continue
active = search_mode.consider(dirname, filename)
if active:
checkPath(dirname, filename)
python_version = setup(suite="CPython37", needs_io_encoding=True)
setupCacheHashSalt(".")
search_mode = createSearchMode()
addToPythonPath(os.path.abspath("."), in_front=True)
checkDir("test")
checkDir("doctest_generated")
search_mode.finish()