[PATCH 0/1] MR3641: kernel32/tests: Fix spurious failures in console:test_wait() test.
Signed-off-by: Eric Pouech <epouech(a)codeweavers.com> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3641
From: Eric Pouech <epouech(a)codeweavers.com> Signed-off-by: Eric Pouech <epouech(a)codeweavers.com> --- dlls/kernel32/tests/console.c | 64 ++++++++++++++++++++++++++++++----- 1 file changed, 56 insertions(+), 8 deletions(-) diff --git a/dlls/kernel32/tests/console.c b/dlls/kernel32/tests/console.c index 4e164c11b3d..2ddc99f52ac 100644 --- a/dlls/kernel32/tests/console.c +++ b/dlls/kernel32/tests/console.c @@ -1198,6 +1198,32 @@ static void testWaitForConsoleInput(HANDLE input_handle) CloseHandle(complete_event); } +static BOOL filter_spurious_event(HANDLE input) +{ + INPUT_RECORD ir; + DWORD r; + + if (!ReadConsoleInputW(input, &ir, 1, &r) || r != 1) return FALSE; + + switch (ir.EventType) + { + case MOUSE_EVENT: + if (ir.Event.MouseEvent.dwEventFlags == MOUSE_MOVED) return TRUE; + ok(0, "Unexcepted mouse message: state=%lx ctrl=%lx flags=%lx (%u, %u)\n", + ir.Event.MouseEvent.dwButtonState, + ir.Event.MouseEvent.dwControlKeyState, + ir.Event.MouseEvent.dwEventFlags, + ir.Event.MouseEvent.dwMousePosition.X, + ir.Event.MouseEvent.dwMousePosition.Y); + break; + case WINDOW_BUFFER_SIZE_EVENT: + return TRUE; + default: + ok(0, "Unexpected message %u\n", ir.EventType); + } + return FALSE; +} + static void test_wait(HANDLE input, HANDLE orig_output) { HANDLE output, unbound_output, unbound_input; @@ -1221,25 +1247,47 @@ static void test_wait(HANDLE input, HANDLE orig_output) ret = SetConsoleActiveScreenBuffer(output); ok(ret, "SetConsoleActiveScreenBuffer failed: %lu\n", GetLastError()); - FlushConsoleInputBuffer(input); + ret = FlushConsoleInputBuffer(input); + ok(ret, "FlushConsoleInputBuffer failed: %lu\n", GetLastError()); unbound_output = create_unbound_handle(TRUE, TRUE); unbound_input = create_unbound_handle(FALSE, TRUE); - res = WaitForSingleObject(input, 0); + while ((res = WaitForSingleObject(input, 0)) == WAIT_OBJECT_0) + { + if (!filter_spurious_event(input)) break; + } ok(res == WAIT_TIMEOUT, "WaitForSingleObject returned %lx\n", res); - res = WaitForSingleObject(output, 0); + while ((res = WaitForSingleObject(output, 0)) == WAIT_OBJECT_0) + { + if (!filter_spurious_event(input)) break; + } ok(res == WAIT_TIMEOUT, "WaitForSingleObject returned %lx\n", res); - res = WaitForSingleObject(orig_output, 0); + while ((res = WaitForSingleObject(orig_output, 0)) == WAIT_OBJECT_0) + { + if (!filter_spurious_event(input)) break; + } ok(res == WAIT_TIMEOUT, "WaitForSingleObject returned %lx\n", res); - res = WaitForSingleObject(unbound_output, 0); + while ((res = WaitForSingleObject(unbound_output, 0)) == WAIT_OBJECT_0) + { + if (!filter_spurious_event(unbound_input)) break; + } ok(res == WAIT_TIMEOUT, "WaitForSingleObject returned %lx\n", res); - res = WaitForSingleObject(unbound_input, 0); + while ((res = WaitForSingleObject(unbound_input, 0)) == WAIT_OBJECT_0) + { + if (!filter_spurious_event(unbound_input)) break; + } ok(res == WAIT_TIMEOUT, "WaitForSingleObject returned %lx\n", res); - status = NtWaitForSingleObject(input, FALSE, &zero); + while ((status = NtWaitForSingleObject(input, FALSE, &zero)) == STATUS_SUCCESS) + { + if (!filter_spurious_event(input)) break; + } ok(status == STATUS_TIMEOUT || broken(status == STATUS_ACCESS_DENIED /* win2k8 */), "NtWaitForSingleObject returned %lx\n", status); - status = NtWaitForSingleObject(output, FALSE, &zero); + while ((status = NtWaitForSingleObject(output, FALSE, &zero)) == STATUS_SUCCESS) + { + if (!filter_spurious_event(input)) break; + } ok(status == STATUS_TIMEOUT || broken(status == STATUS_ACCESS_DENIED /* win2k8 */), "NtWaitForSingleObject returned %lx\n", status); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3641
failure in pipeline occurs in ddraw7.c (test_map_synchronisation). couldn't find an occurence of this in neither testbot data nor bugzilla likely unrelated to the MR anyway -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3641#note_43184
This merge request was approved by Jacek Caban. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3641
participants (3)
-
Eric Pouech -
eric pouech (@epo) -
Jacek Caban (@jacek)