3434from common import env_modify, no_mac, no_windows, only_windows, requires_native_clang, with_env_modify
3535from common import create_file, parameterized, NON_ZERO, node_pthreads, TEST_ROOT, test_file
3636from common import compiler_for, EMBUILDER, requires_v8, requires_node, requires_wasm64, requires_node_canary
37- from common import requires_wasm_eh , crossplatform, with_all_eh_sjlj, with_all_sjlj
37+ from common import requires_wasm_exnref , crossplatform, with_all_eh_sjlj, with_all_sjlj
3838from common import also_with_standalone_wasm, also_with_env_modify, also_with_wasm2js
3939from common import also_with_minimal_runtime, also_with_wasm_bigint, also_with_wasm64, flaky
4040from common import EMTEST_BUILD_VERBOSE, PYTHON, WEBIDL_BINDER
@@ -3295,13 +3295,19 @@ def test_embind_tsgen_memory64(self):
32953295 self.get_emcc_args())
32963296 self.assertFileContents(test_file('other/embind_tsgen_memory64.d.ts'), read_file('embind_tsgen_memory64.d.ts'))
32973297
3298- def test_embind_tsgen_exceptions(self):
3298+ @parameterized({
3299+ '': [0],
3300+ 'wasm_exnref': [1]
3301+ })
3302+ def test_embind_tsgen_exceptions(self, wasm_exnref):
3303+ self.set_setting('WASM_EXNREF', wasm_exnref)
32993304 # Check that when Wasm exceptions and assertions are enabled bindings still generate.
33003305 self.run_process([EMXX, test_file('other/embind_tsgen.cpp'),
33013306 '-lembind', '-fwasm-exceptions', '-sASSERTIONS',
33023307 # Use the deprecated `--embind-emit-tsd` to ensure it
33033308 # still works until removed.
3304- '--embind-emit-tsd', 'embind_tsgen.d.ts', '-Wno-deprecated'])
3309+ '--embind-emit-tsd', 'embind_tsgen.d.ts', '-Wno-deprecated'] +
3310+ self.get_emcc_args())
33053311 self.assertFileContents(test_file('other/embind_tsgen.d.ts'), read_file('embind_tsgen.d.ts'))
33063312
33073313 def test_embind_jsgen_method_pointer_stability(self):
@@ -8529,6 +8535,7 @@ def test_metadce_minimal_pthreads(self):
85298535 '-sDEMANGLE_SUPPORT', '-Wno-deprecated'], [], ['waka']), # noqa
85308536 # Wasm EH's code size increase is smaller than that of Emscripten EH
85318537 'except_wasm': (['-O2', '-fwasm-exceptions'], [], ['waka']), # noqa
8538+ 'except_wasm_exnref': (['-O2', '-fwasm-exceptions', '-sWASM_EXNREF'], [], ['waka']), # noqa
85328539 # eval_ctors 1 can partially optimize, but runs into getenv() for locale
85338540 # code. mode 2 ignores those and fully optimizes out the ctors
85348541 'ctors1': (['-O2', '-sEVAL_CTORS'], [], ['waka']), # noqa
@@ -8828,7 +8835,8 @@ def test_lto(self, args):
88288835 @parameterized({
88298836 'noexcept': [],
88308837 'except': ['-sDISABLE_EXCEPTION_CATCHING=0'],
8831- 'except_wasm': ['-fwasm-exceptions']
8838+ 'except_wasm': ['-fwasm-exceptions'],
8839+ 'except_wasm_exnref': ['-fwasm-exceptions', '-sWASM_EXNREF']
88328840 })
88338841 def test_lto_libcxx(self, *args):
88348842 self.run_process([EMXX, test_file('hello_libcxx.cpp'), '-flto'] + list(args))
@@ -8847,11 +8855,14 @@ def test_lto_flags(self):
88478855
88488856 # We have LTO tests covered in 'wasmltoN' targets in test_core.py, but they
88498857 # don't run as a part of Emscripten CI, so we add a separate LTO test here.
8850- @requires_wasm_eh
8858+ @requires_wasm_exnref
88518859 def test_lto_wasm_exceptions(self):
88528860 self.set_setting('EXCEPTION_DEBUG')
88538861 self.emcc_args += ['-fwasm-exceptions', '-flto']
88548862 self.do_run_in_out_file_test('core/test_exceptions.cpp', out_suffix='_caught')
8863+ # New Wasm EH with exnref
8864+ self.set_setting('WASM_EXNREF')
8865+ self.do_run_in_out_file_test('core/test_exceptions.cpp', out_suffix='_caught')
88558866
88568867 @parameterized({
88578868 '': ([],),
@@ -12267,13 +12278,16 @@ def test_standalone_export_main(self):
1226712278 # We should consider making this a warning since the `_main` export is redundant.
1226812279 self.run_process([EMCC, '-sEXPORTED_FUNCTIONS=_main', '-sSTANDALONE_WASM', test_file('core/test_hello_world.c')])
1226912280
12270- @requires_wasm_eh
12281+ @requires_wasm_exnref
1227112282 def test_standalone_wasm_exceptions(self):
1227212283 self.set_setting('STANDALONE_WASM')
1227312284 self.set_setting('WASM_BIGINT')
1227412285 self.wasm_engines = []
1227512286 self.emcc_args += ['-fwasm-exceptions']
1227612287 self.do_run_in_out_file_test('core/test_exceptions.cpp', out_suffix='_caught')
12288+ # New Wasm EH with exnref
12289+ self.set_setting('WASM_EXNREF')
12290+ self.do_run_in_out_file_test('core/test_exceptions.cpp', out_suffix='_caught')
1227712291
1227812292 def test_missing_malloc_export(self):
1227912293 # we used to include malloc by default. show a clear error in builds with
0 commit comments