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

[test] Add audio worklet parameter tests (and tidy other interactive tests) #23659

Merged
merged 5 commits into from
Feb 21, 2025

Conversation

cwoffenden
Copy link
Contributor

@cwoffenden cwoffenden commented Feb 12, 2025

This is splits out the test changes from #23508 adding an interactive parameter test:

test/runner interactive.test_audio_worklet_params_mixing

This test is also added to the browser tests now #23665 has merged, offering a single test that touches all the various structs and their offsets. When run as part of the browser tests it plays for 1 second, for interactive without the TEST_AND_EXIT macro it will play continuously.

It also tidies a little the shared code (and related tests) in the process. Interactive tests had _2gb and _4gb options added (which will fail until #23508 lands, but they're not part of the CI). All features of these tests as interactive now work fully on Chrome, Firefox and Safari (Safari has issues with looping, but it doesn't affect the spirit of the test).

cwoffenden added a commit to cwoffenden/emscripten that referenced this pull request Feb 12, 2025
@cwoffenden cwoffenden marked this pull request as draft February 19, 2025 17:32
@cwoffenden cwoffenden changed the title [AUDIO_WORKLET] add parameter tests [test] Add audio worklet parameter tests Feb 20, 2025
@cwoffenden cwoffenden changed the title [test] Add audio worklet parameter tests [test] Add audio worklet parameter tests (and tidy other interactive tests) Feb 20, 2025
@cwoffenden cwoffenden marked this pull request as ready for review February 20, 2025 13:38
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.

lgtm in general, thanks for continuing to work on this.

@cwoffenden
Copy link
Contributor Author

lgtm in general, thanks for continuing to work on this.

This was actually a fun one to write!

@cwoffenden
Copy link
Contributor Author

cwoffenden commented Feb 20, 2025

All review suggestions done:

  • __unused removed
  • TEST_AND_EXIT only for browser tests
  • Interactive runs until the window is closed
  • wasm64 branching removed

sbc100 pushed a commit that referenced this pull request Feb 20, 2025
All the audio tests in `test_browser.py` (except the mixer) were updated
now the CI has audio, specifically:

- Tests that require audio were flagged as so (tests that don't are
documented)
- Tests that currently fail for 2GB and wasm64 were flagged (only tests
that play audio fail)
- All tests were migrated to `btest_exit()` as previously discussed
- (Tests moved `printf` calls to Emscripten's API and not stdio)
- All tests were run manually and the audio output verified
- All tests were run with `emscripten_force_exit` returning non-zero to
verify they failed
- All of this was also verified that they're running on a Debian VM
without audio to manually check the console for `"Test success"` and
other outputs for tests without `requires_sound_hardware`

The mixer/AW struct test is a standalone PR in #23659.

Fixes: #23131
@cwoffenden cwoffenden requested a review from sbc100 February 21, 2025 06:48
}

// This implementation has no custom start-up requirements
EmscriptenStartWebAudioWorkletCallback getStartCallback(void) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why does this need to be a function that returns a function? Why not just declare a function called startCallback?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was because most tests return and use this default function in the shared code:

void initialised(EMSCRIPTEN_WEBAUDIO_T context, bool success, void* data) {

Whereas one needed a custom implementation, so this was the cleanest way to keep most of the code shared.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(Cleanest way and still keeping it C)

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.

lgtm % comment

@sbc100 sbc100 merged commit f7f6395 into emscripten-core:main Feb 21, 2025
29 checks passed
@cwoffenden cwoffenden deleted the cw-audio-param-tests branch February 21, 2025 19:14
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