Add more pipe tests
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Sat Jun 4 11:46:01 CDT 2005
Changelog:
wine/dlls/kernel/tests/pipe.c
Add test for CreatePipe(). Add a todo_wine for wine not detecting
a broken pipe. Checked with XP for correct expected results.
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/kernel/tests/pipe.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/pipe.c,v
retrieving revision 1.19
diff -u -r1.19 pipe.c
--- wine/dlls/kernel/tests/pipe.c 25 May 2005 09:54:51 -0000 1.19
+++ wine/dlls/kernel/tests/pipe.c 4 Jun 2005 16:39:26 -0000
@@ -731,19 +731,50 @@
return 0;
}
+static void test_CreatePipe(void)
+{
+ SECURITY_ATTRIBUTES pipe_attr;
+ HANDLE piperead, pipewrite;
+ DWORD written;
+ DWORD read;
+ char readbuf[32];
+
+ pipe_attr.nLength = sizeof(SECURITY_ATTRIBUTES);
+ pipe_attr.bInheritHandle = TRUE;
+ pipe_attr.lpSecurityDescriptor = NULL;
+ ok(CreatePipe(&piperead, &pipewrite, &pipe_attr, 0) != 0, "CreatePipe failed\n");
+ ok(WriteFile(pipewrite,PIPENAME,sizeof(PIPENAME), &written, NULL), "Write to anonymous pipe failed\n");
+ ok(written == sizeof(PIPENAME), "Write to anonymous pipe wrote %ld bytes instead of %d\n", written,sizeof(PIPENAME));
+ ok(ReadFile(piperead,readbuf,sizeof(readbuf),&read, NULL), "Read from non empty pipe failed\n");
+ ok(read == sizeof(PIPENAME), "Read from anonymous pipe got %ld bytes instead of %d\n", read, sizeof(PIPENAME));
+ /* Now write another chunk*/
+ ok(CreatePipe(&piperead, &pipewrite, &pipe_attr, 0) != 0, "CreatePipe failed\n");
+ ok(WriteFile(pipewrite,PIPENAME,sizeof(PIPENAME), &written, NULL), "Write to anonymous pipe failed\n");
+ ok(written == sizeof(PIPENAME), "Write to anonymous pipe wrote %ld bytes instead of %d\n", written,sizeof(PIPENAME));
+ /* and close the write end, read should still succeed*/
+ ok(CloseHandle(pipewrite), "CloseHandle for the Write Pipe failed\n");
+ ok(ReadFile(piperead,readbuf,sizeof(readbuf),&read, NULL), "Read from broken pipe withe with pending data failed\n");
+ ok(read == sizeof(PIPENAME), "Read from anonymous pipe got %ld bytes instead of %d\n", read, sizeof(PIPENAME));
+ /* But now we need to get informed that the pipe is closed */
+ todo_wine(ReadFile(piperead,readbuf,sizeof(readbuf),&read, NULL) == 0, "Broken pipe not detected\n");
+
+}
+
START_TEST(pipe)
{
- trace("test 1 of 4:\n");
+ trace("test 1 of 6:\n");
if (test_DisconnectNamedPipe())
return;
- trace("test 2 of 4:\n");
+ trace("test 2 of 6:\n");
test_CreateNamedPipe_instances_must_match();
- trace("test 3 of 4:\n");
+ trace("test 3 of 6:\n");
test_NamedPipe_2();
- trace("test 4 of 4:\n");
+ trace("test 4 of 6:\n");
test_CreateNamedPipe(PIPE_TYPE_BYTE);
- trace("all tests done\n");
+ trace("test 5 of 6\n");
test_CreateNamedPipe(PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE);
+ trace("test 6 of 6\n");
+ test_CreatePipe();
trace("all tests done\n");
}
More information about the wine-patches
mailing list