| 434 | |
| 435 | |
| 436 | class RunnerCore(RetryableTestCase, metaclass=RunnerMeta): |
| 437 | # default temporary directory settings. set_temp_dir may be called later to |
| 438 | # override these |
| 439 | temp_dir = shared.TEMP_DIR |
| 440 | canonical_temp_dir = get_canonical_temp_dir(shared.TEMP_DIR) |
| 441 | |
| 442 | # This avoids cluttering the test runner output, which is stderr too, with compiler warnings etc. |
| 443 | # Change this to None to get stderr reporting, for debugging purposes |
| 444 | stderr_redirect = STDOUT |
| 445 | |
| 446 | library_cache: dict[str, tuple[str, object]] = {} |
| 447 | |
| 448 | def is_wasm(self): |
| 449 | return self.get_setting('WASM') != 0 |
| 450 | |
| 451 | def is_wasm2js(self): |
| 452 | return not self.is_wasm() |
| 453 | |
| 454 | def is_browser_test(self): |
| 455 | return False |
| 456 | |
| 457 | def is_wasm64(self): |
| 458 | return '-m64' in self.cflags |
| 459 | |
| 460 | def is_4gb(self): |
| 461 | return self.get_setting('INITIAL_MEMORY') == '4200mb' |
| 462 | |
| 463 | def is_2gb(self): |
| 464 | return self.get_setting('INITIAL_MEMORY') == '2200mb' |
| 465 | |
| 466 | def check_dylink(self): |
| 467 | if self.get_setting('WASM_ESM_INTEGRATION'): |
| 468 | self.skipTest('dynamic linking not supported with WASM_ESM_INTEGRATION') |
| 469 | if '-lllvmlibc' in self.cflags: |
| 470 | self.skipTest('dynamic linking not supported with llvm-libc') |
| 471 | if self.is_wasm2js(): |
| 472 | self.skipTest('dynamic linking not supported with wasm2js') |
| 473 | # MEMORY64=2 mode doesn't currently support dynamic linking because |
| 474 | # The side modules are lowered to wasm32 when they are built, making |
| 475 | # them unlinkable with wasm64 binaries. |
| 476 | if self.get_setting('MEMORY64') == 2: |
| 477 | self.skipTest('dynamic linking not supported with MEMORY64=2') |
| 478 | |
| 479 | def require_pthreads(self): |
| 480 | self.cflags += ['-Wno-pthreads-mem-growth', '-pthread'] |
| 481 | if not self.is_browser_test(): |
| 482 | if self.get_setting('MINIMAL_RUNTIME'): |
| 483 | self.skipTest('non-browser pthreads not yet supported with MINIMAL_RUNTIME') |
| 484 | for engine in self.js_engines: |
| 485 | if engine_is_node(engine) or engine_is_bun(engine) or engine_is_deno(engine): |
| 486 | self.require_engine(engine) |
| 487 | return |
| 488 | self.fail('no JS engine found capable of running pthreads') |
| 489 | |
| 490 | def require_v8(self): |
| 491 | if 'EMTEST_SKIP_V8' in os.environ: |
| 492 | self.skipTest('test requires v8 and EMTEST_SKIP_V8 is set') |
| 493 | v8 = get_v8() |
nothing calls this directly
no test coverage detected