Skip to content

Unify also_with_wasmfs decorator. NFC #22357

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

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,23 @@ def modified(self, *args, **kwargs):
return decorated


def also_with_wasmfs(f):
assert callable(f)

@wraps(f)
def metafunc(self, wasmfs, *args, **kwargs):
if wasmfs:
self.set_setting('WASMFS')
self.emcc_args.append('-DWASMFS')
f(self, *args, **kwargs)
else:
f(self, *args, **kwargs)

parameterize(metafunc, {'': (False,),
'wasmfs': (True,)})
return metafunc


def also_with_noderawfs(func):
assert callable(func)

Expand Down
18 changes: 2 additions & 16 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
from common import skip_if, no_windows, no_mac, is_slow_test, parameterized, parameterize
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_wasm2js, requires_node_canary
from common import compiler_for, crossplatform, no_4gb, no_2gb, also_with_minimal_runtime, also_with_noderawfs
from common import compiler_for, crossplatform, no_4gb, no_2gb, also_with_minimal_runtime
from common import also_with_noderawfs, also_with_wasmfs
from common import with_all_eh_sjlj, with_all_sjlj, also_with_standalone_wasm, can_do_standalone, no_wasm64, requires_wasm_exnref
from common import NON_ZERO, WEBIDL_BINDER, EMBUILDER, PYTHON
import clang_native
Expand Down Expand Up @@ -148,21 +149,6 @@ def decorated(f):
return decorated


def also_with_wasmfs(func):
def decorated(self):
func(self)
if self.get_setting('WASMFS'):
# Nothing more to test.
return
print('wasmfs')
if self.get_setting('STANDALONE_WASM'):
self.skipTest("test currently cannot run both with WASMFS and STANDALONE_WASM")
self.set_setting('WASMFS')
self.emcc_args = self.emcc_args.copy() + ['-DWASMFS']
func(self)
return decorated


# Similar to also_with_wasmfs, but also enables the full JS API
def also_with_wasmfs_js(func):
def decorated(self):
Expand Down
19 changes: 1 addition & 18 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from common import create_file, parameterized, NON_ZERO, node_pthreads, TEST_ROOT, test_file
from common import compiler_for, EMBUILDER, requires_v8, requires_node, requires_wasm64, requires_node_canary
from common import requires_wasm_exnref, crossplatform, with_all_eh_sjlj, with_all_sjlj
from common import also_with_standalone_wasm, also_with_wasm2js, also_with_noderawfs
from common import also_with_standalone_wasm, also_with_wasm2js, also_with_noderawfs, also_with_wasmfs
from common import also_with_minimal_runtime, also_with_wasm_bigint, also_with_wasm64, flaky
from common import EMTEST_BUILD_VERBOSE, PYTHON, WEBIDL_BINDER
from common import requires_network, parameterize
Expand Down Expand Up @@ -110,23 +110,6 @@ def with_both_compilers(f):
return f


def also_with_wasmfs(f):
assert callable(f)

@wraps(f)
def metafunc(self, wasmfs, *args, **kwargs):
if wasmfs:
self.set_setting('WASMFS')
self.emcc_args.append('-DWASMFS')
f(self, *args, **kwargs)
else:
f(self, *args, **kwargs)

parameterize(metafunc, {'': (False,),
'wasmfs': (True,)})
return metafunc


def wasmfs_all_backends(f):
def metafunc(self, backend):
self.set_setting('WASMFS')
Expand Down
Loading