|
40 | 40 | EM_SIGABRT = 6
|
41 | 41 |
|
42 | 42 |
|
| 43 | +def esm_integration(func): |
| 44 | + assert callable(func) |
| 45 | + |
| 46 | + @wraps(func) |
| 47 | + def decorated(self, *args, **kwargs): |
| 48 | + self.require_node_canary() |
| 49 | + self.node_args += ['--experimental-wasm-modules', '--no-warnings'] |
| 50 | + if self.is_wasm64(): |
| 51 | + self.skipTest('wasm64 requires wasm export wrappers') |
| 52 | + func(self, *args, **kwargs) |
| 53 | + |
| 54 | + return decorated |
| 55 | + |
| 56 | + |
43 | 57 | def wasm_simd(f):
|
44 | 58 | assert callable(f)
|
45 | 59 |
|
@@ -9562,18 +9576,14 @@ def test_wasm_worker_malloc(self):
|
9562 | 9576 | def test_wasm_worker_wait_async(self):
|
9563 | 9577 | self.do_runf('atomic/test_wait_async.c', emcc_args=['-sWASM_WORKERS'])
|
9564 | 9578 |
|
9565 |
| - @requires_node_canary |
9566 |
| - @no_wasm64("wasm64 requires wasm export wrappers") |
| 9579 | + @esm_integration |
9567 | 9580 | def test_esm_integration_main(self):
|
9568 |
| - self.node_args += ['--experimental-wasm-modules', '--no-warnings'] |
9569 | 9581 | self.do_runf('hello_world.c', 'hello, world!', emcc_args=['-sWASM_ESM_INTEGRATION', '-Wno-experimental'], output_suffix='.mjs')
|
9570 | 9582 |
|
9571 |
| - @requires_node_canary |
9572 |
| - @no_wasm64("wasm64 requires wasm export wrappers") |
| 9583 | + @esm_integration |
9573 | 9584 | def test_esm_integration(self):
|
9574 | 9585 | # TODO(sbc): WASM_ESM_INTEGRATION doesn't currently work with closure.
|
9575 | 9586 | # self.maybe_closure()
|
9576 |
| - self.node_args += ['--experimental-wasm-modules', '--no-warnings'] |
9577 | 9587 | self.run_process([EMCC, '-o', 'hello_world.mjs', '-sEXPORTED_RUNTIME_METHODS=err', '-sEXPORTED_FUNCTIONS=_main,stringToNewUTF8', '-sWASM_ESM_INTEGRATION', '-Wno-experimental', test_file('core/test_esm_integration.c')] + self.get_emcc_args())
|
9578 | 9588 | create_file('runner.mjs', '''
|
9579 | 9589 | import init, { err, stringToNewUTF8, _main, _foo } from "./hello_world.mjs";
|
|
0 commit comments