From 06561ee979de4fbdacd12d3ca87bc0b659b386da Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 30 Nov 2023 17:12:49 -0800 Subject: [PATCH] Run some more tests in browser64_4gb. NFC (#20816) --- .circleci/config.yml | 1 + test/common.py | 31 +++++++++++++++++++++++++++++++ test/test_browser.py | 5 ++++- test/test_core.py | 34 ++-------------------------------- 4 files changed, 38 insertions(+), 33 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 102191a18d030..6a33d44faea4b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -802,6 +802,7 @@ jobs: test_targets: " browser64 skip:browser64.test_4gb_fail + browser64_4gb.test_async_* browser64_4gb.test_emscripten_log " test-browser-firefox: diff --git a/test/common.py b/test/common.py index f9d32611a3c36..b4cf512dec26c 100644 --- a/test/common.py +++ b/test/common.py @@ -199,6 +199,37 @@ def decorated(f): return decorated +def no_2gb(note): + assert not callable(note) + + def decorator(f): + assert callable(f) + + @wraps(f) + def decorated(self, *args, **kwargs): + # 2200mb is the value used by the core_2gb test mode + if self.get_setting('INITIAL_MEMORY') == '2200mb': + self.skipTest(note) + f(self, *args, **kwargs) + return decorated + return decorator + + +def no_4gb(note): + assert not callable(note) + + def decorator(f): + assert callable(f) + + @wraps(f) + def decorated(self, *args, **kwargs): + if self.get_setting('INITIAL_MEMORY') == '4200mb': + self.skipTest(note) + f(self, *args, **kwargs) + return decorated + return decorator + + def only_windows(note=''): assert not callable(note) if not WINDOWS: diff --git a/test/test_browser.py b/test/test_browser.py index 422f33d0bb208..5d33c42e50f7a 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -23,7 +23,7 @@ from common import BrowserCore, RunnerCore, path_from_root, has_browser, EMTEST_BROWSER, Reporting from common import create_file, parameterized, ensure_dir, disabled, test_file, WEBIDL_BINDER -from common import read_file, also_with_minimal_runtime, EMRUN, no_wasm64 +from common import read_file, also_with_minimal_runtime, EMRUN, no_wasm64, no_4gb from tools import shared from tools import ports from tools import utils @@ -5559,6 +5559,7 @@ def test_wasm_worker_proxied_function(self): self.btest('wasm_worker/proxied_function.c', expected='0', args=['--js-library', test_file('wasm_worker/proxied_function.js'), '-sWASM_WORKERS', '-sASSERTIONS=0']) @no_firefox('no 4GB support yet') + @no_4gb('uses MAXIMUM_MEMORY') def test_4gb(self): # TODO Convert to an actual browser test when it reaches stable. # For now, keep this in browser as this suite runs serially, which @@ -5654,6 +5655,7 @@ def test_emmalloc_memgrowth(self, *args): self.btest('emmalloc_memgrowth.cpp', expected='0', args=['-sMALLOC=emmalloc', '-sALLOW_MEMORY_GROWTH=1', '-sABORTING_MALLOC=0', '-sASSERTIONS=2', '-sMINIMAL_RUNTIME=1', '-sMAXIMUM_MEMORY=4GB']) @no_firefox('no 4GB support yet') + @no_4gb('uses MAXIMUM_MEMORY') def test_2gb_fail(self): # TODO Convert to an actual browser test when it reaches stable. # For now, keep this in browser as this suite runs serially, which @@ -5667,6 +5669,7 @@ def test_2gb_fail(self): self.do_run_in_out_file_test('browser/test_2GB_fail.cpp') @no_firefox('no 4GB support yet') + @no_4gb('uses MAXIMUM_MEMORY') def test_4gb_fail(self): # TODO Convert to an actual browser test when it reaches stable. # For now, keep this in browser as this suite runs serially, which diff --git a/test/test_core.py b/test/test_core.py index 012c77ac7d614..17ee0b21fb67c 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -27,7 +27,8 @@ from common import RunnerCore, path_from_root, requires_native_clang, test_file, create_file from common import skip_if, needs_dylink, no_windows, no_mac, is_slow_test, parameterized from common import env_modify, with_env_modify, disabled, flaky, node_pthreads, also_with_wasm_bigint -from common import read_file, read_binary, requires_v8, requires_node, requires_node_canary, compiler_for, crossplatform +from common import read_file, read_binary, requires_v8, requires_node, requires_node_canary +from common import compiler_for, crossplatform, no_4gb, no_2gb from common import with_both_sjlj, also_with_standalone_wasm, can_do_standalone, no_wasm64 from common import NON_ZERO, WEBIDL_BINDER, EMBUILDER, PYTHON import clang_native @@ -258,37 +259,6 @@ def decorated(self, *args, **kwargs): return decorator -def no_4gb(note): - assert not callable(note) - - def decorator(f): - assert callable(f) - - @wraps(f) - def decorated(self, *args, **kwargs): - if self.get_setting('INITIAL_MEMORY') == '4200mb': - self.skipTest(note) - f(self, *args, **kwargs) - return decorated - return decorator - - -def no_2gb(note): - assert not callable(note) - - def decorator(f): - assert callable(f) - - @wraps(f) - def decorated(self, *args, **kwargs): - # 2200mb is the value used by the core_2gb test mode - if self.get_setting('INITIAL_MEMORY') == '2200mb': - self.skipTest(note) - f(self, *args, **kwargs) - return decorated - return decorator - - def no_ubsan(note): assert not callable(note)