@@ -161,20 +161,39 @@ def with_asyncify_and_jspi(f):
161
161
assert callable (f )
162
162
163
163
@wraps (f )
164
- def metafunc (self , jspi ):
164
+ def metafunc (self , jspi , * args , ** kwargs ):
165
165
if jspi :
166
166
self .set_setting ('ASYNCIFY' , 2 )
167
167
self .require_jspi ()
168
- f (self )
169
168
else :
170
169
self .set_setting ('ASYNCIFY' )
171
- f (self )
170
+ f (self , * args , ** kwargs )
172
171
173
172
parameterize (metafunc , {'' : (False ,),
174
173
'jspi' : (True ,)})
175
174
return metafunc
176
175
177
176
177
+ def also_with_asyncify_and_jspi (f ):
178
+ assert callable (f )
179
+
180
+ @wraps (f )
181
+ def metafunc (self , asyncify , * args , ** kwargs ):
182
+ if asyncify == 2 :
183
+ self .set_setting ('ASYNCIFY' , 2 )
184
+ self .require_jspi ()
185
+ elif asyncify == 1 :
186
+ self .set_setting ('ASYNCIFY' )
187
+ else :
188
+ assert asyncify == 0
189
+ f (self , * args , ** kwargs )
190
+
191
+ parameterize (metafunc , {'' : (0 ,),
192
+ 'asyncify' : (1 ,),
193
+ 'jspi' : (2 ,)})
194
+ return metafunc
195
+
196
+
178
197
def no_optimize (note = '' ):
179
198
assert not callable (note )
180
199
@@ -3708,9 +3727,10 @@ def test_dlfcn_feature_in_lib(self):
3708
3727
self .do_run (src , 'float: 42.\n ' )
3709
3728
3710
3729
@needs_dylink
3730
+ @with_asyncify_and_jspi
3711
3731
def test_dlfcn_asyncify (self ):
3712
- self .set_setting ( 'ASYNCIFY' )
3713
-
3732
+ if self .is_wasm64 () and self . get_setting ( 'ASYNCIFY' ) == 2 :
3733
+ self . skipTest ( 'https://github.com/emscripten-core/emscripten/issues/23585' )
3714
3734
create_file ('liblib.c' , r'''
3715
3735
#include <stdio.h>
3716
3736
#include <emscripten/emscripten.h>
@@ -6364,12 +6384,8 @@ def test_mmap_anon_pthreads(self):
6364
6384
self .do_core_test ('test_mmap_anon.c' )
6365
6385
6366
6386
@no_lsan ('Test code contains memory leaks' )
6367
- @parameterized ({
6368
- '' : (0 ,),
6369
- 'asyncify' : (1 ,),
6370
- 'jspi' : (2 ,),
6371
- })
6372
- def test_cubescript (self , asyncify ):
6387
+ @also_with_asyncify_and_jspi
6388
+ def test_cubescript (self ):
6373
6389
# uses register keyword
6374
6390
self .emcc_args += ['-std=c++03' , '-Wno-dynamic-class-memaccess' ]
6375
6391
self .maybe_closure ()
@@ -6378,14 +6394,7 @@ def test_cubescript(self, asyncify):
6378
6394
if '-fsanitize=address' in self .emcc_args :
6379
6395
self .emcc_args += ['--pre-js' , test_file ('asan-no-leak.js' )]
6380
6396
6381
- if asyncify :
6382
- self .set_setting ('ASYNCIFY' , asyncify )
6383
- if asyncify == 2 :
6384
- self .require_jspi ()
6385
- self .emcc_args += ['-Wno-experimental' ]
6386
-
6387
- src = test_file ('third_party/cubescript/command.cpp' )
6388
- self .do_runf (src , '*\n Temp is 33\n 9\n 5\n hello, everyone\n *' )
6397
+ self .do_runf ('third_party/cubescript/command.cpp' , '*\n Temp is 33\n 9\n 5\n hello, everyone\n *' )
6389
6398
6390
6399
@needs_dylink
6391
6400
def test_relocatable_void_function (self ):
@@ -8045,16 +8054,13 @@ def test_async_ccall_good(self):
8045
8054
self .do_runf ('main.c' , 'HelloWorld' )
8046
8055
8047
8056
@parameterized ({
8048
- 'asyncify' : (False , 1 ),
8049
- 'exit_runtime_asyncify' : (True , 1 ),
8050
- 'jspi' : (False , 2 ),
8051
- 'exit_runtime_jspi' : (True , 2 ),
8057
+ '' : (False ,),
8058
+ 'exit_runtime' : (True ,),
8052
8059
})
8053
- def test_async_ccall_promise ( self , exit_runtime , asyncify ):
8054
- if asyncify == 2 :
8055
- self .require_jspi ()
8060
+ @ with_asyncify_and_jspi
8061
+ def test_async_ccall_promise ( self , exit_runtime ) :
8062
+ if self .get_setting ( 'ASYNCIFY' ) == 2 :
8056
8063
self .set_setting ('JSPI_EXPORTS' , ['stringf' , 'floatf' ])
8057
- self .set_setting ('ASYNCIFY' , asyncify )
8058
8064
self .set_setting ('ASSERTIONS' )
8059
8065
self .set_setting ('INVOKE_RUN' , 0 )
8060
8066
self .set_setting ('EXIT_RUNTIME' , exit_runtime )
0 commit comments