|
47 | 47 | EXPECTED_SKIP = set() |
48 | 48 | if support.MS_WINDOWS: |
49 | 49 | EXPECTED_SKIP |= { |
| 50 | + # UNIX only |
50 | 51 | 'test_asyncio.test_unix_events', |
| 52 | + # test_gdb doesn't work on Windows |
51 | 53 | 'test_gdb', |
| 54 | + # Can't test signal on Windows |
52 | 55 | 'test_threadsignals', |
53 | 56 | } |
54 | 57 | else: |
55 | 58 | EXPECTED_SKIP |= { |
| 59 | + # Tests specific to Windows |
56 | 60 | 'test_asyncio.test_windows_events', |
57 | 61 | 'test_asyncio.test_windows_utils', |
58 | 62 | 'test_msvcrt', |
|
89 | 93 | EXPECTED_SKIP.add('test_apple') |
90 | 94 |
|
91 | 95 | if not support.has_socket_support or IS_WASI: |
92 | | - # need socket support |
| 96 | + # Need socket support |
93 | 97 | EXPECTED_SKIP |= { |
94 | 98 | 'test_asyncgen', |
95 | 99 | 'test_asyncio', |
|
114 | 118 | } |
115 | 119 | EXPECTED_SKIP |= SELECT_TESTS |
116 | 120 | if not support.has_subprocess_support or IS_WASI: |
117 | | - # need subprocess support |
| 121 | + # Need subprocess support |
118 | 122 | EXPECTED_SKIP |= { |
119 | 123 | 'test_argparse', |
120 | 124 | 'test_c_stack_unwind', |
|
137 | 141 | } |
138 | 142 | if support.is_emscripten: |
139 | 143 | EXPECTED_SKIP |= { |
| 144 | + # Incompatible with Emscripten's mmap emulation |
140 | 145 | 'test_mmap', |
| 146 | + # Cannot create socketpair on Emscripten/WASI |
141 | 147 | 'test_selectors', |
142 | 148 | } |
143 | 149 | if support.is_android or support.is_apple_mobile or support.is_wasm32 or IS_WASI: |
144 | 150 | EXPECTED_SKIP |= { |
| 151 | + # pty is not available on these platforms |
145 | 152 | 'test_pty', |
| 153 | + # venv is not available on these platforms |
146 | 154 | 'test_venv', |
147 | 155 | } |
| 156 | +# On FreeBSD, is_remote_debug_enabled() is always false |
148 | 157 | if not sys.is_remote_debug_enabled(): |
149 | 158 | EXPECTED_SKIP.add('test_remote_pdb') |
150 | 159 | if not support.has_fork_support or IS_WASI: |
|
156 | 165 | } |
157 | 166 | if IS_WASI: |
158 | 167 | EXPECTED_SKIP |= { |
| 168 | + # configure disables multiple extension modules on WASI |
159 | 169 | 'test__interpchannels', # need _interpchannels |
160 | 170 | 'test__interpreters', # need _interpreters |
161 | | - 'test_bz2', # need _bz2 |
162 | 171 | 'test_crossinterp', # need _interpreters |
163 | | - 'test_ctypes', # need _ctypes |
164 | 172 | 'test_curses', # need _curses |
165 | | - 'test_dbm_sqlite3', # need _sqlite3 |
166 | 173 | 'test_external_inspection', # need _remote_debugging |
167 | 174 | 'test_fcntl', # need fcntl |
168 | 175 | 'test_gc_stats', # need _remote_debugging |
169 | 176 | 'test_grp', # need grp |
170 | | - 'test_gzip', # need zlib |
171 | 177 | 'test_ioctl', # need fcntl |
172 | | - 'test_lzma', # need _lzma |
173 | 178 | 'test_mmap', # need mmap |
174 | | - 'test_openpty', # need os.openpty() |
175 | 179 | 'test_pwd', # need pwd |
176 | 180 | 'test_pyrepl', # need termios |
177 | | - 'test_remote_pdb', # need remote debugging |
| 181 | + 'test_remote_pdb', # need _remote_debugging |
178 | 182 | 'test_resource', # need resource |
179 | | - 'test_sqlite3', # need _sqlite3 |
180 | | - 'test_stable_abi_ctypes', # need _ctypes |
181 | 183 | 'test_syslog', # need syslog |
182 | 184 | 'test_termios', # need termios |
183 | 185 | 'test_tty', # need termios |
184 | 186 | 'test_xxlimited', # need xxlimited |
| 187 | + |
| 188 | + # Missing functions on WASI |
| 189 | + 'test_openpty', # need os.openpty() |
| 190 | + |
| 191 | + # Missing dependencies on WASI |
| 192 | + 'test_bz2', # need _bz2 |
| 193 | + 'test_ctypes', # need _ctypes |
| 194 | + 'test_dbm_sqlite3', # need _sqlite3 |
| 195 | + 'test_gzip', # need zlib |
| 196 | + 'test_lzma', # need _lzma |
| 197 | + 'test_sqlite3', # need _sqlite3 |
| 198 | + 'test_stable_abi_ctypes', # need _ctypes |
185 | 199 | 'test_zlib', # need zlib |
186 | 200 | 'test_zstd', # need _zstd |
187 | 201 | } |
| 202 | + # configure disables _multiprocessing and _testmultiphase |
| 203 | + # extension modules on WASI |
| 204 | + EXPECTED_SKIP |= NEED_TESTMULTIPHASE |
188 | 205 | EXPECTED_SKIP |= NEED_MULTIPROCESSING |
| 206 | + # Missing OpenSSL dependency on WASI |
189 | 207 | EXPECTED_SKIP |= NEED_SSL |
190 | | - EXPECTED_SKIP |= NEED_TESTMULTIPHASE |
191 | 208 |
|
192 | 209 |
|
193 | 210 | # Modules needed by a test. |
194 | 211 | # Used to check if a test is expected to be skipped. |
195 | | -# NEED_MODULES doesn't work on WASI, since the regrtest summary is run on the |
196 | | -# build Python which is different than the host (WASI) Python. |
| 212 | +# NEED_MODULES doesn't work on WASI, since the main regrtest process is run |
| 213 | +# on the build Python which is different than the host (WASI) Python. |
197 | 214 | NEED_MODULES = { |
198 | 215 | 'test__interpchannels': '_interpchannels', |
199 | 216 | 'test__interpreters': '_interpreters', |
@@ -279,25 +296,34 @@ def expected_to_be_skipped(test_name): |
279 | 296 | # Custom ruleset |
280 | 297 | if (test_name in NEED_WORKING_THREADING |
281 | 298 | or package in NEED_WORKING_THREADING): |
| 299 | + # Detect whether Python can start new threads |
| 300 | + # - wasm32-wasi does not have threading. |
| 301 | + # - wasm32-emscripten can be compiled with or without pthread |
| 302 | + # support (-s USE_PTHREADS / __EMSCRIPTEN_PTHREADS__). |
282 | 303 | if IS_WASI: |
283 | 304 | return True |
284 | 305 | from test.support import threading_helper |
285 | 306 | return not threading_helper.can_start_thread |
286 | 307 |
|
287 | 308 | if test_name in SELECT_TESTS: |
| 309 | + # For example, test_epoll needs select.epoll() |
288 | 310 | import select |
289 | 311 | name = test_name.removeprefix('test_') |
290 | 312 | return not hasattr(select, name) |
291 | 313 |
|
292 | 314 | if test_name == 'test_dtrace': |
| 315 | + # Need ./configure --with-dtrace |
293 | 316 | import sysconfig |
294 | 317 | return not sysconfig.get_config_var('WITH_DTRACE') |
295 | 318 |
|
296 | 319 | if test_name in ('test_perf_profiler', 'test_perfmaps', 'test_samply_profiler'): |
297 | | - # need perf trampoline profiling |
| 320 | + # Need perf trampoline profiling: configure defines the |
| 321 | + # PY_HAVE_PERF_TRAMPOLINE macro on Linux (x86-64 and AArch64) |
| 322 | + # and on macOS. |
298 | 323 | return not support.supports_perf_trampoline_profiling() |
299 | 324 |
|
300 | 325 | if package == 'test_gdb': |
| 326 | + # Need gdb program |
301 | 327 | import shutil |
302 | 328 | return not shutil.which('gdb') |
303 | 329 |
|
|
0 commit comments