Commit 1a028626 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ntdll/tests: Avoid testing the server pipe signaled state from the main thread.

Although the test has never been observed to fail on Windows, I think the failure is genuinely a race in the test. File handles (like events) are signaled in order to mark that an I/O operation has completed. In this case the I/O operation includes manipulating data on both ends of the pipe, and as part of that may signal the other end. Internally, however, the file handle must logically happen *after* all of this processing has taken place, not least because (given the Windows I/O architecture) it is the job of the I/O manager, not the IRP handler. Since the purpose of the test is probably just to check that the file handle will be signaled after a synchronous I/O operation has completed, we may as well check it from the client thread, after we know for sure that it has. Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=54078
parent eb1f9896
...@@ -1679,6 +1679,7 @@ static DWORD WINAPI blocking_thread(void *arg) ...@@ -1679,6 +1679,7 @@ static DWORD WINAPI blocking_thread(void *arg)
ok(is_signaled(ctx->pipe), "pipe is not signaled\n"); ok(is_signaled(ctx->pipe), "pipe is not signaled\n");
ret = WriteFile(ctx->pipe, buf, 1, &num_bytes, NULL); ret = WriteFile(ctx->pipe, buf, 1, &num_bytes, NULL);
ok(ret, "WriteFile failed, error %lu\n", GetLastError()); ok(ret, "WriteFile failed, error %lu\n", GetLastError());
ok(is_signaled(ctx->pipe), "pipe is not signaled\n");
break; break;
case BLOCKING_THREAD_READ: case BLOCKING_THREAD_READ:
Sleep(100); Sleep(100);
...@@ -1689,6 +1690,7 @@ static DWORD WINAPI blocking_thread(void *arg) ...@@ -1689,6 +1690,7 @@ static DWORD WINAPI blocking_thread(void *arg)
ok(is_signaled(ctx->pipe), "pipe is not signaled\n"); ok(is_signaled(ctx->pipe), "pipe is not signaled\n");
ret = ReadFile(ctx->pipe, read_buf, 1, &num_bytes, NULL); ret = ReadFile(ctx->pipe, read_buf, 1, &num_bytes, NULL);
ok(ret, "WriteFile failed, error %lu\n", GetLastError()); ok(ret, "WriteFile failed, error %lu\n", GetLastError());
ok(is_signaled(ctx->pipe), "pipe is not signaled\n");
break; break;
case BLOCKING_THREAD_QUIT: case BLOCKING_THREAD_QUIT:
return 0; return 0;
...@@ -1748,7 +1750,6 @@ static void test_blocking(ULONG options) ...@@ -1748,7 +1750,6 @@ static void test_blocking(ULONG options)
ok(io.Status == STATUS_SUCCESS, "Status = %lx\n", io.Status); ok(io.Status == STATUS_SUCCESS, "Status = %lx\n", io.Status);
ok(io.Information == 1, "Information = %Iu\n", io.Information); ok(io.Information == 1, "Information = %Iu\n", io.Information);
ok(is_signaled(ctx.client), "client is not signaled\n"); ok(is_signaled(ctx.client), "client is not signaled\n");
ok(is_signaled(ctx.pipe), "pipe is not signaled\n");
res = WaitForSingleObject(ctx.done, 10000); res = WaitForSingleObject(ctx.done, 10000);
ok(res == WAIT_OBJECT_0, "wait returned %lx\n", res); ok(res == WAIT_OBJECT_0, "wait returned %lx\n", res);
...@@ -1767,7 +1768,6 @@ static void test_blocking(ULONG options) ...@@ -1767,7 +1768,6 @@ static void test_blocking(ULONG options)
ok(is_signaled(ctx.event), "event is not signaled\n"); ok(is_signaled(ctx.event), "event is not signaled\n");
todo_wine todo_wine
ok(is_signaled(ctx.client), "client is not signaled\n"); ok(is_signaled(ctx.client), "client is not signaled\n");
ok(is_signaled(ctx.pipe), "pipe is not signaled\n");
if (!(options & FILE_SYNCHRONOUS_IO_ALERT)) if (!(options & FILE_SYNCHRONOUS_IO_ALERT))
ok(!ioapc_called, "ioapc called\n"); ok(!ioapc_called, "ioapc called\n");
...@@ -1797,7 +1797,6 @@ static void test_blocking(ULONG options) ...@@ -1797,7 +1797,6 @@ static void test_blocking(ULONG options)
res = WaitForSingleObject(ctx.done, 10000); res = WaitForSingleObject(ctx.done, 10000);
ok(res == WAIT_OBJECT_0, "wait returned %lx\n", res); ok(res == WAIT_OBJECT_0, "wait returned %lx\n", res);
ok(is_signaled(ctx.pipe), "pipe is not signaled\n");
CloseHandle(ctx.pipe); CloseHandle(ctx.pipe);
CloseHandle(ctx.client); CloseHandle(ctx.client);
...@@ -1806,13 +1805,11 @@ static void test_blocking(ULONG options) ...@@ -1806,13 +1805,11 @@ static void test_blocking(ULONG options)
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, 4096); PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, 4096);
ok(is_signaled(ctx.client), "client is not signaled\n"); ok(is_signaled(ctx.client), "client is not signaled\n");
ok(is_signaled(ctx.pipe), "pipe is not signaled\n");
ret = WriteFile(ctx.client, read_buf, 1, &num_bytes, NULL); ret = WriteFile(ctx.client, read_buf, 1, &num_bytes, NULL);
ok(ret, "WriteFile failed, error %lu\n", GetLastError()); ok(ret, "WriteFile failed, error %lu\n", GetLastError());
ok(is_signaled(ctx.client), "client is not signaled\n"); ok(is_signaled(ctx.client), "client is not signaled\n");
ok(is_signaled(ctx.pipe), "pipe is not signaled\n");
ioapc_called = FALSE; ioapc_called = FALSE;
memset(&io, 0xff, sizeof(io)); memset(&io, 0xff, sizeof(io));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment