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

Alexandre Julliard julliard at winehq.org
Thu Nov 7 08:53:04 CST 2019


Rémi Bernon <rbernon at codeweavers.com> writes:

> 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);

Please don't add sleeps, the tests are already slow enough. That sort of
thing should be handled by using a proper synchronization object.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list