From 92bd45b8fb32dee47a41d40d9c4bff948585f9e5 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Mon, 12 Jan 2026 14:56:47 -0800 Subject: [PATCH] Run `test_pthread_asyncify` with both JSPI and ASYNCIFY. NFC --- test/decorators.py | 19 +++++++++++++++++++ test/test_core.py | 20 +------------------- test/test_other.py | 3 ++- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/test/decorators.py b/test/decorators.py index 11984fc12fb51..345b7f33d32ee 100644 --- a/test/decorators.py +++ b/test/decorators.py @@ -582,6 +582,25 @@ def metafunc(self, mode, *args, **kwargs): return metafunc +def with_asyncify_and_jspi(func): + assert callable(func) + + @wraps(func) + 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('JSPI') + self.require_jspi() + else: + self.set_setting('ASYNCIFY') + return func(self, *args, **kwargs) + + parameterize(metafunc, {'': (False,), + 'jspi': (True,)}) + return metafunc + + def parameterize(func, parameters): """Add additional parameterization to a test function. diff --git a/test/test_core.py b/test/test_core.py index 5c36655bb2e07..82dc5bbaaa2fa 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -68,6 +68,7 @@ with_all_eh_sjlj, with_all_fs, with_all_sjlj, + with_asyncify_and_jspi, with_env_modify, ) @@ -248,25 +249,6 @@ def decorated(self, dylink_reversed, *args, **kwargs): only_wasm2js = skip_if('only_wasm2js', lambda t: not t.is_wasm2js()) -def with_asyncify_and_jspi(func): - assert callable(func) - - @wraps(func) - 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('JSPI') - self.require_jspi() - else: - self.set_setting('ASYNCIFY') - return func(self, *args, **kwargs) - - parameterize(metafunc, {'': (False,), - 'jspi': (True,)}) - return metafunc - - def also_with_asyncify_and_jspi(func): assert callable(func) diff --git a/test/test_other.py b/test/test_other.py index 9ce6ccd84783e..26b642eb5015f 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -85,6 +85,7 @@ with_all_eh_sjlj, with_all_fs, with_all_sjlj, + with_asyncify_and_jspi, with_env_modify, ) @@ -11585,11 +11586,11 @@ def test_proxy_pthread_join_detach(self): self.do_other_test('test_pthread_self_join_detach.c') @node_pthreads + @with_asyncify_and_jspi def test_pthread_asyncify(self): # We had a infinite recursion bug when enabling PTHREADS_DEBUG + ASYNCIFY. # This was because PTHREADS_DEBUG calls back into WebAssembly for each call to `err()`. self.set_setting('PTHREADS_DEBUG') - self.set_setting('ASYNCIFY') self.set_setting('PTHREAD_POOL_SIZE', 2) self.do_other_test('test_pthread_asyncify.c')