From 43c1fac61b743652ee650de8a7bbb04773c29e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Sun, 15 Jun 2025 19:48:58 +0300 Subject: [PATCH] Fix race condition in browser.test_clientside_vertex_arrays_es3 --- test/clientside_vertex_arrays_es3.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/clientside_vertex_arrays_es3.c b/test/clientside_vertex_arrays_es3.c index 410e32a8c7516..67e0df82a1407 100644 --- a/test/clientside_vertex_arrays_es3.c +++ b/test/clientside_vertex_arrays_es3.c @@ -18,6 +18,9 @@ void onDraw(void* arg) { glDrawArrays(GL_TRIANGLES, 0, 3); glfwSwapBuffers(window); glfwPollEvents(); +#ifdef __EMSCRIPTEN__ + EM_ASM(doReftest()); // All done, perform the JS side image comparison reftest. +#endif } void onResize(GLFWwindow* window, int width, int height) { @@ -112,6 +115,10 @@ int main() { } #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']; }); + emscripten_set_main_loop_arg(onDraw, &window, 0, 1); #else while (1) {