Skip to content

Commit 1ddd294

Browse files
authored
[test] Make more use of also_with_modularize. NFC (#23582)
1 parent ec40bc5 commit 1ddd294

File tree

3 files changed

+27
-43
lines changed

3 files changed

+27
-43
lines changed

test/common.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,20 @@ def metafunc(self, asan, *args, **kwargs):
646646
return metafunc
647647

648648

649+
def also_with_modularize(f):
650+
assert callable(f)
651+
652+
@wraps(f)
653+
def metafunc(self, modularize, *args, **kwargs):
654+
if modularize:
655+
self.emcc_args += ['--extern-post-js', test_file('modularize_post_js.js'), '-sMODULARIZE']
656+
f(self, *args, **kwargs)
657+
658+
parameterize(metafunc, {'': (False,),
659+
'modularize': (True,)})
660+
return metafunc
661+
662+
649663
# Tests exception handling and setjmp/longjmp handling. This tests three
650664
# combinations:
651665
# - Emscripten EH + Emscripten SjLj

test/test_core.py

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from common import skip_if, no_windows, no_mac, is_slow_test, parameterized, parameterize
2727
from common import env_modify, with_env_modify, disabled, flaky, node_pthreads, also_with_wasm_bigint
2828
from common import read_file, read_binary, requires_v8, requires_node, requires_wasm2js, requires_node_canary
29-
from common import compiler_for, crossplatform, no_4gb, no_2gb, also_with_minimal_runtime
29+
from common import compiler_for, crossplatform, no_4gb, no_2gb, also_with_minimal_runtime, also_with_modularize
3030
from common import with_all_fs, also_with_nodefs, also_with_nodefs_both, also_with_noderawfs, also_with_wasmfs
3131
from common import with_all_eh_sjlj, with_all_sjlj, also_with_standalone_wasm, can_do_standalone, no_wasm64, requires_wasm_eh
3232
from common import NON_ZERO, WEBIDL_BINDER, EMBUILDER, PYTHON
@@ -2424,24 +2424,17 @@ def test_pthread_equal(self):
24242424
self.do_run_in_out_file_test('pthread/test_pthread_equal.cpp')
24252425

24262426
@node_pthreads
2427-
@parameterized({
2428-
'': (False,),
2429-
'modularize': (True,),
2430-
})
2431-
def test_pthread_proxying(self, modularize):
2432-
if modularize and self.get_setting('WASM') == 0:
2433-
self.skipTest('MODULARIZE + WASM=0 + pthreads does not work (#16794)')
2427+
@also_with_modularize
2428+
def test_pthread_proxying(self):
2429+
if '-sMODULARIZE' in self.emcc_args:
2430+
if self.get_setting('WASM') == 0:
2431+
self.skipTest('MODULARIZE + WASM=0 + pthreads does not work (#16794)')
2432+
self.set_setting('EXPORT_NAME=ModuleFactory')
24342433
self.maybe_closure()
24352434
self.set_setting('PROXY_TO_PTHREAD')
24362435
if not self.has_changed_setting('INITIAL_MEMORY'):
24372436
self.set_setting('INITIAL_MEMORY=32mb')
2438-
args = []
2439-
if modularize:
2440-
self.set_setting('MODULARIZE')
2441-
self.set_setting('EXPORT_NAME=ModuleFactory')
2442-
args = ['--extern-post-js', test_file('modularize_post_js.js')]
2443-
self.do_run_in_out_file_test('pthread/test_pthread_proxying.c',
2444-
interleaved_output=False, emcc_args=args)
2437+
self.do_run_in_out_file_test('pthread/test_pthread_proxying.c', interleaved_output=False)
24452438

24462439
@node_pthreads
24472440
def test_pthread_proxying_cpp(self):
@@ -9118,23 +9111,13 @@ def test_pthread_unhandledrejection(self):
91189111

91199112
@node_pthreads
91209113
@no_wasm2js('wasm2js does not support PROXY_TO_PTHREAD (custom section support)')
9114+
@also_with_modularize
91219115
def test_pthread_offset_converter(self):
91229116
self.set_setting('PROXY_TO_PTHREAD')
91239117
self.set_setting('EXIT_RUNTIME')
91249118
self.set_setting('USE_OFFSET_CONVERTER')
9125-
if '-g' in self.emcc_args:
9126-
self.emcc_args += ['-DDEBUG']
9127-
self.do_runf('core/test_return_address.c', 'passed')
9128-
9129-
@node_pthreads
9130-
@no_wasm2js('wasm2js does not support PROXY_TO_PTHREAD (custom section support)')
9131-
def test_pthread_offset_converter_modularize(self):
9132-
self.set_setting('PROXY_TO_PTHREAD')
9133-
self.set_setting('EXIT_RUNTIME')
9134-
self.set_setting('USE_OFFSET_CONVERTER')
9135-
self.set_setting('MODULARIZE')
9136-
self.set_setting('EXPORT_NAME', 'foo')
9137-
self.emcc_args += ['--extern-post-js', test_file('modularize_post_js.js')]
9119+
if '-sMODULARIZE' in self.emcc_args:
9120+
self.set_setting('EXPORT_NAME', 'foo')
91389121
if '-g' in self.emcc_args:
91399122
self.emcc_args += ['-DDEBUG']
91409123
self.do_runf('core/test_return_address.c', 'passed')

test/test_other.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
from common import create_file, parameterized, NON_ZERO, node_pthreads, TEST_ROOT, test_file
3737
from common import compiler_for, EMBUILDER, requires_v8, requires_node, requires_wasm64, requires_node_canary
3838
from common import requires_wasm_eh, crossplatform, with_all_eh_sjlj, with_all_sjlj
39-
from common import also_with_standalone_wasm, also_with_wasm2js, also_with_noderawfs, also_with_wasmfs, with_all_fs
39+
from common import also_with_standalone_wasm, also_with_wasm2js, also_with_noderawfs
40+
from common import also_with_modularize, also_with_wasmfs, with_all_fs
4041
from common import also_with_minimal_runtime, also_with_wasm_bigint, also_with_wasm64, also_with_asan, flaky
4142
from common import EMTEST_BUILD_VERBOSE, PYTHON, WEBIDL_BINDER
4243
from common import requires_network, parameterize
@@ -124,20 +125,6 @@ def metafunc(self, backend, *args, **kwargs):
124125
return metafunc
125126

126127

127-
def also_with_modularize(f):
128-
assert callable(f)
129-
130-
@wraps(f)
131-
def metafunc(self, modularize, *args, **kwargs):
132-
if modularize:
133-
self.emcc_args += ['--extern-post-js', test_file('modularize_post_js.js'), '-sMODULARIZE']
134-
f(self, *args, **kwargs)
135-
136-
parameterize(metafunc, {'': (False,),
137-
'modularize': (True,)})
138-
return metafunc
139-
140-
141128
def also_with_wasmfs_all_backends(f):
142129
assert callable(f)
143130

0 commit comments

Comments
 (0)