Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Enable audio tests on Chrome and Firefox #23665

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

cwoffenden
Copy link
Contributor

@cwoffenden cwoffenden commented Feb 13, 2025

Work-in-progress for #23131.

Confirmed that they're failing, now adding @requires_sound_hardware and retesting. Working as expected after retesting, I'll propagate the changes to the other AW tests (and move to btest_exit in the process). The current failures are unrelated (interestingly, if I test early morning CET I don't get this level of flakiness, it's very much an afternoon thing).

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Does the test pass locally for you now?

@cwoffenden
Copy link
Contributor Author

Does the test pass locally for you now?

Yes, running with the browser flags documented earlier (or having interaction). I'll test all of the parameterised tests tomorrow, I didn't check all variants. MEMORY64 will fail without one of my other PRs, so I'll comment that one out for the time being.

@cwoffenden
Copy link
Contributor Author

cwoffenden commented Feb 14, 2025

Does the test pass locally for you now?

Now checked, and yes, all the parameterised test_audio_worklet tests apart from the _memory64 variant work locally (and now with added asserts that one fails early instead of timing out).

I'll work my way through the other browser tests next week now. It would be useful to have #23659 merged (which doesn't affect anything other than my code) so I can move all the browser audio tests to use the same pattern.

One question, does EMTEST_LACKS_SOUND_HARDWARE signify that the test runner actually lacks audio hardware or that the audio won't run because of the interactive requirement? EDIT: the running VMs lack sound support.

EMTEST_LACKS_SOUND_HARDWARE: "1"

I removed @requires_sound_hardware and added the required flags for Chrome and FF. I'll check the results of the logs.

EDIT: answering myself, it looks like there's no virtualised audio, given the assert:

https://app.circleci.com/pipelines/github/emscripten-core/emscripten/40519/workflows/41693480-35f3-44b1-8348-a29330847654/jobs/899772?invite=true#step-108-391780_124

I'll add code to enumerate the hardware (if JS allows this).

More notes:

  • Multiple attempts at enabling Debian's dummy sound device with modprobe failed. ❌
  • Chrome's source has a FakeAudioOutputStream, so I'm hoping--use-fake-device-for-media-stream enables it. ✅
  • Firefox also has a fake audio device.

@cwoffenden
Copy link
Contributor Author

cwoffenden commented Feb 14, 2025

The latest flags for Chrome I tried appear to work, with the AW tests for regular Chrome passing:

https://app.circleci.com/pipelines/github/emscripten-core/emscripten/40523/workflows/bca5a785-e04e-4bf1-8187-01a87982d059/jobs/899865?invite=true#step-108-24450_168

For Firefox it's failing as expected since I've not added its fake audio flags (media.navigator.streams.fake from what I can make out), and the wasm64/2GB tests are failing (needing my MEMORY64 PR).

command: |
export EMTEST_BROWSER="/usr/bin/google-chrome $CHROME_FLAGS_BASE $CHROME_FLAGS_HEADLESS $CHROME_FLAGS_WASM $CHROME_FLAGS_NOCACHE"
export EMTEST_BROWSER="/usr/bin/google-chrome $CHROME_FLAGS_BASE $CHROME_FLAGS_HEADLESS $CHROME_FLAGS_WASM $CHROME_FLAGS_NOCACHE $CHROME_FLAGS_AUDIO"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we make this change should we also remove the EMTEST_LACKS_SOUND_HARDWARE setting above?

I'm kind of inclined to make this change as its one separate PR, e.g. [CI] Enable audio testing on chrome?

Copy link
Contributor Author

@cwoffenden cwoffenden Feb 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't have much time today so it was mostly experimenting and coming back to it, but:

  • I'll remove theEMTEST_LACKS_SOUND_HARDWARE
  • I'll rename to match its new purpose (I wasn't sure what I'd achieve when starting) ✅
  • I'll disable all the wasm64 and 2GB tests with audio for now

Is it fine to always enable the dummy sound hardware and bypass the media interaction? I can't think what this would break (and where real sound hardware is present its used as a preference, at least from my manual testing).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine enabling dummy sounds hardware and bypass the interaction check should be fine for all out tests..

@cwoffenden cwoffenden changed the title [AUDIO_WORKLET] Tests no longer silently fail [CI] Enable audio tests on Chrome and Firefox Feb 15, 2025
@cwoffenden
Copy link
Contributor Author

cwoffenden commented Feb 15, 2025

Hmm, FF still broken. To do:

  • look at media.audio_loopback_dev
  • EMTEST_LACKS_SOUND_HARDWARE for FF
  • (Set up a local VM with no sound hardware)

#ifdef TEST_AND_EXIT
// We're in the test harness and exiting is via main_thread_tls_access()
emscripten_exit_with_live_runtime();
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking or a separate PR to enable audio testing CI.

PR1: enable audio testing in CI
PR2: fix audio worklet test so they fail correctly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, NP. I’ll see how I get on with FF on Monday but I might split it for Chrome first too (I set up a VM with the same Debian and FF and so far, even with no audio device, it doesn’t fail; left to try is headless).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants