diff --git a/test/common.py b/test/common.py index f2b59666c766..bb258b3238fa 100644 --- a/test/common.py +++ b/test/common.py @@ -472,7 +472,7 @@ def with_both_sjlj(f): def metafunc(self, is_native): if is_native: - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('wasm2js does not support wasm SjLj') self.require_wasm_eh() # FIXME Temporarily disabled. Enable this later when the bug is fixed. @@ -691,9 +691,7 @@ def is_2gb(self): return self.get_setting('INITIAL_MEMORY') == '2200mb' def check_dylink(self): - if self.get_setting('ALLOW_MEMORY_GROWTH') == 1 and not self.is_wasm(): - self.skipTest('no dynamic linking with memory growth (without wasm)') - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('no dynamic linking support in wasm2js yet') if '-fsanitize=undefined' in self.emcc_args: self.skipTest('no dynamic linking support in UBSan yet') @@ -804,7 +802,7 @@ def require_jspi(self): # warnings-as-errors, so disable that warning self.emcc_args += ['-Wno-experimental'] self.set_setting('ASYNCIFY', 2) - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('JSPI is not currently supported for WASM2JS') if self.is_browser_test(): @@ -850,14 +848,15 @@ def setup_node_pthreads(self): self.node_args += shared.node_pthread_flags(nodejs) def uses_memory_init_file(self): - if self.get_setting('SIDE_MODULE') or (self.is_wasm() and not self.get_setting('WASM2JS')): + if self.get_setting('SIDE_MODULE') or self.is_wasm(): return False - elif '--memory-init-file' in self.emcc_args: + + if '--memory-init-file' in self.emcc_args: return int(self.emcc_args[self.emcc_args.index('--memory-init-file') + 1]) - else: - # side modules handle memory differently; binaryen puts the memory in the wasm module - opt_supports = any(opt in self.emcc_args for opt in ('-O2', '-O3', '-Os', '-Oz')) - return opt_supports + + # side modules handle memory differently; binaryen puts the memory in the wasm module + opt_supports = any(opt in self.emcc_args for opt in ('-O2', '-O3', '-Os', '-Oz')) + return opt_supports def set_temp_dir(self, temp_dir): self.temp_dir = temp_dir diff --git a/test/test_browser.py b/test/test_browser.py index 0742152d2158..b1a015d048f3 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -3989,7 +3989,7 @@ def test_pthread_gcc_atomic_fetch_and_op(self, args): @no_4gb('https://github.com/emscripten-core/emscripten/issues/21318') @requires_threads def test_pthread_gcc_64bit_atomic_fetch_and_op(self): - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('https://github.com/WebAssembly/binaryen/issues/4358') self.emcc_args += ['-Wno-sync-fetch-and-nand-semantics-changed'] self.btest_exit('pthread/test_pthread_gcc_64bit_atomic_fetch_and_op.cpp', args=['-O3', '-pthread', '-sPTHREAD_POOL_SIZE=8']) @@ -4009,7 +4009,7 @@ def test_pthread_gcc_atomic_op_and_fetch(self): @no_4gb('https://github.com/emscripten-core/emscripten/issues/21318') @requires_threads def test_pthread_gcc_64bit_atomic_op_and_fetch(self): - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('https://github.com/WebAssembly/binaryen/issues/4358') self.emcc_args += ['-Wno-sync-fetch-and-nand-semantics-changed', '--profiling-funcs'] self.btest_exit('pthread/test_pthread_gcc_64bit_atomic_op_and_fetch.cpp', args=['-pthread', '-O2', '-sPTHREAD_POOL_SIZE=8']) diff --git a/test/test_core.py b/test/test_core.py index e4c717da4763..8711e968dcad 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -46,7 +46,7 @@ def decorated(self, *args, **kwargs): self.require_simd() if self.get_setting('MEMORY64') == 2: self.skipTest('https://github.com/WebAssembly/binaryen/issues/4638') - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('wasm2js only supports MVP for now') if '-O3' in self.emcc_args: self.skipTest('SIMD tests are too slow with -O3 in the new LLVM pass manager, https://github.com/emscripten-core/emscripten/issues/13427') @@ -62,7 +62,7 @@ def decorated(self): if self.get_setting('MEMORY64') == 2: self.skipTest('https://github.com/WebAssembly/binaryen/issues/4638') # We don't actually run any tests yet, so don't require any engines. - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('wasm2js only supports MVP for now') self.emcc_args.append('-mrelaxed-simd') f(self) @@ -71,7 +71,7 @@ def decorated(self): def needs_non_trapping_float_to_int(f): def decorated(self): - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('wasm2js only supports MVP for now') f(self) return decorated @@ -102,7 +102,7 @@ def with_both_eh_sjlj(f): def metafunc(self, is_native): if is_native: # Wasm EH is currently supported only in wasm backend and V8 - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('wasm2js does not support wasm EH/SjLj') self.require_wasm_eh() # FIXME Temporarily disabled. Enable this later when the bug is fixed. @@ -902,7 +902,7 @@ def test_longjmp_with_and_without_exceptions(self): # Wasm SjLj with and without Wasm EH support self.clear_setting('DISABLE_EXCEPTION_CATCHING') self.set_setting('SUPPORT_LONGJMP', 'wasm') - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('wasm2js does not support wasm EH/SjLj') self.require_wasm_eh() # FIXME Temporarily disabled. Enable this later when the bug is fixed. @@ -1037,7 +1037,7 @@ def test_exceptions_with_and_without_longjmp(self): self.do_run_in_out_file_test('core/test_exceptions.cpp', out_suffix='_caught') # Wasm EH with and without Wasm SjLj support self.clear_setting('DISABLE_EXCEPTION_CATCHING') - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('wasm2js does not support wasm EH/SjLj') self.require_wasm_eh() # FIXME Temporarily disabled. Enable this later when the bug is fixed. @@ -2028,7 +2028,7 @@ def test_memorygrowth(self): self.do_runf(src, '*pre: hello,4.955*\n*hello,4.955*\n*hello,4.955*') win = read_file('test_memorygrowth.js') - if '-O2' in self.emcc_args and not self.is_wasm(): + if '-O2' in self.emcc_args and self.is_wasm2js(): # Make sure ALLOW_MEMORY_GROWTH generates different code (should be less optimized) code_start = '// EMSCRIPTEN_START_FUNCS' self.assertContained(code_start, fail) @@ -2061,7 +2061,7 @@ def test_memorygrowth_2(self): self.do_runf(src, '*pre: hello,4.955*\n*hello,4.955*\n*hello,4.955*') win = read_file('test_memorygrowth_2.js') - if '-O2' in self.emcc_args and not self.is_wasm(): + if '-O2' in self.emcc_args and self.is_wasm2js(): # Make sure ALLOW_MEMORY_GROWTH generates different code (should be less optimized) assert len(fail) < len(win), 'failing code - without memory growth on - is more optimized, and smaller' + str([len(fail), len(win)]) @@ -2080,7 +2080,7 @@ def test_memorygrowth_3(self): def test_memorygrowth_MAXIMUM_MEMORY(self): if self.has_changed_setting('ALLOW_MEMORY_GROWTH'): self.skipTest('test needs to modify memory growth') - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('wasm memory specific test') # check that memory growth does not exceed the wasm mem max limit @@ -2092,7 +2092,7 @@ def test_memorygrowth_MAXIMUM_MEMORY(self): def test_memorygrowth_linear_step(self): if self.has_changed_setting('ALLOW_MEMORY_GROWTH'): self.skipTest('test needs to modify memory growth') - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('wasm memory specific test') # check that memory growth does not exceed the wasm mem max limit and is exactly or one step below the wasm mem max @@ -2105,7 +2105,7 @@ def test_memorygrowth_linear_step(self): def test_memorygrowth_geometric_step(self): if self.has_changed_setting('ALLOW_MEMORY_GROWTH'): self.skipTest('test needs to modify memory growth') - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('wasm memory specific test') self.emcc_args += ['-sALLOW_MEMORY_GROWTH', '-sMEMORY_GROWTH_GEOMETRIC_STEP=8.5', '-sMEMORY_GROWTH_GEOMETRIC_CAP=32MB'] @@ -4030,8 +4030,6 @@ def test_dylink_no_export(self): @needs_dylink def test_dylink_memory_growth(self): - if not self.is_wasm(): - self.skipTest('wasm only') self.set_setting('ALLOW_MEMORY_GROWTH') self.do_basic_dylink_test() @@ -4884,7 +4882,7 @@ def test_dylink_hyper_dupe(self): ''', expected=['sidef: 10, sideg: 20.\nbsidef: 536.\nonly_in_second_0: 10, 20, 1337\nonly_in_third_1: 36, 49, 500, 1221\nonly_in_third_0: 36, 49, 500\nonly_in_second_1: 10, 20, 1337, 2112\n'], # in wasm, we can't flip as the side would have an EM_ASM, which we don't support yet TODO - need_reverse=not self.is_wasm()) + need_reverse=self.is_wasm2js()) print('check warnings') full = self.run_js('src.js') @@ -4927,7 +4925,7 @@ def test_dylink_load_compiled_side_module(self): ''', expected=['sidef: 10'], # in wasm, we can't flip as the side would have an EM_ASM, which we don't support yet TODO - need_reverse=not self.is_wasm()) + need_reverse=self.is_wasm2js()) @needs_dylink def test_dylink_dso_needed(self): @@ -5363,7 +5361,7 @@ def test_langinfo(self): def test_files(self): # Use closure here, to test we don't break FS stuff - if '-O3' in self.emcc_args and not self.is_wasm(): + if '-O3' in self.emcc_args and self.is_wasm2js(): print('closure 2') self.emcc_args += ['--closure', '2'] # Use closure 2 here for some additional coverage # Sadly --closure=2 is not yet free of closure warnings @@ -6204,7 +6202,7 @@ def test_iostream_and_determinism(self): shutil.copy2('src.js', 'src.js.previous') # Same but for the wasm file. - if self.is_wasm() and not self.get_setting('WASM2JS'): + if self.is_wasm(): if os.path.exists('src.wasm.previous'): self.assertBinaryEqual('src.wasm', 'src.wasm.previous') shutil.copy2('src.wasm', 'src.wasm.previous') @@ -7730,7 +7728,7 @@ def test_source_map(self, args): self.emcc(os.path.abspath('src.cpp'), self.get_emcc_args(), out_filename) - map_referent = out_filename if not self.is_wasm() else wasm_filename + map_referent = out_filename if self.is_wasm2js() else wasm_filename # after removing the @line and @sourceMappingURL comments, the build # result should be identical to the non-source-mapped debug version. # this is worth checking because the parser AST swaps strings for token @@ -7908,7 +7906,7 @@ def test_modularize_closure_pre(self): # test that the combination of modularize + closure + pre-js works. in that mode, # closure should not minify the Module object in a way that the pre-js cannot use it. create_file('post.js', 'var TheModule = Module();\n') - if not self.is_wasm(): + if self.is_wasm2js(): # TODO(sbc): Fix closure warnings with MODULARIZE + WASM=0 self.ldflags.append('-Wno-error=closure') @@ -8396,7 +8394,7 @@ def verify_broken(args): @no_sanitize('no wasm2js support yet in sanitizers') @requires_wasm2js def test_wasm2js(self): - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('redundant to test wasm2js in wasm2js* mode') self.set_setting('WASM', 0) self.do_core_test('test_hello_world.c') @@ -8412,7 +8410,7 @@ def test_wasm2js(self): @no_sanitize('no wasm2js support yet in sanitizers') @requires_wasm2js def test_maybe_wasm2js(self): - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('redundant to test wasm2js in wasm2js* mode') self.set_setting('MAYBE_WASM2JS') # see that running as wasm works @@ -8434,7 +8432,7 @@ def test_maybe_wasm2js(self): 'minimal_runtime': (['-sMINIMAL_RUNTIME'],), }) def test_wasm2js_fallback(self, args): - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('redundant to test wasm2js in wasm2js* mode') cmd = [EMCC, test_file('small_hello_world.c'), '-sWASM=2'] + args @@ -8736,7 +8734,7 @@ def test_return_address(self): @no_lsan('-fsanitize-minimal-runtime cannot be used with LSan') def test_ubsan_minimal_too_many_errors(self): self.emcc_args += ['-fsanitize=undefined', '-fsanitize-minimal-runtime'] - if not self.is_wasm(): + if self.is_wasm2js(): if self.is_optimizing(): self.skipTest('test can only be run without optimizations on asm.js') # Need to use `-g` to get proper line numbers in asm.js @@ -8750,10 +8748,10 @@ def test_ubsan_minimal_too_many_errors(self): @no_lsan('-fsanitize-minimal-runtime cannot be used with LSan') def test_ubsan_minimal_errors_same_place(self): self.emcc_args += ['-fsanitize=undefined', '-fsanitize-minimal-runtime'] - if not self.is_wasm(): + if self.is_wasm2js(): if self.is_optimizing(): - self.skipTest('test can only be run without optimizations on asm.js') - # Need to use `-g` to get proper line numbers in asm.js + self.skipTest('test can only be run without optimizations under wasm2js') + # Need to use `-g` to get proper line numbers in wasm2js self.emcc_args += ['-g'] self.do_runf('core/test_ubsan_minimal_errors_same_place.c', expected_output='ubsan: add-overflow by 0x[0-9a-z]*\n' * 5, @@ -8851,7 +8849,7 @@ def test_ubsan_full_static_cast(self, args): @no_wasm2js('TODO: sanitizers in wasm2js') def test_ubsan_full_stack_trace(self, g_flag, expected_output): if g_flag == '-gsource-map': - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('wasm2js has no source map support') elif self.get_setting('EVAL_CTORS'): self.skipTest('EVAL_CTORS does not support source maps') @@ -8963,7 +8961,7 @@ def test_asan(self, name, expected_output, cflags=None): if '-Oz' in self.emcc_args: self.skipTest('-Oz breaks source maps') - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('wasm2js has no ASan support') self.emcc_args.append('-fsanitize=address') diff --git a/test/test_other.py b/test/test_other.py index 30f3971760f3..87609b0cd80f 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -9655,7 +9655,7 @@ def test_EM_ASM_ES6(self, args): self.do_runf('src.c', 'hello!', emcc_args=args) def test_check_sourcemapurl(self): - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('only supported with wasm') self.run_process([EMCC, test_file('hello_123.c'), '-gsource-map', '-o', 'a.js', '--source-map-base', 'dir/']) output = read_binary('a.wasm') @@ -9681,7 +9681,7 @@ def test_check_source_map_args(self): 'profiling': ['--profiling'] # -gsource-map --profiling should still emit a source map; see #8584 }) def test_check_sourcemapurl_default(self, *args): - if not self.is_wasm(): + if self.is_wasm2js(): self.skipTest('only supported with wasm') self.run_process([EMCC, test_file('hello_123.c'), '-gsource-map', '-o', 'a.js'] + list(args))