Skip to content
Open
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
19 changes: 19 additions & 0 deletions test/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it also not compatible with JSPI?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(if so, the JSPI variation can still run, and this skip pushed into the asyncify path)

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.

Expand Down
20 changes: 1 addition & 19 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
with_all_eh_sjlj,
with_all_fs,
with_all_sjlj,
with_asyncify_and_jspi,
with_env_modify,
)

Expand Down Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
with_all_eh_sjlj,
with_all_fs,
with_all_sjlj,
with_asyncify_and_jspi,
with_env_modify,
)

Expand Down Expand Up @@ -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')

Expand Down