@@ -103,6 +103,21 @@ def decorated(self, *args, **kwargs):
103
103
return decorated
104
104
105
105
106
+ def asan (f ):
107
+ assert callable (f )
108
+
109
+ @wraps (f )
110
+ @no_safe_heap ('asan does not work with SAFE_HEAP' )
111
+ @no_wasm2js ('TODO: ASAN in wasm2js' )
112
+ @no_wasm64 ('TODO: ASAN in memory64' )
113
+ @no_2gb ('asan doesnt support GLOBAL_BASE' )
114
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
115
+ def decorated (self , * args , ** kwargs ):
116
+ f (self , * args , ** kwargs )
117
+
118
+ return decorated
119
+
120
+
106
121
def wasm_relaxed_simd (f ):
107
122
assert callable (f )
108
123
@@ -4122,7 +4137,6 @@ def test_dylink_basics(self):
4122
4137
self .verify_in_strict_mode (self .output_name ('main' ))
4123
4138
4124
4139
@with_dylink_reversed
4125
- @no_wasm64 ('Requires table64 lowering in all cases' )
4126
4140
def test_dylink_basics_no_modify (self ):
4127
4141
if self .is_optimizing ():
4128
4142
self .skipTest ('no modify mode only works with non-optimizing builds' )
@@ -8971,11 +8985,7 @@ def test_template_class_deduction(self):
8971
8985
self .emcc_args += ['-std=c++17' ]
8972
8986
self .do_core_test ('test_template_class_deduction.cpp' )
8973
8987
8974
- @no_wasm2js ('TODO: ASAN in wasm2js' )
8975
- @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8976
- @no_safe_heap ('asan does not work with SAFE_HEAP' )
8977
- @no_wasm64 ('TODO: ASAN in memory64' )
8978
- @no_2gb ('asan doesnt support GLOBAL_BASE' )
8988
+ @asan
8979
8989
@parameterized ({
8980
8990
'c' : ['test_asan_no_error.c' ],
8981
8991
'cpp' : ['test_asan_no_error.cpp' ],
@@ -8990,10 +9000,7 @@ def test_asan_no_error(self, name):
8990
9000
# clang optimizing things away. for example, a memset might be optimized into
8991
9001
# stores, and then the stores identified as dead, which leaves nothing for
8992
9002
# asan to test. here we want to test asan itself, so we work around that.
8993
- @no_safe_heap ('asan does not work with SAFE_HEAP' )
8994
- @no_wasm64 ('TODO: ASAN in memory64' )
8995
- @no_2gb ('asan doesnt support GLOBAL_BASE' )
8996
- @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
9003
+ @asan
8997
9004
@parameterized ({
8998
9005
'use_after_free_c' : ('test_asan_use_after_free.c' , [
8999
9006
'AddressSanitizer: heap-use-after-free on address' ,
@@ -9051,9 +9058,6 @@ def test_asan(self, name, expected_output, cflags=None):
9051
9058
if '-Oz' in self .emcc_args :
9052
9059
self .skipTest ('-Oz breaks source maps' )
9053
9060
9054
- if self .is_wasm2js ():
9055
- self .skipTest ('wasm2js has no ASan support' )
9056
-
9057
9061
self .emcc_args .append ('-fsanitize=address' )
9058
9062
self .set_setting ('ALLOW_MEMORY_GROWTH' )
9059
9063
self .set_setting ('INITIAL_MEMORY' , '300mb' )
@@ -9063,33 +9067,20 @@ def test_asan(self, name, expected_output, cflags=None):
9063
9067
expected_output = expected_output , assert_all = True ,
9064
9068
check_for_error = False , assert_returncode = NON_ZERO )
9065
9069
9066
- @no_safe_heap ('asan does not work with SAFE_HEAP' )
9067
- @no_wasm2js ('TODO: ASAN in wasm2js' )
9068
- @no_wasm64 ('TODO: ASAN in memory64' )
9069
- @no_2gb ('asan doesnt support GLOBAL_BASE' )
9070
- @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
9070
+ @asan
9071
9071
def test_asan_js_stack_op (self ):
9072
9072
self .emcc_args .append ('-fsanitize=address' )
9073
9073
self .set_setting ('ALLOW_MEMORY_GROWTH' )
9074
9074
self .set_setting ('INITIAL_MEMORY' , '300mb' )
9075
- self .do_runf ('core/test_asan_js_stack_op.c' ,
9076
- expected_output = 'Hello, World!' )
9075
+ self .do_runf ('core/test_asan_js_stack_op.c' , 'Hello, World!' )
9077
9076
9078
- @no_safe_heap ('asan does not work with SAFE_HEAP' )
9079
- @no_wasm2js ('TODO: ASAN in wasm2js' )
9080
- @no_wasm64 ('TODO: ASAN in memory64' )
9081
- @no_2gb ('asan doesnt support GLOBAL_BASE' )
9082
- @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
9077
+ @asan
9083
9078
def test_asan_api (self ):
9084
9079
self .emcc_args .append ('-fsanitize=address' )
9085
9080
self .set_setting ('INITIAL_MEMORY' , '300mb' )
9086
9081
self .do_core_test ('test_asan_api.c' )
9087
9082
9088
- @no_safe_heap ('asan does not work with SAFE_HEAP' )
9089
- @no_wasm2js ('TODO: ASAN in wasm2js' )
9090
- @no_wasm64 ('TODO: ASAN in memory64' )
9091
- @no_2gb ('asan doesnt support GLOBAL_BASE' )
9092
- @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
9083
+ @asan
9093
9084
def test_asan_modularized_with_closure (self ):
9094
9085
# the bug is that createModule() returns undefined, instead of the
9095
9086
# proper Promise object.
0 commit comments