@@ -161,20 +161,39 @@ def with_asyncify_and_jspi(f):
161161 assert callable (f )
162162
163163 @wraps (f )
164- def metafunc (self , jspi ):
164+ def metafunc (self , jspi , * args , ** kwargs ):
165165 if jspi :
166166 self .set_setting ('ASYNCIFY' , 2 )
167167 self .require_jspi ()
168- f (self )
169168 else :
170169 self .set_setting ('ASYNCIFY' )
171- f (self )
170+ f (self , * args , ** kwargs )
172171
173172 parameterize (metafunc , {'' : (False ,),
174173 'jspi' : (True ,)})
175174 return metafunc
176175
177176
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+
178197def no_optimize (note = '' ):
179198 assert not callable (note )
180199
@@ -3708,9 +3727,10 @@ def test_dlfcn_feature_in_lib(self):
37083727 self .do_run (src , 'float: 42.\n ' )
37093728
37103729 @needs_dylink
3730+ @with_asyncify_and_jspi
37113731 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' )
37143734 create_file ('liblib.c' , r'''
37153735 #include <stdio.h>
37163736 #include <emscripten/emscripten.h>
@@ -6364,12 +6384,8 @@ def test_mmap_anon_pthreads(self):
63646384 self .do_core_test ('test_mmap_anon.c' )
63656385
63666386 @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 ):
63736389 # uses register keyword
63746390 self .emcc_args += ['-std=c++03' , '-Wno-dynamic-class-memaccess' ]
63756391 self .maybe_closure ()
@@ -6378,14 +6394,7 @@ def test_cubescript(self, asyncify):
63786394 if '-fsanitize=address' in self .emcc_args :
63796395 self .emcc_args += ['--pre-js' , test_file ('asan-no-leak.js' )]
63806396
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 *' )
63896398
63906399 @needs_dylink
63916400 def test_relocatable_void_function (self ):
@@ -8045,16 +8054,13 @@ def test_async_ccall_good(self):
80458054 self .do_runf ('main.c' , 'HelloWorld' )
80468055
80478056 @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 ,),
80528059 })
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 :
80568063 self .set_setting ('JSPI_EXPORTS' , ['stringf' , 'floatf' ])
8057- self .set_setting ('ASYNCIFY' , asyncify )
80588064 self .set_setting ('ASSERTIONS' )
80598065 self .set_setting ('INVOKE_RUN' , 0 )
80608066 self .set_setting ('EXIT_RUNTIME' , exit_runtime )
0 commit comments