File tree 4 files changed +24
-6
lines changed
4 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -655,7 +655,9 @@ jobs:
655
655
other.test_native_call_before_init
656
656
other.test_node_unhandled_rejection
657
657
core2.test_hello_world
658
- core0.test_pthread_join_and_asyncify"
658
+ core0.test_pthread_join_and_asyncify
659
+ core0.test_async_ccall_promise_jspi
660
+ core0.test_async_ccall_promise_exit_runtime_jspi"
659
661
# Run some basic tests with the minimum version of node that we currently
660
662
# support.
661
663
- install-node-version :
Original file line number Diff line number Diff line change @@ -85,11 +85,14 @@ mergeInto(LibraryManager.library, {
85
85
if ( stack !== 0 ) stackRestore ( stack ) ;
86
86
return convertReturnValue ( ret ) ;
87
87
}
88
+ #if ASYNCIFY
89
+ var asyncMode = opts && opts . async ;
90
+ #endif
91
+
88
92
#if ASYNCIFY == 1
89
93
// Keep the runtime alive through all calls. Note that this call might not be
90
94
// async, but for simplicity we push and pop in all calls.
91
95
runtimeKeepalivePush ( ) ;
92
- var asyncMode = opts && opts . async ;
93
96
if ( Asyncify . currData != previousAsync ) {
94
97
#if ASSERTIONS
95
98
// A change in async operation happened. If there was already an async
@@ -111,6 +114,10 @@ mergeInto(LibraryManager.library, {
111
114
}
112
115
#endif
113
116
117
+ #if ASYNCIFY == 2
118
+ if ( asyncMode ) return ret . then ( onDone ) ;
119
+ #endif
120
+
114
121
ret = onDone ( ret ) ;
115
122
#if ASYNCIFY == 1
116
123
// If this is an async ccall, ensure we return a promise
Original file line number Diff line number Diff line change @@ -656,6 +656,9 @@ def require_wasm_eh(self):
656
656
self .fail ('either d8 or node >= 16 required to run wasm-eh tests. Use EMTEST_SKIP_EH to skip' )
657
657
658
658
def require_jspi (self ):
659
+ if not self .is_wasm ():
660
+ self .skipTest ('JSPI is not currently supported for WASM2JS' )
661
+
659
662
exp_args = ['--experimental-wasm-stack-switching' , '--experimental-wasm-type-reflection' ]
660
663
if config .NODE_JS and config .NODE_JS in self .js_engines :
661
664
version = shared .check_node_version ()
Original file line number Diff line number Diff line change @@ -8239,12 +8239,18 @@ def test_async_ccall_good(self):
8239
8239
self .do_runf ('main.c' , 'HelloWorld' )
8240
8240
8241
8241
@parameterized ({
8242
- '' : (False ,),
8243
- 'exit_runtime' : (True ,),
8242
+ 'asyncify' : (False , 1 ),
8243
+ 'exit_runtime_asyncify' : (True , 1 ),
8244
+ 'jspi' : (False , 2 ),
8245
+ 'exit_runtime_jspi' : (True , 2 ),
8244
8246
})
8245
8247
@no_wasm64 ('TODO: asyncify for wasm64' )
8246
- def test_async_ccall_promise (self , exit_runtime ):
8247
- self .set_setting ('ASYNCIFY' )
8248
+ def test_async_ccall_promise (self , exit_runtime , asyncify ):
8249
+ if asyncify == 2 :
8250
+ self .require_jspi ()
8251
+ self .emcc_args += ['-Wno-experimental' ]
8252
+ self .set_setting ('ASYNCIFY_EXPORTS' , ['stringf' , 'floatf' ])
8253
+ self .set_setting ('ASYNCIFY' , asyncify )
8248
8254
self .set_setting ('EXIT_RUNTIME' )
8249
8255
self .set_setting ('ASSERTIONS' )
8250
8256
self .set_setting ('INVOKE_RUN' , 0 )
You can’t perform that action at this time.
0 commit comments