[PATCH 1/2] user32/tests: Add a delay to consistently trigger a race condition.

Rémi Bernon rbernon at codeweavers.com
Thu Nov 7 08:20:13 CST 2019


This test is failing from time to time. Adding a delay here triggers
the underlying race condition -see next patch- and makes the test to
always fail.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

Notes:
    The failure was hard to reproduce. The most reliable way without the
    sleep added here is to start multiple runs on the testbot, changing
    locale for each run. The locale change seems to have an impact on
    the timing and triggers the race condition.

 dlls/user32/tests/msg.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 193a20fd958..0b756050e47 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -8588,6 +8588,9 @@ static DWORD CALLBACK create_grand_child_thread( void *param )
     flush_sequence();
     SetEvent( wnd_event->start_event );

+    /* be sure to wait for the child thread to be destroyed */
+    Sleep(1000);
+
     for (;;)
     {
         MsgWaitForMultipleObjects(0, NULL, FALSE, 1000, QS_ALLINPUT);
@@ -8771,13 +8774,14 @@ static void test_interthread_messages(void)
     CloseHandle( hThread );

     ret = WaitForSingleObject( wnd_event.grand_child, 5000 );
+    todo_wine
     ok( !ret, "WaitForSingleObject failed %x\n", ret );
     CloseHandle( wnd_event.grand_child );

     CloseHandle( wnd_event.start_event );
     CloseHandle( wnd_event.stop_event );
     flush_events();
-    ok_sequence(WmExitThreadSeq, "destroy child on thread exit", FALSE);
+    ok_sequence(WmExitThreadSeq, "destroy child on thread exit", TRUE);
     log_all_parent_messages--;
     DestroyWindow( wnd_event.hwnd );

--
2.24.0.rc2




More information about the wine-devel mailing list