34
34
from common import env_modify, no_mac, no_windows, only_windows, requires_native_clang, with_env_modify
35
35
from common import create_file, parameterized, NON_ZERO, node_pthreads, TEST_ROOT, test_file
36
36
from common import compiler_for, EMBUILDER, requires_v8, requires_node, requires_wasm64, requires_node_canary
37
- from common import requires_wasm_eh, crossplatform, with_both_sjlj, also_with_standalone_wasm
37
+ from common import requires_wasm_eh, crossplatform, with_both_eh_sjlj, with_both_sjlj, also_with_standalone_wasm
38
38
from common import also_with_minimal_runtime, also_with_wasm_bigint, also_with_wasm64, flaky
39
39
from common import EMTEST_BUILD_VERBOSE, PYTHON, WEBIDL_BINDER
40
40
from common import requires_network
@@ -8843,11 +8843,8 @@ def test_exceptions_c_linker(self):
8843
8843
stderr = self.expect_fail([EMCC, '-sSTRICT', test_file('other/test_exceptions_c_linker.c')])
8844
8844
self.assertContained('error: undefined symbol: __cxa_find_matching_catch_1', stderr)
8845
8845
8846
- @parameterized({
8847
- '': (False,),
8848
- 'wasm': (True,),
8849
- })
8850
- def test_exceptions_stack_trace_and_message(self, wasm_eh):
8846
+ @with_both_eh_sjlj
8847
+ def test_exceptions_stack_trace_and_message(self):
8851
8848
src = r'''
8852
8849
#include <stdexcept>
8853
8850
@@ -8864,7 +8861,7 @@ def test_exceptions_stack_trace_and_message(self, wasm_eh):
8864
8861
return 0;
8865
8862
}
8866
8863
'''
8867
- self.emcc_args = ['-g']
8864
+ self.emcc_args + = ['-g']
8868
8865
8869
8866
# Stack trace and message example for this example code:
8870
8867
# exiting due to exception: [object WebAssembly.Exception],Error: std::runtime_error,my message
@@ -8884,18 +8881,14 @@ def test_exceptions_stack_trace_and_message(self, wasm_eh):
8884
8881
'at (src.wasm.)?foo',
8885
8882
'at (src.wasm.)?main']
8886
8883
8887
- if wasm_eh :
8884
+ if '-fwasm-excpeptions' in self.emcc_args :
8888
8885
# FIXME Node v18.13 (LTS as of Jan 2023) has not yet implemented the new
8889
8886
# optional 'traceStack' option in WebAssembly.Exception constructor
8890
8887
# (https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Exception/Exception)
8891
8888
# and embeds stack traces unconditionally. Change this back to
8892
8889
# self.require_wasm_eh() if this issue is fixed later.
8893
8890
self.require_v8()
8894
8891
8895
- self.emcc_args += ['-fwasm-exceptions']
8896
- else:
8897
- self.emcc_args += ['-fexceptions']
8898
-
8899
8892
# Stack traces are enabled when either of ASSERTIONS or
8900
8893
# EXCEPTION_STACK_TRACES is enabled. You can't disable
8901
8894
# EXCEPTION_STACK_TRACES when ASSERTIONS is enabled.
@@ -8926,23 +8919,16 @@ def test_exceptions_stack_trace_and_message(self, wasm_eh):
8926
8919
for check in stack_trace_checks:
8927
8920
self.assertFalse(re.search(check, err), 'Expected regex "%s" to not match on:\n%s' % (check, err))
8928
8921
8929
- @parameterized({
8930
- '': (False,),
8931
- 'wasm': (True,),
8932
- })
8933
- def test_exceptions_rethrow_stack_trace_and_message(self, wasm_eh):
8934
- self.emcc_args = ['-g']
8935
- if wasm_eh:
8922
+ @with_both_eh_sjlj
8923
+ def test_exceptions_rethrow_stack_trace_and_message(self):
8924
+ self.emcc_args += ['-g']
8925
+ if '-fwasm-excpeptions' in self.emcc_args:
8936
8926
# FIXME Node v18.13 (LTS as of Jan 2023) has not yet implemented the new
8937
8927
# optional 'traceStack' option in WebAssembly.Exception constructor
8938
8928
# (https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Exception/Exception)
8939
8929
# and embeds stack traces unconditionally. Change this back to
8940
8930
# self.require_wasm_eh() if this issue is fixed later.
8941
8931
self.require_v8()
8942
- self.emcc_args += ['-fwasm-exceptions']
8943
- else:
8944
- self.emcc_args += ['-fexceptions']
8945
-
8946
8932
# Rethrowing exception currently loses the stack trace before the rethrowing
8947
8933
# due to how rethrowing is implemented. So in the examples below we don't
8948
8934
# print 'bar' at the moment.
@@ -8998,17 +8984,9 @@ def test_exceptions_rethrow_stack_trace_and_message(self, wasm_eh):
8998
8984
expected_output=rethrow_stack_trace_checks, regex=True)
8999
8985
self.assertNotContained('important_function', err)
9000
8986
9001
- @parameterized({
9002
- '': (False,),
9003
- 'wasm': (True,),
9004
- })
9005
- def test_exceptions_exit_runtime(self, wasm_eh):
8987
+ @with_both_eh_sjlj
8988
+ def test_exceptions_exit_runtime(self):
9006
8989
self.set_setting('EXIT_RUNTIME')
9007
- if wasm_eh:
9008
- self.require_wasm_eh()
9009
- self.emcc_args.append('-fwasm-exceptions')
9010
- else:
9011
- self.set_setting('DISABLE_EXCEPTION_CATCHING', 0)
9012
8990
self.do_other_test('test_exceptions_exit_runtime.cpp')
9013
8991
9014
8992
@requires_node
0 commit comments