@@ -67,6 +67,22 @@ def decorated(self, *args, **kwargs):
67
67
return decorator
68
68
69
69
70
+ def no_esm_integration (note ):
71
+ assert not callable (note )
72
+
73
+ def decorator (f ):
74
+ assert callable (f )
75
+
76
+ @wraps (f )
77
+ def decorated (self , * args , ** kwargs ):
78
+ if self .get_setting ('WASM_ESM_INTEGRATION' ):
79
+ self .skipTest (note )
80
+ f (self , * args , ** kwargs )
81
+ return decorated
82
+
83
+ return decorator
84
+
85
+
70
86
def wasm_simd (f ):
71
87
assert callable (f )
72
88
@@ -189,6 +205,8 @@ def with_asyncify_and_jspi(f):
189
205
190
206
@wraps (f )
191
207
def metafunc (self , jspi , * args , ** kwargs ):
208
+ if self .get_setting ('WASM_ESM_INTEGRATION' ):
209
+ self .skipTest ('WASM_ESM_INTEGRATION is not compatible with ASYNCIFY' )
192
210
if jspi :
193
211
self .set_setting ('ASYNCIFY' , 2 )
194
212
self .require_jspi ()
@@ -208,6 +226,8 @@ def also_with_asyncify_and_jspi(f):
208
226
209
227
@wraps (f )
210
228
def metafunc (self , asyncify , * args , ** kwargs ):
229
+ if asyncify and self .get_setting ('WASM_ESM_INTEGRATION' ):
230
+ self .skipTest ('WASM_ESM_INTEGRATION is not compatible with ASYNCIFY' )
211
231
if asyncify == 2 :
212
232
self .set_setting ('ASYNCIFY' , 2 )
213
233
self .require_jspi ()
@@ -424,6 +444,7 @@ def get_bullet_library(self, use_cmake):
424
444
def test_hello_world (self ):
425
445
self .do_core_test ('test_hello_world.c' )
426
446
447
+ @no_esm_integration ('WASM_ASYNC_COMPILATION=0' )
427
448
def test_wasm_synchronous_compilation (self ):
428
449
if self .get_setting ('MODULARIZE' ) != 'instance' :
429
450
self .set_setting ('STRICT_JS' )
@@ -914,6 +935,7 @@ def test_longjmp(self):
914
935
self .do_core_test ('test_longjmp.c' )
915
936
916
937
@no_sanitize ('sanitizers do not support WASM_WORKERS' )
938
+ @no_esm_integration ('WASM_ESM_INTEGRATION is not compatible with WASM_WORKERS' )
917
939
def test_longjmp_wasm_workers (self ):
918
940
self .do_core_test ('test_longjmp.c' , emcc_args = ['-sWASM_WORKERS' ])
919
941
@@ -1995,7 +2017,11 @@ def test_em_js(self, args, force_c):
1995
2017
self .setup_node_pthreads ()
1996
2018
1997
2019
self .do_core_test ('test_em_js.cpp' , force_c = force_c )
1998
- self .assertContained ('no args returning int' , read_file (self .output_name ('test_em_js' )))
2020
+ if self .get_setting ('WASM_ESM_INTEGRATION' ):
2021
+ js_out = 'test_em_js.support.mjs'
2022
+ else :
2023
+ js_out = self .output_name ('test_em_js' )
2024
+ self .assertContained ('no args returning int' , read_file (js_out ))
1999
2025
2000
2026
@no_wasm2js ('test depends on WASM_BIGINT which is not compatible with wasm2js' )
2001
2027
def test_em_js_i64 (self ):
@@ -2173,6 +2199,7 @@ def test_nothrow_new(self, args):
2173
2199
@no_lsan ('LSan alters the memory size' )
2174
2200
@no_4gb ('depends on memory size' )
2175
2201
@no_2gb ('depends on memory size' )
2202
+ @no_esm_integration ('external wasmMemory' )
2176
2203
def test_module_wasm_memory (self ):
2177
2204
self .emcc_args += ['--pre-js' , test_file ('core/test_module_wasm_memory.js' )]
2178
2205
self .set_setting ('IMPORTED_MEMORY' )
@@ -6982,7 +7009,6 @@ def test_EXPORTED_RUNTIME_METHODS(self):
6982
7009
6983
7010
@also_with_minimal_runtime
6984
7011
@no_modularize_instance ('uses dynCallLegacy' )
6985
- @no_wasm64 ('not compatible with MEMORY64' )
6986
7012
def test_dyncall_specific (self ):
6987
7013
if self .get_setting ('WASM_BIGINT' ) != 0 and not self .is_wasm2js ():
6988
7014
# define DYNCALLS because this test does test calling them directly, and
@@ -7446,6 +7472,7 @@ def test_embind_negative_constants(self):
7446
7472
self .do_run_in_out_file_test ('embind/test_negative_constants.cpp' , emcc_args = ['-lembind' ])
7447
7473
7448
7474
@also_with_wasm_bigint
7475
+ @no_esm_integration ('embind is not compatible with WASM_ESM_INTEGRATION' )
7449
7476
def test_embind_unsigned (self ):
7450
7477
self .do_run_in_out_file_test ('embind/test_unsigned.cpp' , emcc_args = ['-lembind' ])
7451
7478
@@ -7621,6 +7648,7 @@ def test_embind_no_rtti_followed_by_rtti(self):
7621
7648
self .do_run (src , '418\n dotest returned: 42\n ' )
7622
7649
7623
7650
@no_sanitize ('sanitizers do not support WASM_WORKERS' )
7651
+ @no_esm_integration ('WASM_ESM_INTEGRATION is not compatible with WASM_WORKERS' )
7624
7652
def test_embind_wasm_workers (self ):
7625
7653
self .do_run_in_out_file_test ('embind/test_embind_wasm_workers.cpp' , emcc_args = ['-lembind' , '-sWASM_WORKERS' ])
7626
7654
@@ -7796,6 +7824,7 @@ def test_embind_dylink_visibility_hidden(self):
7796
7824
self .do_runf ('main.cpp' , 'done\n ' , emcc_args = ['--bind' ])
7797
7825
7798
7826
@no_wasm2js ('TODO: source maps in wasm2js' )
7827
+ @no_esm_integration ('WASM_ESM_INTEGRATION is not compatible with dwarf output' )
7799
7828
def test_dwarf (self ):
7800
7829
self .emcc_args .append ('-g' )
7801
7830
@@ -8238,6 +8267,7 @@ def test_asyncify_lists(self, args, should_pass, response=None):
8238
8267
binary = read_binary (filename )
8239
8268
self .assertFalse (b'main' in binary )
8240
8269
8270
+ @no_esm_integration ('WASM_ESM_INTEGRATION is not compatible with ASYNCIFY' )
8241
8271
@parameterized ({
8242
8272
'normal' : ([], True ),
8243
8273
'ignoreindirect' : (['-sASYNCIFY_IGNORE_INDIRECT' ], False ),
@@ -8629,7 +8659,10 @@ def test_environment(self):
8629
8659
8630
8660
def test (assert_returncode = 0 ):
8631
8661
self .do_core_test ('test_hello_world.c' , assert_returncode = assert_returncode )
8632
- js = read_file (self .output_name ('test_hello_world' ))
8662
+ if self .get_setting ('WASM_ESM_INTEGRATION' ):
8663
+ js = read_file (self .output_name ('test_hello_world.support' ))
8664
+ else :
8665
+ js = read_file (self .output_name ('test_hello_world' ))
8633
8666
assert ('require(' in js ) == ('node' in self .get_setting ('ENVIRONMENT' )), 'we should have require() calls only if node js specified'
8634
8667
8635
8668
for engine in config .JS_ENGINES :
@@ -8754,11 +8787,13 @@ def test_minimal_runtime_global_initializer(self):
8754
8787
self .do_runf ('test_global_initializer.cpp' , 't1 > t0: 1' )
8755
8788
8756
8789
@no_wasm2js ('wasm2js does not support PROXY_TO_PTHREAD (custom section support)' )
8790
+ @no_esm_integration ('USE_OFFSET_CONVERTER' )
8757
8791
def test_return_address (self ):
8758
8792
self .set_setting ('USE_OFFSET_CONVERTER' )
8759
8793
self .do_runf ('core/test_return_address.c' , 'passed' )
8760
8794
8761
8795
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8796
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8762
8797
@no_asan ('-fsanitize-minimal-runtime cannot be used with ASan' )
8763
8798
@no_lsan ('-fsanitize-minimal-runtime cannot be used with LSan' )
8764
8799
def test_ubsan_minimal_too_many_errors (self ):
@@ -8768,6 +8803,7 @@ def test_ubsan_minimal_too_many_errors(self):
8768
8803
regex = True )
8769
8804
8770
8805
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8806
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8771
8807
@no_asan ('-fsanitize-minimal-runtime cannot be used with ASan' )
8772
8808
@no_lsan ('-fsanitize-minimal-runtime cannot be used with LSan' )
8773
8809
def test_ubsan_minimal_errors_same_place (self ):
@@ -8782,6 +8818,7 @@ def test_ubsan_minimal_errors_same_place(self):
8782
8818
'fsanitize_overflow' : (['-fsanitize=signed-integer-overflow' ],),
8783
8819
})
8784
8820
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8821
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8785
8822
def test_ubsan_full_overflow (self , args ):
8786
8823
self .emcc_args += args
8787
8824
self .do_runf (
@@ -8797,6 +8834,7 @@ def test_ubsan_full_overflow(self, args):
8797
8834
'fsanitize_return' : (['-fsanitize=return' ],),
8798
8835
})
8799
8836
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8837
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8800
8838
def test_ubsan_full_no_return (self , args ):
8801
8839
self .emcc_args += ['-Wno-return-type' ] + args
8802
8840
self .do_runf ('core/test_ubsan_full_no_return.cpp' ,
@@ -8808,6 +8846,7 @@ def test_ubsan_full_no_return(self, args):
8808
8846
'fsanitize_shift' : (['-fsanitize=shift' ],),
8809
8847
})
8810
8848
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8849
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8811
8850
def test_ubsan_full_left_shift (self , args ):
8812
8851
self .emcc_args += args
8813
8852
self .do_runf (
@@ -8824,6 +8863,7 @@ def test_ubsan_full_left_shift(self, args):
8824
8863
'dylink' : (['-fsanitize=null' , '-sMAIN_MODULE=2' ],),
8825
8864
})
8826
8865
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8866
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8827
8867
def test_ubsan_full_null_ref (self , args ):
8828
8868
if '-sMAIN_MODULE=2' in args :
8829
8869
self .check_dylink ()
@@ -8840,6 +8880,7 @@ def test_ubsan_full_null_ref(self, args):
8840
8880
])
8841
8881
8842
8882
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8883
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8843
8884
def test_sanitize_vptr (self ):
8844
8885
self .do_runf (
8845
8886
'core/test_sanitize_vptr.cpp' ,
@@ -8862,6 +8903,7 @@ def test_sanitize_vptr(self):
8862
8903
]),
8863
8904
})
8864
8905
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8906
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8865
8907
def test_ubsan_full_stack_trace (self , g_flag , expected_output ):
8866
8908
if g_flag == '-gsource-map' :
8867
8909
if self .is_wasm2js ():
@@ -8876,6 +8918,7 @@ def test_ubsan_full_stack_trace(self, g_flag, expected_output):
8876
8918
assert_all = True , expected_output = expected_output )
8877
8919
8878
8920
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8921
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8879
8922
def test_ubsan_typeinfo_eq (self ):
8880
8923
# https://github.com/emscripten-core/emscripten/issues/13330
8881
8924
src = r'''
@@ -8895,6 +8938,7 @@ def test_template_class_deduction(self):
8895
8938
self .do_core_test ('test_template_class_deduction.cpp' )
8896
8939
8897
8940
@no_wasm2js ('TODO: ASAN in wasm2js' )
8941
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8898
8942
@no_safe_heap ('asan does not work with SAFE_HEAP' )
8899
8943
@no_wasm64 ('TODO: ASAN in memory64' )
8900
8944
@no_2gb ('asan doesnt support GLOBAL_BASE' )
@@ -8915,6 +8959,7 @@ def test_asan_no_error(self, name):
8915
8959
@no_safe_heap ('asan does not work with SAFE_HEAP' )
8916
8960
@no_wasm64 ('TODO: ASAN in memory64' )
8917
8961
@no_2gb ('asan doesnt support GLOBAL_BASE' )
8962
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8918
8963
@parameterized ({
8919
8964
'use_after_free_c' : ('test_asan_use_after_free.c' , [
8920
8965
'AddressSanitizer: heap-use-after-free on address' ,
@@ -8988,6 +9033,7 @@ def test_asan(self, name, expected_output, cflags=None):
8988
9033
@no_wasm2js ('TODO: ASAN in wasm2js' )
8989
9034
@no_wasm64 ('TODO: ASAN in memory64' )
8990
9035
@no_2gb ('asan doesnt support GLOBAL_BASE' )
9036
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8991
9037
def test_asan_js_stack_op (self ):
8992
9038
self .emcc_args .append ('-fsanitize=address' )
8993
9039
self .set_setting ('ALLOW_MEMORY_GROWTH' )
@@ -8999,6 +9045,7 @@ def test_asan_js_stack_op(self):
8999
9045
@no_wasm2js ('TODO: ASAN in wasm2js' )
9000
9046
@no_wasm64 ('TODO: ASAN in memory64' )
9001
9047
@no_2gb ('asan doesnt support GLOBAL_BASE' )
9048
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
9002
9049
def test_asan_api (self ):
9003
9050
self .emcc_args .append ('-fsanitize=address' )
9004
9051
self .set_setting ('INITIAL_MEMORY' , '300mb' )
@@ -9008,6 +9055,7 @@ def test_asan_api(self):
9008
9055
@no_wasm2js ('TODO: ASAN in wasm2js' )
9009
9056
@no_wasm64 ('TODO: ASAN in memory64' )
9010
9057
@no_2gb ('asan doesnt support GLOBAL_BASE' )
9058
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
9011
9059
def test_asan_modularized_with_closure (self ):
9012
9060
# the bug is that createModule() returns undefined, instead of the
9013
9061
# proper Promise object.
@@ -9022,6 +9070,7 @@ def test_asan_modularized_with_closure(self):
9022
9070
9023
9071
@no_asan ('SAFE_HEAP cannot be used with ASan' )
9024
9072
@no_2gb ('asan doesnt support GLOBAL_BASE' )
9073
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
9025
9074
def test_safe_heap_user_js (self ):
9026
9075
self .set_setting ('SAFE_HEAP' )
9027
9076
self .do_runf ('core/test_safe_heap_user_js.c' ,
@@ -9413,6 +9462,7 @@ def test_Module_dynamicLibraries(self, args):
9413
9462
9414
9463
# Tests the emscripten_get_exported_function() API.
9415
9464
@also_with_minimal_runtime
9465
+ @no_esm_integration ('depends on wasmExports' )
9416
9466
def test_get_exported_function (self ):
9417
9467
self .set_setting ('ALLOW_TABLE_GROWTH' )
9418
9468
self .emcc_args += ['-lexports.js' ]
0 commit comments