@@ -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 ()
@@ -437,6 +457,7 @@ def get_bullet_library(self, use_cmake):
437
457
def test_hello_world (self ):
438
458
self .do_core_test ('test_hello_world.c' )
439
459
460
+ @no_esm_integration ('WASM_ASYNC_COMPILATION=0' )
440
461
def test_wasm_synchronous_compilation (self ):
441
462
if self .get_setting ('MODULARIZE' ) != 'instance' :
442
463
self .set_setting ('STRICT_JS' )
@@ -927,6 +948,7 @@ def test_longjmp(self):
927
948
self .do_core_test ('test_longjmp.c' )
928
949
929
950
@no_sanitize ('sanitizers do not support WASM_WORKERS' )
951
+ @no_esm_integration ('WASM_ESM_INTEGRATION is not compatible with WASM_WORKERS' )
930
952
def test_longjmp_wasm_workers (self ):
931
953
self .do_core_test ('test_longjmp.c' , emcc_args = ['-sWASM_WORKERS' ])
932
954
@@ -2008,7 +2030,11 @@ def test_em_js(self, args, force_c):
2008
2030
self .setup_node_pthreads ()
2009
2031
2010
2032
self .do_core_test ('test_em_js.cpp' , force_c = force_c )
2011
- self .assertContained ('no args returning int' , read_file (self .output_name ('test_em_js' )))
2033
+ if self .get_setting ('WASM_ESM_INTEGRATION' ):
2034
+ js_out = 'test_em_js.support.mjs'
2035
+ else :
2036
+ js_out = self .output_name ('test_em_js' )
2037
+ self .assertContained ('no args returning int' , read_file (js_out ))
2012
2038
2013
2039
@no_wasm2js ('test depends on WASM_BIGINT which is not compatible with wasm2js' )
2014
2040
def test_em_js_i64 (self ):
@@ -2186,6 +2212,7 @@ def test_nothrow_new(self, args):
2186
2212
@no_lsan ('LSan alters the memory size' )
2187
2213
@no_4gb ('depends on memory size' )
2188
2214
@no_2gb ('depends on memory size' )
2215
+ @no_esm_integration ('external wasmMemory' )
2189
2216
def test_module_wasm_memory (self ):
2190
2217
self .emcc_args += ['--pre-js' , test_file ('core/test_module_wasm_memory.js' )]
2191
2218
self .set_setting ('IMPORTED_MEMORY' )
@@ -6998,7 +7025,6 @@ def test_EXPORTED_RUNTIME_METHODS(self):
6998
7025
6999
7026
@also_with_minimal_runtime
7000
7027
@no_modularize_instance ('uses dynCallLegacy' )
7001
- @no_wasm64 ('not compatible with MEMORY64' )
7002
7028
def test_dyncall_specific (self ):
7003
7029
if self .get_setting ('WASM_BIGINT' ) != 0 and not self .is_wasm2js ():
7004
7030
# define DYNCALLS because this test does test calling them directly, and
@@ -7462,6 +7488,7 @@ def test_embind_negative_constants(self):
7462
7488
self .do_run_in_out_file_test ('embind/test_negative_constants.cpp' , emcc_args = ['-lembind' ])
7463
7489
7464
7490
@also_with_wasm_bigint
7491
+ @no_esm_integration ('embind is not compatible with WASM_ESM_INTEGRATION' )
7465
7492
def test_embind_unsigned (self ):
7466
7493
self .do_run_in_out_file_test ('embind/test_unsigned.cpp' , emcc_args = ['-lembind' ])
7467
7494
@@ -7637,6 +7664,7 @@ def test_embind_no_rtti_followed_by_rtti(self):
7637
7664
self .do_run (src , '418\n dotest returned: 42\n ' )
7638
7665
7639
7666
@no_sanitize ('sanitizers do not support WASM_WORKERS' )
7667
+ @no_esm_integration ('WASM_ESM_INTEGRATION is not compatible with WASM_WORKERS' )
7640
7668
def test_embind_wasm_workers (self ):
7641
7669
self .do_run_in_out_file_test ('embind/test_embind_wasm_workers.cpp' , emcc_args = ['-lembind' , '-sWASM_WORKERS' ])
7642
7670
@@ -7812,6 +7840,7 @@ def test_embind_dylink_visibility_hidden(self):
7812
7840
self .do_runf ('main.cpp' , 'done\n ' , emcc_args = ['--bind' ])
7813
7841
7814
7842
@no_wasm2js ('TODO: source maps in wasm2js' )
7843
+ @no_esm_integration ('WASM_ESM_INTEGRATION is not compatible with dwarf output' )
7815
7844
def test_dwarf (self ):
7816
7845
self .emcc_args .append ('-g' )
7817
7846
@@ -8254,6 +8283,7 @@ def test_asyncify_lists(self, args, should_pass, response=None):
8254
8283
binary = read_binary (filename )
8255
8284
self .assertFalse (b'main' in binary )
8256
8285
8286
+ @no_esm_integration ('WASM_ESM_INTEGRATION is not compatible with ASYNCIFY' )
8257
8287
@parameterized ({
8258
8288
'normal' : ([], True ),
8259
8289
'ignoreindirect' : (['-sASYNCIFY_IGNORE_INDIRECT' ], False ),
@@ -8645,7 +8675,10 @@ def test_environment(self):
8645
8675
8646
8676
def test (assert_returncode = 0 ):
8647
8677
self .do_core_test ('test_hello_world.c' , assert_returncode = assert_returncode )
8648
- js = read_file (self .output_name ('test_hello_world' ))
8678
+ if self .get_setting ('WASM_ESM_INTEGRATION' ):
8679
+ js = read_file (self .output_name ('test_hello_world.support' ))
8680
+ else :
8681
+ js = read_file (self .output_name ('test_hello_world' ))
8649
8682
assert ('require(' in js ) == ('node' in self .get_setting ('ENVIRONMENT' )), 'we should have require() calls only if node js specified'
8650
8683
8651
8684
for engine in config .JS_ENGINES :
@@ -8770,11 +8803,13 @@ def test_minimal_runtime_global_initializer(self):
8770
8803
self .do_runf ('test_global_initializer.cpp' , 't1 > t0: 1' )
8771
8804
8772
8805
@no_wasm2js ('wasm2js does not support PROXY_TO_PTHREAD (custom section support)' )
8806
+ @no_esm_integration ('USE_OFFSET_CONVERTER' )
8773
8807
def test_return_address (self ):
8774
8808
self .set_setting ('USE_OFFSET_CONVERTER' )
8775
8809
self .do_runf ('core/test_return_address.c' , 'passed' )
8776
8810
8777
8811
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8812
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8778
8813
@no_asan ('-fsanitize-minimal-runtime cannot be used with ASan' )
8779
8814
@no_lsan ('-fsanitize-minimal-runtime cannot be used with LSan' )
8780
8815
def test_ubsan_minimal_too_many_errors (self ):
@@ -8784,6 +8819,7 @@ def test_ubsan_minimal_too_many_errors(self):
8784
8819
regex = True )
8785
8820
8786
8821
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8822
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8787
8823
@no_asan ('-fsanitize-minimal-runtime cannot be used with ASan' )
8788
8824
@no_lsan ('-fsanitize-minimal-runtime cannot be used with LSan' )
8789
8825
def test_ubsan_minimal_errors_same_place (self ):
@@ -8798,6 +8834,7 @@ def test_ubsan_minimal_errors_same_place(self):
8798
8834
'fsanitize_overflow' : (['-fsanitize=signed-integer-overflow' ],),
8799
8835
})
8800
8836
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8837
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8801
8838
def test_ubsan_full_overflow (self , args ):
8802
8839
self .emcc_args += args
8803
8840
self .do_runf (
@@ -8813,6 +8850,7 @@ def test_ubsan_full_overflow(self, args):
8813
8850
'fsanitize_return' : (['-fsanitize=return' ],),
8814
8851
})
8815
8852
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8853
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8816
8854
def test_ubsan_full_no_return (self , args ):
8817
8855
self .emcc_args += ['-Wno-return-type' ] + args
8818
8856
self .do_runf ('core/test_ubsan_full_no_return.cpp' ,
@@ -8824,6 +8862,7 @@ def test_ubsan_full_no_return(self, args):
8824
8862
'fsanitize_shift' : (['-fsanitize=shift' ],),
8825
8863
})
8826
8864
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8865
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8827
8866
def test_ubsan_full_left_shift (self , args ):
8828
8867
self .emcc_args += args
8829
8868
self .do_runf (
@@ -8840,6 +8879,7 @@ def test_ubsan_full_left_shift(self, args):
8840
8879
'dylink' : (['-fsanitize=null' , '-sMAIN_MODULE=2' ],),
8841
8880
})
8842
8881
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8882
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8843
8883
def test_ubsan_full_null_ref (self , args ):
8844
8884
if '-sMAIN_MODULE=2' in args :
8845
8885
self .check_dylink ()
@@ -8856,6 +8896,7 @@ def test_ubsan_full_null_ref(self, args):
8856
8896
])
8857
8897
8858
8898
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8899
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8859
8900
def test_sanitize_vptr (self ):
8860
8901
self .do_runf (
8861
8902
'core/test_sanitize_vptr.cpp' ,
@@ -8878,6 +8919,7 @@ def test_sanitize_vptr(self):
8878
8919
]),
8879
8920
})
8880
8921
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8922
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8881
8923
def test_ubsan_full_stack_trace (self , g_flag , expected_output ):
8882
8924
if g_flag == '-gsource-map' :
8883
8925
if self .is_wasm2js ():
@@ -8892,6 +8934,7 @@ def test_ubsan_full_stack_trace(self, g_flag, expected_output):
8892
8934
assert_all = True , expected_output = expected_output )
8893
8935
8894
8936
@no_wasm2js ('TODO: sanitizers in wasm2js' )
8937
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8895
8938
def test_ubsan_typeinfo_eq (self ):
8896
8939
# https://github.com/emscripten-core/emscripten/issues/13330
8897
8940
src = r'''
@@ -8911,6 +8954,7 @@ def test_template_class_deduction(self):
8911
8954
self .do_core_test ('test_template_class_deduction.cpp' )
8912
8955
8913
8956
@no_wasm2js ('TODO: ASAN in wasm2js' )
8957
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8914
8958
@no_safe_heap ('asan does not work with SAFE_HEAP' )
8915
8959
@no_wasm64 ('TODO: ASAN in memory64' )
8916
8960
@no_2gb ('asan doesnt support GLOBAL_BASE' )
@@ -8931,6 +8975,7 @@ def test_asan_no_error(self, name):
8931
8975
@no_safe_heap ('asan does not work with SAFE_HEAP' )
8932
8976
@no_wasm64 ('TODO: ASAN in memory64' )
8933
8977
@no_2gb ('asan doesnt support GLOBAL_BASE' )
8978
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
8934
8979
@parameterized ({
8935
8980
'use_after_free_c' : ('test_asan_use_after_free.c' , [
8936
8981
'AddressSanitizer: heap-use-after-free on address' ,
@@ -9004,6 +9049,7 @@ def test_asan(self, name, expected_output, cflags=None):
9004
9049
@no_wasm2js ('TODO: ASAN in wasm2js' )
9005
9050
@no_wasm64 ('TODO: ASAN in memory64' )
9006
9051
@no_2gb ('asan doesnt support GLOBAL_BASE' )
9052
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
9007
9053
def test_asan_js_stack_op (self ):
9008
9054
self .emcc_args .append ('-fsanitize=address' )
9009
9055
self .set_setting ('ALLOW_MEMORY_GROWTH' )
@@ -9015,6 +9061,7 @@ def test_asan_js_stack_op(self):
9015
9061
@no_wasm2js ('TODO: ASAN in wasm2js' )
9016
9062
@no_wasm64 ('TODO: ASAN in memory64' )
9017
9063
@no_2gb ('asan doesnt support GLOBAL_BASE' )
9064
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
9018
9065
def test_asan_api (self ):
9019
9066
self .emcc_args .append ('-fsanitize=address' )
9020
9067
self .set_setting ('INITIAL_MEMORY' , '300mb' )
@@ -9024,6 +9071,7 @@ def test_asan_api(self):
9024
9071
@no_wasm2js ('TODO: ASAN in wasm2js' )
9025
9072
@no_wasm64 ('TODO: ASAN in memory64' )
9026
9073
@no_2gb ('asan doesnt support GLOBAL_BASE' )
9074
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
9027
9075
def test_asan_modularized_with_closure (self ):
9028
9076
# the bug is that createModule() returns undefined, instead of the
9029
9077
# proper Promise object.
@@ -9038,6 +9086,7 @@ def test_asan_modularized_with_closure(self):
9038
9086
9039
9087
@no_asan ('SAFE_HEAP cannot be used with ASan' )
9040
9088
@no_2gb ('asan doesnt support GLOBAL_BASE' )
9089
+ @no_esm_integration ('sanitizers do not support WASM_ESM_INTEGRATION' )
9041
9090
def test_safe_heap_user_js (self ):
9042
9091
self .set_setting ('SAFE_HEAP' )
9043
9092
self .do_runf ('core/test_safe_heap_user_js.c' ,
@@ -9429,6 +9478,7 @@ def test_Module_dynamicLibraries(self, args):
9429
9478
9430
9479
# Tests the emscripten_get_exported_function() API.
9431
9480
@also_with_minimal_runtime
9481
+ @no_esm_integration ('depends on wasmExports' )
9432
9482
def test_get_exported_function (self ):
9433
9483
self .set_setting ('ALLOW_TABLE_GROWTH' )
9434
9484
self .emcc_args += ['-lexports.js' ]
0 commit comments