Skip to content

Commit ee520f0

Browse files
authored
[test] Existing AudioWorklet futex test moved to browser tests (now audio works) (#23719)
Now that the audio tests are running in CI (see #23665) this existing AudioWorklet/futex test can be moved from `interactive` to `browser`: https://github.com/emscripten-core/emscripten/blob/32832575e0d200afcccd1d892ff3555baf54bc83/test/webaudio/audioworklet_emscripten_futex_wake.cpp It's had the bare minimum to enable it to compile but is otherwise broken and therefore disabled. The issue is here #22962. A fix is [already done](https://github.com/cwoffenden/emscripten/tree/cw-audio-spinlock-fix) with more advanced lock tests, but needs this to land first to get things in the right order. To confirm the test is broken, comment out the `@disabled` in line 5518 and run with: ``` test/runner browser.test_audio_worklet_emscripten_futex_wake ``` It will fail with: ``` test.js:1003 Uncaught RuntimeError: Aborted(Assertion failed: emscripten_is_main_browser_thread(), at: /emsdk/emscripten/system/lib/pthread/emscripten_futex_wait.c,26,futex_wait_main_browser_thread) at abort (test.js:1003:11) at ___assert_fail (test.js:1945:7) at test.wasm:0x10a8 at test.wasm:0xf34 at test.wasm:0xa78 at WasmAudioWorkletProcessor.process (test.aw.js:113:34) ```
1 parent fc15522 commit ee520f0

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

test/test_browser.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5512,6 +5512,13 @@ def test_audio_worklet_stereo_io(self, args):
55125512
shutil.copy(test_file('webaudio/audio_files/emscripten-bass.mp3'), 'audio_files/')
55135513
self.btest_exit('webaudio/audioworklet_in_out_stereo.c', args=['-sAUDIO_WORKLET', '-sWASM_WORKERS', '-DBROWSER_TEST'] + args)
55145514

5515+
# Tests AudioWorklet with emscripten_futex_wake().
5516+
@requires_sound_hardware
5517+
@also_with_minimal_runtime
5518+
@disabled('https://github.com/emscripten-core/emscripten/issues/22962')
5519+
def test_audio_worklet_emscripten_futex_wake(self):
5520+
self.btest('webaudio/audioworklet_emscripten_futex_wake.cpp', expected='0', args=['-sAUDIO_WORKLET', '-sWASM_WORKERS', '-pthread', '-sPTHREAD_POOL_SIZE=2'])
5521+
55155522
def test_error_reporting(self):
55165523
# Test catching/reporting Error objects
55175524
create_file('post.js', 'throw new Error("oops");')

test/test_interactive.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -293,11 +293,6 @@ def test_audio_worklet(self):
293293
self.btest('webaudio/audioworklet.c', expected='0', args=['-sAUDIO_WORKLET', '-sWASM_WORKERS', '--preload-file', test_file('hello_world.c') + '@/'])
294294
self.btest('webaudio/audioworklet.c', expected='0', args=['-sAUDIO_WORKLET', '-sWASM_WORKERS', '-pthread'])
295295

296-
# Tests AudioWorklet with emscripten_futex_wake().
297-
@also_with_minimal_runtime
298-
def test_audio_worklet_emscripten_futex_wake(self):
299-
self.btest('webaudio/audioworklet_emscripten_futex_wake.cpp', expected='0', args=['-sAUDIO_WORKLET', '-sWASM_WORKERS', '-pthread', '-sPTHREAD_POOL_SIZE=2'])
300-
301296
# Tests a second AudioWorklet example: sine wave tone generator.
302297
def test_audio_worklet_tone_generator(self):
303298
self.btest('webaudio/audio_worklet_tone_generator.c', expected='0', args=['-sAUDIO_WORKLET', '-sWASM_WORKERS'])

test/webaudio/audioworklet_emscripten_futex_wake.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
int futexLocation = 0;
1414
int testSuccess = 0;
1515

16+
// Internal, found in 'system/lib/pthread/threading_internal.h'
17+
extern "C" int _emscripten_thread_supports_atomics_wait();
18+
1619
bool ProcessAudio(int numInputs, const AudioSampleFrame *inputs, int numOutputs, AudioSampleFrame *outputs, int numParams, const AudioParamFrame *params, void *userData) {
1720
int supportsAtomicWait = _emscripten_thread_supports_atomics_wait();
1821
printf("supportsAtomicWait: %d\n", supportsAtomicWait);

0 commit comments

Comments
 (0)