-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[esm-integration] Add a new core test mode and fix or disable all tests #24288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
53827 | ||
53860 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
27082 | ||
27115 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
51877 | ||
51910 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,22 @@ def decorated(self, *args, **kwargs): | |
return decorator | ||
|
||
|
||
def no_esm_integration(note): | ||
assert not callable(note) | ||
|
||
def decorator(f): | ||
assert callable(f) | ||
|
||
@wraps(f) | ||
def decorated(self, *args, **kwargs): | ||
if self.get_setting('WASM_ESM_INTEGRATION'): | ||
self.skipTest(note) | ||
f(self, *args, **kwargs) | ||
return decorated | ||
|
||
return decorator | ||
|
||
|
||
def wasm_simd(f): | ||
assert callable(f) | ||
|
||
|
@@ -189,6 +205,8 @@ def with_asyncify_and_jspi(f): | |
|
||
@wraps(f) | ||
def metafunc(self, jspi, *args, **kwargs): | ||
if self.get_setting('WASM_ESM_INTEGRATION'): | ||
self.skipTest('WASM_ESM_INTEGRATION is not compatible with ASYNCIFY') | ||
if jspi: | ||
self.set_setting('ASYNCIFY', 2) | ||
self.require_jspi() | ||
|
@@ -208,6 +226,8 @@ def also_with_asyncify_and_jspi(f): | |
|
||
@wraps(f) | ||
def metafunc(self, asyncify, *args, **kwargs): | ||
if asyncify and self.get_setting('WASM_ESM_INTEGRATION'): | ||
self.skipTest('WASM_ESM_INTEGRATION is not compatible with ASYNCIFY') | ||
if asyncify == 2: | ||
self.set_setting('ASYNCIFY', 2) | ||
self.require_jspi() | ||
|
@@ -437,6 +457,7 @@ def get_bullet_library(self, use_cmake): | |
def test_hello_world(self): | ||
self.do_core_test('test_hello_world.c') | ||
|
||
@no_esm_integration('WASM_ASYNC_COMPILATION=0') | ||
def test_wasm_synchronous_compilation(self): | ||
if self.get_setting('MODULARIZE') != 'instance': | ||
self.set_setting('STRICT_JS') | ||
|
@@ -927,6 +948,7 @@ def test_longjmp(self): | |
self.do_core_test('test_longjmp.c') | ||
|
||
@no_sanitize('sanitizers do not support WASM_WORKERS') | ||
@no_esm_integration('WASM_ESM_INTEGRATION is not compatible with WASM_WORKERS') | ||
def test_longjmp_wasm_workers(self): | ||
self.do_core_test('test_longjmp.c', emcc_args=['-sWASM_WORKERS']) | ||
|
||
|
@@ -2008,7 +2030,11 @@ def test_em_js(self, args, force_c): | |
self.setup_node_pthreads() | ||
|
||
self.do_core_test('test_em_js.cpp', force_c=force_c) | ||
self.assertContained('no args returning int', read_file(self.output_name('test_em_js'))) | ||
if self.get_setting('WASM_ESM_INTEGRATION'): | ||
js_out = 'test_em_js.support.mjs' | ||
else: | ||
js_out = self.output_name('test_em_js') | ||
self.assertContained('no args returning int', read_file(js_out)) | ||
|
||
@no_wasm2js('test depends on WASM_BIGINT which is not compatible with wasm2js') | ||
def test_em_js_i64(self): | ||
|
@@ -2186,6 +2212,7 @@ def test_nothrow_new(self, args): | |
@no_lsan('LSan alters the memory size') | ||
@no_4gb('depends on memory size') | ||
@no_2gb('depends on memory size') | ||
@no_esm_integration('external wasmMemory') | ||
def test_module_wasm_memory(self): | ||
self.emcc_args += ['--pre-js', test_file('core/test_module_wasm_memory.js')] | ||
self.set_setting('IMPORTED_MEMORY') | ||
|
@@ -6998,7 +7025,6 @@ def test_EXPORTED_RUNTIME_METHODS(self): | |
|
||
@also_with_minimal_runtime | ||
@no_modularize_instance('uses dynCallLegacy') | ||
@no_wasm64('not compatible with MEMORY64') | ||
def test_dyncall_specific(self): | ||
if self.get_setting('WASM_BIGINT') != 0 and not self.is_wasm2js(): | ||
# define DYNCALLS because this test does test calling them directly, and | ||
|
@@ -7462,6 +7488,7 @@ def test_embind_negative_constants(self): | |
self.do_run_in_out_file_test('embind/test_negative_constants.cpp', emcc_args=['-lembind']) | ||
|
||
@also_with_wasm_bigint | ||
@no_esm_integration('embind is not compatible with WASM_ESM_INTEGRATION') | ||
def test_embind_unsigned(self): | ||
self.do_run_in_out_file_test('embind/test_unsigned.cpp', emcc_args=['-lembind']) | ||
|
||
|
@@ -7637,6 +7664,7 @@ def test_embind_no_rtti_followed_by_rtti(self): | |
self.do_run(src, '418\ndotest returned: 42\n') | ||
|
||
@no_sanitize('sanitizers do not support WASM_WORKERS') | ||
@no_esm_integration('WASM_ESM_INTEGRATION is not compatible with WASM_WORKERS') | ||
def test_embind_wasm_workers(self): | ||
self.do_run_in_out_file_test('embind/test_embind_wasm_workers.cpp', emcc_args=['-lembind', '-sWASM_WORKERS']) | ||
|
||
|
@@ -7812,6 +7840,7 @@ def test_embind_dylink_visibility_hidden(self): | |
self.do_runf('main.cpp', 'done\n', emcc_args=['--bind']) | ||
|
||
@no_wasm2js('TODO: source maps in wasm2js') | ||
@no_esm_integration('WASM_ESM_INTEGRATION is not compatible with dwarf output') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think its because of the wasm-dis / wasm-as round-trip we have to do to modify the import names. Hopefully that can be fixed soon. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yeah. SGTM to have this now and fix soon. |
||
def test_dwarf(self): | ||
self.emcc_args.append('-g') | ||
|
||
|
@@ -8254,6 +8283,7 @@ def test_asyncify_lists(self, args, should_pass, response=None): | |
binary = read_binary(filename) | ||
self.assertFalse(b'main' in binary) | ||
|
||
@no_esm_integration('WASM_ESM_INTEGRATION is not compatible with ASYNCIFY') | ||
@parameterized({ | ||
'normal': ([], True), | ||
'ignoreindirect': (['-sASYNCIFY_IGNORE_INDIRECT'], False), | ||
|
@@ -8645,7 +8675,10 @@ def test_environment(self): | |
|
||
def test(assert_returncode=0): | ||
self.do_core_test('test_hello_world.c', assert_returncode=assert_returncode) | ||
js = read_file(self.output_name('test_hello_world')) | ||
if self.get_setting('WASM_ESM_INTEGRATION'): | ||
js = read_file(self.output_name('test_hello_world.support')) | ||
else: | ||
js = read_file(self.output_name('test_hello_world')) | ||
assert ('require(' in js) == ('node' in self.get_setting('ENVIRONMENT')), 'we should have require() calls only if node js specified' | ||
|
||
for engine in config.JS_ENGINES: | ||
|
@@ -8770,11 +8803,13 @@ def test_minimal_runtime_global_initializer(self): | |
self.do_runf('test_global_initializer.cpp', 't1 > t0: 1') | ||
|
||
@no_wasm2js('wasm2js does not support PROXY_TO_PTHREAD (custom section support)') | ||
@no_esm_integration('USE_OFFSET_CONVERTER') | ||
def test_return_address(self): | ||
self.set_setting('USE_OFFSET_CONVERTER') | ||
self.do_runf('core/test_return_address.c', 'passed') | ||
|
||
@no_wasm2js('TODO: sanitizers in wasm2js') | ||
@no_esm_integration('sanitizers do not support WASM_ESM_INTEGRATION') | ||
@no_asan('-fsanitize-minimal-runtime cannot be used with ASan') | ||
@no_lsan('-fsanitize-minimal-runtime cannot be used with LSan') | ||
def test_ubsan_minimal_too_many_errors(self): | ||
|
@@ -8784,6 +8819,7 @@ def test_ubsan_minimal_too_many_errors(self): | |
regex=True) | ||
|
||
@no_wasm2js('TODO: sanitizers in wasm2js') | ||
@no_esm_integration('sanitizers do not support WASM_ESM_INTEGRATION') | ||
@no_asan('-fsanitize-minimal-runtime cannot be used with ASan') | ||
@no_lsan('-fsanitize-minimal-runtime cannot be used with LSan') | ||
def test_ubsan_minimal_errors_same_place(self): | ||
|
@@ -8798,6 +8834,7 @@ def test_ubsan_minimal_errors_same_place(self): | |
'fsanitize_overflow': (['-fsanitize=signed-integer-overflow'],), | ||
}) | ||
@no_wasm2js('TODO: sanitizers in wasm2js') | ||
@no_esm_integration('sanitizers do not support WASM_ESM_INTEGRATION') | ||
def test_ubsan_full_overflow(self, args): | ||
self.emcc_args += args | ||
self.do_runf( | ||
|
@@ -8813,6 +8850,7 @@ def test_ubsan_full_overflow(self, args): | |
'fsanitize_return': (['-fsanitize=return'],), | ||
}) | ||
@no_wasm2js('TODO: sanitizers in wasm2js') | ||
@no_esm_integration('sanitizers do not support WASM_ESM_INTEGRATION') | ||
def test_ubsan_full_no_return(self, args): | ||
self.emcc_args += ['-Wno-return-type'] + args | ||
self.do_runf('core/test_ubsan_full_no_return.cpp', | ||
|
@@ -8824,6 +8862,7 @@ def test_ubsan_full_no_return(self, args): | |
'fsanitize_shift': (['-fsanitize=shift'],), | ||
}) | ||
@no_wasm2js('TODO: sanitizers in wasm2js') | ||
@no_esm_integration('sanitizers do not support WASM_ESM_INTEGRATION') | ||
def test_ubsan_full_left_shift(self, args): | ||
self.emcc_args += args | ||
self.do_runf( | ||
|
@@ -8840,6 +8879,7 @@ def test_ubsan_full_left_shift(self, args): | |
'dylink': (['-fsanitize=null', '-sMAIN_MODULE=2'],), | ||
}) | ||
@no_wasm2js('TODO: sanitizers in wasm2js') | ||
@no_esm_integration('sanitizers do not support WASM_ESM_INTEGRATION') | ||
def test_ubsan_full_null_ref(self, args): | ||
if '-sMAIN_MODULE=2' in args: | ||
self.check_dylink() | ||
|
@@ -8856,6 +8896,7 @@ def test_ubsan_full_null_ref(self, args): | |
]) | ||
|
||
@no_wasm2js('TODO: sanitizers in wasm2js') | ||
@no_esm_integration('sanitizers do not support WASM_ESM_INTEGRATION') | ||
def test_sanitize_vptr(self): | ||
self.do_runf( | ||
'core/test_sanitize_vptr.cpp', | ||
|
@@ -8878,6 +8919,7 @@ def test_sanitize_vptr(self): | |
]), | ||
}) | ||
@no_wasm2js('TODO: sanitizers in wasm2js') | ||
@no_esm_integration('sanitizers do not support WASM_ESM_INTEGRATION') | ||
def test_ubsan_full_stack_trace(self, g_flag, expected_output): | ||
if g_flag == '-gsource-map': | ||
if self.is_wasm2js(): | ||
|
@@ -8892,6 +8934,7 @@ def test_ubsan_full_stack_trace(self, g_flag, expected_output): | |
assert_all=True, expected_output=expected_output) | ||
|
||
@no_wasm2js('TODO: sanitizers in wasm2js') | ||
@no_esm_integration('sanitizers do not support WASM_ESM_INTEGRATION') | ||
def test_ubsan_typeinfo_eq(self): | ||
# https://github.com/emscripten-core/emscripten/issues/13330 | ||
src = r''' | ||
|
@@ -8911,6 +8954,7 @@ def test_template_class_deduction(self): | |
self.do_core_test('test_template_class_deduction.cpp') | ||
|
||
@no_wasm2js('TODO: ASAN in wasm2js') | ||
@no_esm_integration('sanitizers do not support WASM_ESM_INTEGRATION') | ||
@no_safe_heap('asan does not work with SAFE_HEAP') | ||
@no_wasm64('TODO: ASAN in memory64') | ||
@no_2gb('asan doesnt support GLOBAL_BASE') | ||
|
@@ -8931,6 +8975,7 @@ def test_asan_no_error(self, name): | |
@no_safe_heap('asan does not work with SAFE_HEAP') | ||
@no_wasm64('TODO: ASAN in memory64') | ||
@no_2gb('asan doesnt support GLOBAL_BASE') | ||
@no_esm_integration('sanitizers do not support WASM_ESM_INTEGRATION') | ||
@parameterized({ | ||
'use_after_free_c': ('test_asan_use_after_free.c', [ | ||
'AddressSanitizer: heap-use-after-free on address', | ||
|
@@ -9004,6 +9049,7 @@ def test_asan(self, name, expected_output, cflags=None): | |
@no_wasm2js('TODO: ASAN in wasm2js') | ||
@no_wasm64('TODO: ASAN in memory64') | ||
@no_2gb('asan doesnt support GLOBAL_BASE') | ||
@no_esm_integration('sanitizers do not support WASM_ESM_INTEGRATION') | ||
def test_asan_js_stack_op(self): | ||
self.emcc_args.append('-fsanitize=address') | ||
self.set_setting('ALLOW_MEMORY_GROWTH') | ||
|
@@ -9015,6 +9061,7 @@ def test_asan_js_stack_op(self): | |
@no_wasm2js('TODO: ASAN in wasm2js') | ||
@no_wasm64('TODO: ASAN in memory64') | ||
@no_2gb('asan doesnt support GLOBAL_BASE') | ||
@no_esm_integration('sanitizers do not support WASM_ESM_INTEGRATION') | ||
def test_asan_api(self): | ||
self.emcc_args.append('-fsanitize=address') | ||
self.set_setting('INITIAL_MEMORY', '300mb') | ||
|
@@ -9024,6 +9071,7 @@ def test_asan_api(self): | |
@no_wasm2js('TODO: ASAN in wasm2js') | ||
@no_wasm64('TODO: ASAN in memory64') | ||
@no_2gb('asan doesnt support GLOBAL_BASE') | ||
@no_esm_integration('sanitizers do not support WASM_ESM_INTEGRATION') | ||
def test_asan_modularized_with_closure(self): | ||
# the bug is that createModule() returns undefined, instead of the | ||
# proper Promise object. | ||
|
@@ -9038,6 +9086,7 @@ def test_asan_modularized_with_closure(self): | |
|
||
@no_asan('SAFE_HEAP cannot be used with ASan') | ||
@no_2gb('asan doesnt support GLOBAL_BASE') | ||
@no_esm_integration('sanitizers do not support WASM_ESM_INTEGRATION') | ||
def test_safe_heap_user_js(self): | ||
self.set_setting('SAFE_HEAP') | ||
self.do_runf('core/test_safe_heap_user_js.c', | ||
|
@@ -9429,6 +9478,7 @@ def test_Module_dynamicLibraries(self, args): | |
|
||
# Tests the emscripten_get_exported_function() API. | ||
@also_with_minimal_runtime | ||
@no_esm_integration('depends on wasmExports') | ||
def test_get_exported_function(self): | ||
self.set_setting('ALLOW_TABLE_GROWTH') | ||
self.emcc_args += ['-lexports.js'] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need both the modularize-instance mode and the esm integration mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the time being I think it would be good. Maybe we can delete the former completely once this lands.