File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -571,6 +571,28 @@ def require_wasm_eh(self):
571
571
else :
572
572
self .fail ('either d8 or node >= 16 required to run wasm-eh tests. Use EMTEST_SKIP_EH to skip' )
573
573
574
+ def require_jspi (self ):
575
+ exp_args = ['--experimental-wasm-stack-switching' , '--experimental-wasm-type-reflection' ]
576
+ if config .NODE_JS and config .NODE_JS in self .js_engines :
577
+ version = shared .check_node_version ()
578
+ # Support for JSPI came earlier than 19, but 19 is what currently works
579
+ # with emscripten's implementation.
580
+ if version >= (19 , 0 , 0 ):
581
+ self .js_engines = [config .NODE_JS ]
582
+ self .node_args += exp_args
583
+ return
584
+
585
+ if config .V8_ENGINE and config .V8_ENGINE in self .js_engines :
586
+ self .emcc_args .append ('-sENVIRONMENT=shell' )
587
+ self .js_engines = [config .V8_ENGINE ]
588
+ self .v8_args += exp_args
589
+ return
590
+
591
+ if 'EMTEST_SKIP_JSPI' in os .environ :
592
+ self .skipTest ('test requires node >= 19 or d8 (and EMTEST_SKIP_JSPI is set)' )
593
+ else :
594
+ self .fail ('either d8 or node >= 19 required to run JSPI tests. Use EMTEST_SKIP_JSPI to skip' )
595
+
574
596
def setup_node_pthreads (self ):
575
597
self .require_node ()
576
598
self .emcc_args += ['-Wno-pthreads-mem-growth' , '-pthread' ]
Original file line number Diff line number Diff line change @@ -230,10 +230,7 @@ def with_asyncify_and_stack_switching(f):
230
230
def metafunc (self , stack_switching ):
231
231
if stack_switching :
232
232
self .set_setting ('ASYNCIFY' , 2 )
233
- self .require_v8 ()
234
- # enable stack switching and other relevant features (like reference types
235
- # for the return value of externref)
236
- self .v8_args .append ('--experimental-wasm-stack-switching' )
233
+ self .require_jspi ()
237
234
if not self .is_wasm ():
238
235
self .skipTest ('wasm2js does not support WebAssembly.Suspender yet' )
239
236
# emcc warns about stack switching being experimental, and we build with
You can’t perform that action at this time.
0 commit comments