Skip to content

Commit a39fc58

Browse files
authored
Run wasm_worker_futex_wait.c test in test_core.py. NFC (#26564)
This involves converting the test to btest_exit.
1 parent 8bb732b commit a39fc58

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

test/test_browser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5054,7 +5054,7 @@ def test_wasm_worker_hello_embedded(self):
50545054
'pthread': (['-pthread'],),
50555055
})
50565056
def test_wasm_worker_futex_wait(self, args):
5057-
self.btest('wasm_worker/wasm_worker_futex_wait.c', expected='0', cflags=['-sWASM_WORKERS=1', '-sASSERTIONS'] + args)
5057+
self.btest_exit('wasm_worker/wasm_worker_futex_wait.c', cflags=['-sWASM_WORKERS=1', '-sASSERTIONS'] + args)
50585058

50595059
# Tests Wasm Worker thread stack setup
50605060
@also_with_minimal_runtime

test/test_core.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9720,6 +9720,11 @@ def test_wasm_worker_malloc(self):
97209720
def test_wasm_worker_runtime_debug(self):
97219721
self.do_runf('wasm_worker/hello_wasm_worker.c', 'wasm worker starting ...', cflags=['-sWASM_WORKERS', '-sRUNTIME_DEBUG'])
97229722

9723+
@no_sanitize('sanitizers do not support WASM_WORKERS')
9724+
@no_esm_integration('WASM_ESM_INTEGRATION is not compatible with WASM_WORKERS')
9725+
def test_wasm_worker_futex_wait(self):
9726+
self.do_runf('wasm_worker/wasm_worker_futex_wait.c', cflags=['-sWASM_WORKERS'])
9727+
97239728
@no_sanitize('sanitizers do not support WASM_WORKERS')
97249729
@no_esm_integration('WASM_ESM_INTEGRATION is not compatible with WASM_WORKERS')
97259730
def test_wasm_worker_wait_async(self):

test/wasm_worker/wasm_worker_futex_wait.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212

1313
_Atomic uint32_t futex_value = 0;
1414

15+
void do_exit() {
16+
emscripten_out("do_exit");
17+
emscripten_terminate_all_wasm_workers();
18+
emscripten_force_exit(0);
19+
}
20+
1521
void wake_worker_after_delay(void *user_data) {
1622
futex_value = 1;
1723
emscripten_futex_wake(&futex_value, INT_MAX);
@@ -38,9 +44,7 @@ void worker_main() {
3844
assert(rc == 0);
3945
assert(futex_value == 1);
4046

41-
#ifdef REPORT_RESULT
42-
REPORT_RESULT(0);
43-
#endif
47+
emscripten_wasm_worker_post_function_v(EMSCRIPTEN_WASM_WORKER_ID_PARENT, do_exit);
4448
}
4549

4650
int main() {

0 commit comments

Comments
 (0)