kernel32/tests: Add tests for calling WriteFile on pipe when other end is closed.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sebastian Lackner 2015-11-23 07:23:04 +01:00 committed by Alexandre Julliard
parent e235b0670d
commit 78948b24b7
1 changed files with 20 additions and 0 deletions

View File

@ -1430,6 +1430,11 @@ static void test_CloseHandle(void)
ok(!ret, "ReadFile unexpectedly succeeded\n"); ok(!ret, "ReadFile unexpectedly succeeded\n");
ok(GetLastError() == ERROR_BROKEN_PIPE, "expected ERROR_BROKEN_PIPE, got %u\n", GetLastError()); ok(GetLastError() == ERROR_BROKEN_PIPE, "expected ERROR_BROKEN_PIPE, got %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = WriteFile(hfile, testdata, sizeof(testdata), &numbytes, NULL);
ok(!ret, "WriteFile unexpectedly succeeded\n");
todo_wine ok(GetLastError() == ERROR_NO_DATA, "expected ERROR_NO_DATA, got %u\n", GetLastError());
CloseHandle(hfile); CloseHandle(hfile);
hpipe = CreateNamedPipeA(PIPENAME, PIPE_ACCESS_DUPLEX, hpipe = CreateNamedPipeA(PIPENAME, PIPE_ACCESS_DUPLEX,
@ -1459,6 +1464,11 @@ static void test_CloseHandle(void)
ok(!ret, "ReadFile unexpectedly succeeded\n"); ok(!ret, "ReadFile unexpectedly succeeded\n");
todo_wine ok(GetLastError() == ERROR_BROKEN_PIPE, "expected ERROR_BROKEN_PIPE, got %u\n", GetLastError()); todo_wine ok(GetLastError() == ERROR_BROKEN_PIPE, "expected ERROR_BROKEN_PIPE, got %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = WriteFile(hfile, testdata, sizeof(testdata), &numbytes, NULL);
ok(!ret, "WriteFile unexpectedly succeeded\n");
todo_wine ok(GetLastError() == ERROR_NO_DATA, "expected ERROR_NO_DATA, got %u\n", GetLastError());
CloseHandle(hfile); CloseHandle(hfile);
/* repeat test with hpipe <-> hfile swapped */ /* repeat test with hpipe <-> hfile swapped */
@ -1502,6 +1512,11 @@ static void test_CloseHandle(void)
ok(!ret, "ReadFile unexpectedly succeeded\n"); ok(!ret, "ReadFile unexpectedly succeeded\n");
ok(GetLastError() == ERROR_BROKEN_PIPE, "expected ERROR_BROKEN_PIPE, got %u\n", GetLastError()); ok(GetLastError() == ERROR_BROKEN_PIPE, "expected ERROR_BROKEN_PIPE, got %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = WriteFile(hpipe, testdata, sizeof(testdata), &numbytes, NULL);
ok(!ret, "WriteFile unexpectedly succeeded\n");
todo_wine ok(GetLastError() == ERROR_NO_DATA, "expected ERROR_NO_DATA, got %u\n", GetLastError());
CloseHandle(hpipe); CloseHandle(hpipe);
hpipe = CreateNamedPipeA(PIPENAME, PIPE_ACCESS_DUPLEX, hpipe = CreateNamedPipeA(PIPENAME, PIPE_ACCESS_DUPLEX,
@ -1531,6 +1546,11 @@ static void test_CloseHandle(void)
ok(!ret, "ReadFile unexpectedly succeeded\n"); ok(!ret, "ReadFile unexpectedly succeeded\n");
ok(GetLastError() == ERROR_BROKEN_PIPE, "expected ERROR_BROKEN_PIPE, got %u\n", GetLastError()); ok(GetLastError() == ERROR_BROKEN_PIPE, "expected ERROR_BROKEN_PIPE, got %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = WriteFile(hpipe, testdata, sizeof(testdata), &numbytes, NULL);
ok(!ret, "WriteFile unexpectedly succeeded\n");
todo_wine ok(GetLastError() == ERROR_NO_DATA, "expected ERROR_NO_DATA, got %u\n", GetLastError());
CloseHandle(hpipe); CloseHandle(hpipe);
} }