Jacek Caban : ntdll/tests: Added tests of partial reads and reads with invalid wait handle.

Alexandre Julliard julliard at winehq.org
Wed Mar 29 15:02:51 CDT 2017


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Mar 29 14:05:47 2017 +0200

ntdll/tests: Added tests of partial reads and reads with invalid wait handle.

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

---

 dlls/ntdll/tests/pipe.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/dlls/ntdll/tests/pipe.c b/dlls/ntdll/tests/pipe.c
index cfff0e5..e242cb4 100644
--- a/dlls/ntdll/tests/pipe.c
+++ b/dlls/ntdll/tests/pipe.c
@@ -840,6 +840,43 @@ static void read_pipe_test(ULONG pipe_flags, ULONG pipe_type)
     SleepEx( 1, TRUE ); /* alertable sleep */
     ok( apc_count == 1, "apc not called\n" );
 
+    /* now partial read with data ready */
+    apc_count = 0;
+    U(iosb).Status = 0xdeadbabe;
+    iosb.Information = 0xdeadbeef;
+    ResetEvent( event );
+    ret = WriteFile( write, buffer, 2, &written, NULL );
+    ok(ret && written == 2, "WriteFile error %d\n", GetLastError());
+    status = NtReadFile( read, event, apc, &apc_count, &iosb, buffer, 1, NULL, NULL );
+    if (pipe_type & PIPE_READMODE_MESSAGE)
+    {
+        ok( status == STATUS_BUFFER_OVERFLOW, "wrong status %x\n", status );
+        ok( U(iosb).Status == STATUS_BUFFER_OVERFLOW, "wrong status %x\n", U(iosb).Status );
+    }
+    else
+    {
+        ok( status == STATUS_SUCCESS, "wrong status %x\n", status );
+        ok( U(iosb).Status == 0, "wrong status %x\n", U(iosb).Status );
+    }
+    ok( iosb.Information == 1, "wrong info %lu\n", iosb.Information );
+    ok( is_signaled( event ), "event is not signaled\n" );
+    ok( !apc_count, "apc was called\n" );
+    SleepEx( 1, FALSE ); /* non-alertable sleep */
+    ok( !apc_count, "apc was called\n" );
+    SleepEx( 1, TRUE ); /* alertable sleep */
+    ok( apc_count == 1, "apc not called\n" );
+    apc_count = 0;
+    status = NtReadFile( read, event, apc, &apc_count, &iosb, buffer, 1, NULL, NULL );
+    ok( status == STATUS_SUCCESS, "wrong status %x\n", status );
+    ok( U(iosb).Status == 0, "wrong status %x\n", U(iosb).Status );
+    ok( iosb.Information == 1, "wrong info %lu\n", iosb.Information );
+    ok( is_signaled( event ), "event is not signaled\n" );
+    ok( !apc_count, "apc was called\n" );
+    SleepEx( 1, FALSE ); /* non-alertable sleep */
+    ok( !apc_count, "apc was called\n" );
+    SleepEx( 1, TRUE ); /* alertable sleep */
+    ok( apc_count == 1, "apc not called\n" );
+
     /* try read with no data */
     apc_count = 0;
     U(iosb).Status = 0xdeadbabe;
@@ -877,6 +914,19 @@ static void read_pipe_test(ULONG pipe_flags, ULONG pipe_type)
     ok( !apc_count, "apc was called\n" );
     CloseHandle( read );
 
+    /* read from disconnected pipe, with invalid event handle */
+    apc_count = 0;
+    U(iosb).Status = 0xdeadbabe;
+    iosb.Information = 0xdeadbeef;
+    status = NtReadFile( read, (HANDLE)0xdeadbeef, apc, &apc_count, &iosb, buffer, 1, NULL, NULL );
+    ok( status == STATUS_INVALID_HANDLE, "wrong status %x\n", status );
+    ok( U(iosb).Status == 0xdeadbabe, "wrong status %x\n", U(iosb).Status );
+    ok( iosb.Information == 0xdeadbeef, "wrong info %lu\n", iosb.Information );
+    ok( !apc_count, "apc was called\n" );
+    SleepEx( 1, TRUE ); /* alertable sleep */
+    ok( !apc_count, "apc was called\n" );
+    CloseHandle( read );
+
     /* read from closed handle */
     apc_count = 0;
     U(iosb).Status = 0xdeadbabe;




More information about the wine-cvs mailing list