Zebediah Figura : ntdll/tests: Get rid of test_iocompletion().

Alexandre Julliard julliard at winehq.org
Mon Oct 1 21:19:05 CDT 2018


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Sun Sep 30 16:59:45 2018 -0500

ntdll/tests: Get rid of test_iocompletion().

Call I/O completion tests directly.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/tests/file.c | 42 ++++++++++++++++++++----------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index b66b857..4d920d9 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -864,7 +864,7 @@ static void nt_mailslot_test(void)
     ok( rc == STATUS_SUCCESS, "NtClose failed\n");
 }
 
-static void test_iocp_setcompletion(HANDLE h)
+static void test_set_io_completion(void)
 {
     LARGE_INTEGER timeout = {{0}};
     IO_STATUS_BLOCK iosb;
@@ -872,9 +872,14 @@ static void test_iocp_setcompletion(HANDLE h)
     NTSTATUS res;
     ULONG count;
     SIZE_T size = 3;
+    HANDLE h;
 
     if (sizeof(size) > 4) size |= (ULONGLONG)0x12345678 << 32;
 
+    res = pNtCreateIoCompletion( &h, IO_COMPLETION_ALL_ACCESS, NULL, 0 );
+    ok( res == STATUS_SUCCESS, "NtCreateIoCompletion failed: %#x\n", res );
+    ok( h && h != INVALID_HANDLE_VALUE, "got invalid handle %p\n", h );
+
     res = pNtSetIoCompletion( h, CKEY_FIRST, CVALUE_FIRST, STATUS_INVALID_DEVICE_REQUEST, size );
     ok( res == STATUS_SUCCESS, "NtSetIoCompletion failed: %x\n", res );
 
@@ -890,15 +895,17 @@ static void test_iocp_setcompletion(HANDLE h)
 
     count = get_pending_msgs(h);
     ok( !count, "Unexpected msg count: %d\n", count );
+
+    pNtClose( h );
 }
 
-static void test_iocp_fileio(HANDLE h)
+static void test_file_io_completion(void)
 {
     static const char pipe_name[] = "\\\\.\\pipe\\iocompletiontestnamedpipe";
 
     IO_STATUS_BLOCK iosb;
     BYTE send_buf[TEST_BUF_LEN], recv_buf[TEST_BUF_LEN];
-    FILE_COMPLETION_INFORMATION fci = {h, CKEY_SECOND};
+    FILE_COMPLETION_INFORMATION fci;
     LARGE_INTEGER timeout = {{0}};
     HANDLE server, client;
     ULONG_PTR key, value;
@@ -907,6 +914,13 @@ static void test_iocp_fileio(HANDLE h)
     NTSTATUS res;
     DWORD read;
     long count;
+    HANDLE h;
+
+    res = pNtCreateIoCompletion( &h, IO_COMPLETION_ALL_ACCESS, NULL, 0 );
+    ok( res == STATUS_SUCCESS, "NtCreateIoCompletion failed: %#x\n", res );
+    ok( h && h != INVALID_HANDLE_VALUE, "got invalid handle %p\n", h );
+    fci.CompletionPort = h;
+    fci.CompletionKey = CKEY_SECOND;
 
     server = CreateNamedPipeA( pipe_name, PIPE_ACCESS_INBOUND,
                                PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
@@ -1077,6 +1091,7 @@ todo_wine
 
     CloseHandle( server );
     CloseHandle( client );
+    pNtClose( h );
 }
 
 static void test_file_full_size_information(void)
@@ -2925,24 +2940,6 @@ todo_wine
     RemoveDirectoryA( buffer );
 }
 
-static void test_iocompletion(void)
-{
-    HANDLE h = INVALID_HANDLE_VALUE;
-    NTSTATUS res;
-
-    res = pNtCreateIoCompletion( &h, IO_COMPLETION_ALL_ACCESS, NULL, 0);
-
-    ok( res == 0, "NtCreateIoCompletion anonymous failed: %x\n", res );
-    ok( h && h != INVALID_HANDLE_VALUE, "Invalid handle returned\n" );
-
-    if ( h && h != INVALID_HANDLE_VALUE)
-    {
-        test_iocp_setcompletion(h);
-        test_iocp_fileio(h);
-        pNtClose(h);
-    }
-}
-
 static void test_file_name_information(void)
 {
     WCHAR *file_name, *volume_prefix, *expected;
@@ -4470,7 +4467,8 @@ START_TEST(file)
     read_file_test();
     append_file_test();
     nt_mailslot_test();
-    test_iocompletion();
+    test_set_io_completion();
+    test_file_io_completion();
     test_file_basic_information();
     test_file_all_information();
     test_file_both_information();




More information about the wine-cvs mailing list