Skip to content

Commit bb16735

Browse files
authored
[EH] Rename Wasm EH tests (#23427)
This renames Wasm EH test modes: - `wasm` -> `wasm_legacy` - `wasm_exnref` -> `wasm` So `_wasm` suffix means the standardized Wasm EH, and `_wasm_legacy` means the legacy EH. This also removes some comments mentioning things like "new Wasm EH with exnref", given that this should be (eventually) the default mode and not the new thing.
1 parent 186cae3 commit bb16735

13 files changed

+39
-46
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ jobs:
859859
core2.test_i64_invoke_bigint
860860
core2.test_sse2
861861
core2.test_source_map
862-
core2.test_exceptions_wasm
862+
core2.test_exceptions_wasm_legacy
863863
core2.test_pthread_unhandledrejection"
864864
- upload-test-results
865865
test-other:

test/common.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -625,19 +625,19 @@ def metafunc(self, standalone):
625625
return decorated
626626

627627

628-
# Tests exception handling / setjmp/longjmp handling in Emscripten EH/SjLj mode
629-
# and new wasm EH/SjLj modes. This tests three combinations:
628+
# Tests exception handling and setjmp/longjmp handling. This tests three
629+
# combinations:
630630
# - Emscripten EH + Emscripten SjLj
631-
# - Wasm EH + Wasm SjLj (Phase 3, to be deprecated)
632-
# - Wasm EH + Wasm SjLj (New proposal witn exnref, experimental)
631+
# - Wasm EH + Wasm SjLj
632+
# - Wasm EH + Wasm SjLj (Legacy)
633633
def with_all_eh_sjlj(f):
634634
assert callable(f)
635635

636636
@wraps(f)
637637
def metafunc(self, mode, *args, **kwargs):
638638
if DEBUG:
639639
print('parameterize:eh_mode=%s' % mode)
640-
if mode in {'wasm', 'wasm_exnref'}:
640+
if mode in {'wasm', 'wasm_legacy'}:
641641
# Wasm EH is currently supported only in wasm backend and V8
642642
if self.is_wasm2js():
643643
self.skipTest('wasm2js does not support wasm EH/SjLj')
@@ -647,9 +647,9 @@ def metafunc(self, mode, *args, **kwargs):
647647
self.emcc_args.append('-fwasm-exceptions')
648648
self.set_setting('SUPPORT_LONGJMP', 'wasm')
649649
if mode == 'wasm':
650-
self.require_wasm_legacy_eh()
651-
if mode == 'wasm_exnref':
652650
self.require_wasm_eh()
651+
if mode == 'wasm_legacy':
652+
self.require_wasm_legacy_eh()
653653
f(self, *args, **kwargs)
654654
else:
655655
self.set_setting('DISABLE_EXCEPTION_CATCHING', 0)
@@ -663,7 +663,7 @@ def metafunc(self, mode, *args, **kwargs):
663663

664664
parameterize(metafunc, {'emscripten': ('emscripten',),
665665
'wasm': ('wasm',),
666-
'wasm_exnref': ('wasm_exnref',)})
666+
'wasm_legacy': ('wasm_legacy',)})
667667
return metafunc
668668

669669

@@ -674,25 +674,25 @@ def with_all_sjlj(f):
674674

675675
@wraps(f)
676676
def metafunc(self, mode, *args, **kwargs):
677-
if mode in {'wasm', 'wasm_exnref'}:
677+
if mode in {'wasm', 'wasm_legacy'}:
678678
if self.is_wasm2js():
679679
self.skipTest('wasm2js does not support wasm SjLj')
680680
# FIXME Temporarily disabled. Enable this later when the bug is fixed.
681681
if '-fsanitize=address' in self.emcc_args:
682682
self.skipTest('Wasm EH does not work with asan yet')
683683
self.set_setting('SUPPORT_LONGJMP', 'wasm')
684684
if mode == 'wasm':
685-
self.require_wasm_legacy_eh()
686-
if mode == 'wasm_exnref':
687685
self.require_wasm_eh()
686+
if mode == 'wasm_legacy':
687+
self.require_wasm_legacy_eh()
688688
f(self, *args, **kwargs)
689689
else:
690690
self.set_setting('SUPPORT_LONGJMP', 'emscripten')
691691
f(self, *args, **kwargs)
692692

693693
parameterize(metafunc, {'emscripten': ('emscripten',),
694694
'wasm': ('wasm',),
695-
'wasm_exnref': ('wasm_exnref',)})
695+
'wasm_legacy': ('wasm_legacy',)})
696696
return metafunc
697697

698698

Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
142162
1+
144708

test/other/codesize/test_codesize_cxx_except_wasm_exnref.size

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
142162

test/test_core.py

+9-14
Original file line numberDiff line numberDiff line change
@@ -872,12 +872,10 @@ def test_longjmp_with_and_without_exceptions(self):
872872
# FIXME Temporarily disabled. Enable this later when the bug is fixed.
873873
if '-fsanitize=address' in self.emcc_args:
874874
self.skipTest('Wasm EH does not work with asan yet')
875-
self.emcc_args.append('-fwasm-exceptions')
876-
for arg in ('-fwasm-exceptions', '-fno-exceptions'):
877-
self.do_core_test('test_longjmp.c', emcc_args=[arg])
878-
# Wasm SjLj with and with the standardized EH (exnref) support
879-
self.set_setting('WASM_LEGACY_EXCEPTIONS', 0)
880-
self.do_core_test('test_longjmp.c', emcc_args=['-fwasm-exceptions'])
875+
for legacy in [0, 1]:
876+
self.set_setting('WASM_LEGACY_EXCEPTIONS', legacy)
877+
for arg in ('-fwasm-exceptions', '-fno-exceptions'):
878+
self.do_core_test('test_longjmp.c', emcc_args=[arg])
881879

882880
@with_all_sjlj
883881
def test_longjmp2(self):
@@ -1011,14 +1009,11 @@ def test_exceptions_with_and_without_longjmp(self):
10111009
if '-fsanitize=address' in self.emcc_args:
10121010
self.skipTest('Wasm EH does not work with asan yet')
10131011
self.emcc_args.append('-fwasm-exceptions')
1014-
for support_longjmp in (0, 'wasm'):
1015-
self.set_setting('SUPPORT_LONGJMP', support_longjmp)
1016-
self.do_run_in_out_file_test('core/test_exceptions.cpp', out_suffix='_caught')
1017-
# Wasm standardized EH (exnref) with and without Wasm SjLj support
1018-
self.set_setting('WASM_LEGACY_EXCEPTIONS', 0)
1019-
for support_longjmp in (0, 'wasm'):
1020-
self.set_setting('SUPPORT_LONGJMP', support_longjmp)
1021-
self.do_run_in_out_file_test('core/test_exceptions.cpp', out_suffix='_caught')
1012+
for legacy in [0, 1]:
1013+
self.set_setting('WASM_LEGACY_EXCEPTIONS', legacy)
1014+
for support_longjmp in (0, 'wasm'):
1015+
self.set_setting('SUPPORT_LONGJMP', support_longjmp)
1016+
self.do_run_in_out_file_test('core/test_exceptions.cpp', out_suffix='_caught')
10221017

10231018
def test_exceptions_off(self):
10241019
self.set_setting('DISABLE_EXCEPTION_CATCHING')

test/test_other.py

+14-16
Original file line numberDiff line numberDiff line change
@@ -3536,10 +3536,10 @@ def test_embind_tsgen_jspi(self):
35363536

35373537
@parameterized({
35383538
'': [0],
3539-
'wasm_exnref': [1]
3539+
'legacy': [1]
35403540
})
3541-
def test_embind_tsgen_exceptions(self, wasm_exnref):
3542-
self.set_setting('WASM_LEGACY_EXCEPTIONS', wasm_exnref == 1)
3541+
def test_embind_tsgen_exceptions(self, legacy):
3542+
self.set_setting('WASM_LEGACY_EXCEPTIONS', legacy)
35433543
# Check that when Wasm exceptions and assertions are enabled bindings still generate.
35443544
self.run_process([EMXX, test_file('other/embind_tsgen.cpp'),
35453545
'-lembind', '-fwasm-exceptions', '-sASSERTIONS',
@@ -8950,8 +8950,8 @@ def test_codesize_minimal_pthreads(self):
89508950
'mangle': (['-O2', '-fexceptions',
89518951
'-sDEMANGLE_SUPPORT', '-Wno-deprecated'], [], ['waka']), # noqa
89528952
# Wasm EH's code size increase is smaller than that of Emscripten EH
8953-
'except_wasm': (['-O2', '-fwasm-exceptions', '-sWASM_LEGACY_EXCEPTIONS'], [], ['waka']),
8954-
'except_wasm_exnref': (['-O2', '-fwasm-exceptions', '-sWASM_LEGACY_EXCEPTIONS=0'], [], ['waka']),
8953+
'except_wasm': (['-O2', '-fwasm-exceptions', '-sWASM_LEGACY_EXCEPTIONS=0'], [], ['waka']),
8954+
'except_wasm_legacy': (['-O2', '-fwasm-exceptions', '-sWASM_LEGACY_EXCEPTIONS'], [], ['waka']),
89558955
# eval_ctors 1 can partially optimize, but runs into getenv() for locale
89568956
# code. mode 2 ignores those and fully optimizes out the ctors
89578957
'ctors1': (['-O2', '-sEVAL_CTORS'], [], ['waka']),
@@ -9251,9 +9251,9 @@ def test_lto(self, args):
92519251

92529252
@parameterized({
92539253
'noexcept': [],
9254-
'except': ['-sDISABLE_EXCEPTION_CATCHING=0'],
9255-
'except_wasm': ['-fwasm-exceptions', '-sWASM_LEGACY_EXCEPTIONS'],
9256-
'except_wasm_exnref': ['-fwasm-exceptions', '-sWASM_LEGACY_EXCEPTIONS=0']
9254+
'except_emscripten': ['-sDISABLE_EXCEPTION_CATCHING=0'],
9255+
'except_wasm': ['-fwasm-exceptions', '-sWASM_LEGACY_EXCEPTIONS=0'],
9256+
'except_wasm_legacy': ['-fwasm-exceptions', '-sWASM_LEGACY_EXCEPTIONS']
92579257
})
92589258
def test_lto_libcxx(self, *args):
92599259
self.run_process([EMXX, test_file('hello_libcxx.cpp'), '-flto'] + list(args))
@@ -9275,12 +9275,11 @@ def test_lto_flags(self):
92759275
@requires_wasm_eh
92769276
def test_lto_wasm_exceptions(self):
92779277
self.set_setting('EXCEPTION_DEBUG')
9278-
self.set_setting('WASM_LEGACY_EXCEPTIONS')
92799278
self.emcc_args += ['-fwasm-exceptions', '-flto']
9280-
self.do_run_in_out_file_test('core/test_exceptions.cpp', out_suffix='_caught')
9281-
# New Wasm EH with exnref
92829279
self.set_setting('WASM_LEGACY_EXCEPTIONS', 0)
92839280
self.do_run_in_out_file_test('core/test_exceptions.cpp', out_suffix='_caught')
9281+
self.set_setting('WASM_LEGACY_EXCEPTIONS')
9282+
self.do_run_in_out_file_test('core/test_exceptions.cpp', out_suffix='_caught')
92849283

92859284
@parameterized({
92869285
'': ([],),
@@ -12794,11 +12793,10 @@ def test_standalone_wasm_exceptions(self):
1279412793
self.set_setting('WASM_BIGINT')
1279512794
self.wasm_engines = []
1279612795
self.emcc_args += ['-fwasm-exceptions']
12797-
self.set_setting('WASM_LEGACY_EXCEPTIONS')
12798-
self.do_run_in_out_file_test('core/test_exceptions.cpp', out_suffix='_caught')
12799-
# New Wasm EH with exnref
1280012796
self.set_setting('WASM_LEGACY_EXCEPTIONS', 0)
1280112797
self.do_run_in_out_file_test('core/test_exceptions.cpp', out_suffix='_caught')
12798+
self.set_setting('WASM_LEGACY_EXCEPTIONS')
12799+
self.do_run_in_out_file_test('core/test_exceptions.cpp', out_suffix='_caught')
1280212800

1280312801
def test_missing_malloc_export(self):
1280412802
# we used to include malloc by default. show a clear error in builds with
@@ -15328,8 +15326,8 @@ def test_SUPPORT_BIG_ENDIAN(self):
1532815326
'noexcept': ['-fno-exceptions'],
1532915327
'default': [],
1533015328
'except': ['-sDISABLE_EXCEPTION_CATCHING=0'],
15331-
'except_wasm': ['-fwasm-exceptions', '-sWASM_LEGACY_EXCEPTIONS'],
15332-
'except_wasm_exnref': ['-fwasm-exceptions', '-sWASM_LEGACY_EXCEPTIONS=0']
15329+
'except_wasm': ['-fwasm-exceptions', '-sWASM_LEGACY_EXCEPTIONS=0'],
15330+
'except_wasm_legacy': ['-fwasm-exceptions', '-sWASM_LEGACY_EXCEPTIONS']
1533315331
})
1533415332
def test_std_promise_link(self, *args):
1533515333
# Regression test for a bug where std::promise's destructor caused a link

tools/link.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def check_human_readable_list(items):
432432
extras = settings.BINARYEN_EXTRA_PASSES.split(',')
433433
passes += [('--' + p) if p[0] != '-' else p for p in extras if p]
434434

435-
# Run the translator to the new standardized EH instructions with exnref
435+
# Run the translator to the standardized EH instructions.
436436
if not settings.WASM_LEGACY_EXCEPTIONS:
437437
passes += ['--emit-exnref']
438438

0 commit comments

Comments
 (0)