Skip to content

Commit bbafe45

Browse files
authored
Fix wasm worker tests that use dynCall (#17377)
These tests use try/catch to detect errors but this meant they were slightly ignoring the missing `dynCall` export. Before: ``` Threw an exception like expected: ReferenceError: dynCall is not defined ``` After: ``` Threw an exception like expected: TypeError: Cannot read properties of undefined (reading 'postMessage') ``` Needed for #17369.
1 parent 90cb70e commit bbafe45

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tests/test_browser.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5174,12 +5174,18 @@ def test_wasm_worker_sleep(self):
51745174
# Tests emscripten_terminate_wasm_worker()
51755175
@also_with_minimal_runtime
51765176
def test_wasm_worker_terminate(self):
5177-
self.btest(test_file('wasm_worker/terminate_wasm_worker.c'), expected='0', args=['-sWASM_WORKERS'])
5177+
self.set_setting('WASM_WORKERS')
5178+
# Test uses the dynCall library function in its EM_ASM code
5179+
self.set_setting('DEFAULT_LIBRARY_FUNCS_TO_INCLUDE', ['$dynCall'])
5180+
self.btest(test_file('wasm_worker/terminate_wasm_worker.c'), expected='0')
51785181

51795182
# Tests emscripten_terminate_all_wasm_workers()
51805183
@also_with_minimal_runtime
51815184
def test_wasm_worker_terminate_all(self):
5182-
self.btest(test_file('wasm_worker/terminate_all_wasm_workers.c'), expected='0', args=['-sWASM_WORKERS'])
5185+
self.set_setting('WASM_WORKERS')
5186+
# Test uses the dynCall library function in its EM_ASM code
5187+
self.set_setting('DEFAULT_LIBRARY_FUNCS_TO_INCLUDE', ['$dynCall'])
5188+
self.btest(test_file('wasm_worker/terminate_all_wasm_workers.c'), expected='0')
51835189

51845190
# Tests emscripten_wasm_worker_post_function_*() API
51855191
@also_with_minimal_runtime
@@ -5260,8 +5266,12 @@ def test_wasm_worker_lock_busyspin_waitinf(self):
52605266
# Tests that proxied JS functions cannot be called from Wasm Workers
52615267
@also_with_minimal_runtime
52625268
def test_wasm_worker_no_proxied_js_functions(self):
5269+
self.set_setting('WASM_WORKERS')
5270+
self.set_setting('ASSERTIONS')
5271+
# Test uses the dynCall library function in its EM_ASM code
5272+
self.set_setting('DEFAULT_LIBRARY_FUNCS_TO_INCLUDE', ['$dynCall'])
52635273
self.btest(test_file('wasm_worker/no_proxied_js_functions.c'), expected='0',
5264-
args=['--js-library', test_file('wasm_worker/no_proxied_js_functions.js'), '-sWASM_WORKERS', '-sASSERTIONS'])
5274+
args=['--js-library', test_file('wasm_worker/no_proxied_js_functions.js')])
52655275

52665276
# Tests emscripten_semaphore_init(), emscripten_semaphore_waitinf_acquire() and emscripten_semaphore_release()
52675277
@also_with_minimal_runtime

0 commit comments

Comments
 (0)