Jacek Caban : kernel32/tests: Add message mode non-blocking pipe test.

Alexandre Julliard julliard at winehq.org
Thu Oct 17 16:01:25 CDT 2019


Module: wine
Branch: master
Commit: c0724e56ac6b8ad46b86707dd202a1a5439366d6
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c0724e56ac6b8ad46b86707dd202a1a5439366d6

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Oct 17 15:17:35 2019 +0200

kernel32/tests: Add message mode non-blocking pipe test.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/pipe.c | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c
index a192779e1d..d8d5726f1a 100644
--- a/dlls/kernel32/tests/pipe.c
+++ b/dlls/kernel32/tests/pipe.c
@@ -3887,7 +3887,7 @@ static void test_wait_pipe(void)
     CloseHandle(ov.hEvent);
 }
 
-static void test_nowait(void)
+static void test_nowait(DWORD pipe_type)
 {
     HANDLE piperead, pipewrite, file;
     OVERLAPPED ol, ol2;
@@ -3897,7 +3897,7 @@ static void test_nowait(void)
 
     /* CreateNamedPipe with PIPE_NOWAIT, and read from empty pipe */
     piperead = CreateNamedPipeA(PIPENAME, FILE_FLAG_OVERLAPPED | PIPE_ACCESS_DUPLEX,
-        /* dwPipeMode */ PIPE_TYPE_BYTE | PIPE_NOWAIT,
+        /* dwPipeMode */ pipe_type | PIPE_NOWAIT,
         /* nMaxInstances */ 1,
         /* nOutBufSize */ 512,
         /* nInBufSize */ 512,
@@ -3925,7 +3925,7 @@ static void test_nowait(void)
 
     /* create write side with PIPE_NOWAIT, read side PIPE_WAIT, and test writes */
     pipewrite = CreateNamedPipeA(PIPENAME, FILE_FLAG_OVERLAPPED | PIPE_ACCESS_DUPLEX,
-        /* dwPipeMode */ PIPE_TYPE_BYTE | PIPE_NOWAIT,
+        /* dwPipeMode */ pipe_type | PIPE_NOWAIT,
         /* nMaxInstances */ 1,
         /* nOutBufSize */ 512,
         /* nInBufSize */ 512,
@@ -3994,9 +3994,23 @@ static void test_nowait(void)
     ok(ReadFile(piperead, readbuf, 1, &read, &ol2) == FALSE, "ReadFile should fail\n");
     ok(GetLastError() == ERROR_IO_PENDING, "got %d should be ERROR_IO_PENDING\n", GetLastError());
     ok(WriteFile(pipewrite, readbuf, 514, &write, &ol), "WriteFile should succeed\n");
-    ok(write == 1, "got %d, write should be %d\n", write, 1);
-    ok(GetOverlappedResult(piperead, &ol2, &read, FALSE), "GetOverlappedResult should succeed\n");
-    ok(read == 1, "got %d, read should be %d\n", read, 1);
+    if (pipe_type == PIPE_TYPE_MESSAGE)
+    {
+        todo_wine
+        ok(write == 0, "got %d\n", write);
+        todo_wine
+        ok(!GetOverlappedResult(piperead, &ol2, &read, FALSE), "GetOverlappedResult should fail\n");
+        todo_wine
+        ok(GetLastError() == ERROR_IO_INCOMPLETE, "got %d should be ERROR_IO_PENDING\n", GetLastError());
+        todo_wine
+        ok(read == 0, "got %d, read should be %d\n", read, 1);
+    }
+    else
+    {
+        ok(write == 1, "got %d\n", write);
+        ok(GetOverlappedResult(piperead, &ol2, &read, FALSE), "GetOverlappedResult should fail\n");
+        ok(read == 1, "got %d, read should be %d\n", read, 1);
+    }
     if (GetOverlappedResult(piperead, &ol2, &read, FALSE) == FALSE)
         CancelIo(piperead);
 
@@ -4015,7 +4029,7 @@ static void test_nowait(void)
 
     /* CreateNamedPipe with PIPE_NOWAIT, test ConnectNamedPipe */
     pipewrite = CreateNamedPipeA(PIPENAME, FILE_FLAG_OVERLAPPED | PIPE_ACCESS_DUPLEX,
-        /* dwPipeMode */ PIPE_TYPE_BYTE | PIPE_NOWAIT,
+        /* dwPipeMode */ pipe_type | PIPE_NOWAIT,
         /* nMaxInstances */ 1,
         /* nOutBufSize */ 512,
         /* nInBufSize */ 512,
@@ -4118,5 +4132,6 @@ START_TEST(pipe)
     test_namedpipe_session_id();
     test_multiple_instances();
     test_wait_pipe();
-    test_nowait();
+    test_nowait(PIPE_TYPE_BYTE);
+    test_nowait(PIPE_TYPE_MESSAGE);
 }




More information about the wine-cvs mailing list