Skip to content

Conversation

juj
Copy link
Collaborator

@juj juj commented Jun 15, 2025

Without this, browser would run the reftest as a Module['postRun'] trigger immediately after finishing main().

But because reftest is asynchronous, as it has to load an image asynchronously, the requestAnimationFrame() timers might race to squeeze in the needed test tick function call to render the expected image, or they might not, if the XHR of the reftest image is fast.

#ifdef __EMSCRIPTEN__
// This test kicks off an asynchronous main loop, so do not perform a synchronous
// reftest immediately after falling out from main.
EM_ASM({ delete Module['postRun']; });
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use reftestBlock/reftestUnlock API

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated

@juj juj force-pushed the fix_clientside_vertex_arrays_test branch from a186277 to d055b5e Compare August 14, 2025 14:04
@juj juj enabled auto-merge (squash) August 14, 2025 14:04
@sbc100
Copy link
Collaborator

sbc100 commented Aug 14, 2025

Can you remind me what the race condition is here exactly? (Perhaps you can give a brief description in the PR description).

@juj
Copy link
Collaborator Author

juj commented Aug 14, 2025

ok, updated description.

@sbc100
Copy link
Collaborator

sbc100 commented Aug 14, 2025

Hmm.. I wonder if we can/should instead have the reftest be more smart here.. so that we can avoid changing each of these tests.

I'm happy to see this change land as-is, but I feel like there should be a cleaner way to do this.

@juj juj merged commit dfde4ee into emscripten-core:main Aug 14, 2025
30 checks passed
@juj
Copy link
Collaborator Author

juj commented Aug 14, 2025

If there is a better design, would be happy for it - I don't unfortunately have time for larger refactors, but I need to work the CI to show up green in order to start merging our Emscripten fork PRs to upstream.

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