André Hentschel : ntdll/tests: Don' t test function directly when reporting GetLastError().

Alexandre Julliard julliard at winehq.org
Wed Dec 29 11:14:49 CST 2010


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

Author: André Hentschel <nerv at dawncrow.de>
Date:   Tue Dec 28 21:10:40 2010 +0100

ntdll/tests: Don't test function directly when reporting GetLastError().

---

 dlls/ntdll/tests/directory.c |    9 +++++----
 dlls/ntdll/tests/exception.c |    6 ++++--
 dlls/ntdll/tests/file.c      |    5 +++--
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c
index bc4ad39..be8dd13 100644
--- a/dlls/ntdll/tests/directory.c
+++ b/dlls/ntdll/tests/directory.c
@@ -71,9 +71,10 @@ static const int max_test_dir_size = 20;  /* size of above plus some for .. etc
 static void set_up_attribute_test(const char *testdirA)
 {
     int i;
+    BOOL ret;
 
-    ok(CreateDirectoryA(testdirA, NULL),
-       "couldn't create dir '%s', error %d\n", testdirA, GetLastError());
+    ret = CreateDirectoryA(testdirA, NULL);
+    ok(ret, "couldn't create dir '%s', error %d\n", testdirA, GetLastError());
 
     for (i=0; testfiles[i].name; i++) {
         char buf[MAX_PATH];
@@ -82,8 +83,8 @@ static void set_up_attribute_test(const char *testdirA)
         sprintf(buf, "%s\\%s", testdirA, testfiles[i].name);
         testfiles[i].nfound = 0;
         if (testfiles[i].attr & FILE_ATTRIBUTE_DIRECTORY) {
-            ok(CreateDirectoryA(buf, NULL),
-               "couldn't create dir '%s', error %d\n", buf, GetLastError());
+            ret = CreateDirectoryA(buf, NULL);
+            ok(ret, "couldn't create dir '%s', error %d\n", buf, GetLastError());
         } else {
             HANDLE h = CreateFileA(buf,
                                    GENERIC_READ|GENERIC_WRITE,
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index dd03d5f..386c5a6 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -828,8 +828,10 @@ static void test_debugger(void)
     } while (de.dwDebugEventCode != EXIT_PROCESS_DEBUG_EVENT);
 
     winetest_wait_child_process( pi.hProcess );
-    ok(CloseHandle(pi.hThread) != 0, "error %u\n", GetLastError());
-    ok(CloseHandle(pi.hProcess) != 0, "error %u\n", GetLastError());
+    ret = CloseHandle(pi.hThread);
+    ok(ret, "error %u\n", GetLastError());
+    ret = CloseHandle(pi.hProcess);
+    ok(ret, "error %u\n", GetLastError());
 
     return;
 }
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index c72e0f0..5afb025 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -456,6 +456,7 @@ static void read_file_test(void)
     char buffer[128];
     LARGE_INTEGER offset;
     HANDLE event = CreateEventA( NULL, TRUE, FALSE, NULL );
+    BOOL ret;
 
     buffer[0] = 1;
 
@@ -599,8 +600,8 @@ static void read_file_test(void)
     CloseHandle( read );
 
     if (!create_pipe( &read, &write, FILE_FLAG_OVERLAPPED, 4096 )) return;
-    ok(DuplicateHandle(GetCurrentProcess(), read, GetCurrentProcess(), &handle, 0, TRUE, DUPLICATE_SAME_ACCESS),
-        "Failed to duplicate handle: %d\n", GetLastError());
+    ret = DuplicateHandle(GetCurrentProcess(), read, GetCurrentProcess(), &handle, 0, TRUE, DUPLICATE_SAME_ACCESS);
+    ok(ret, "Failed to duplicate handle: %d\n", GetLastError());
 
     apc_count = 0;
     U(iosb).Status = 0xdeadbabe;




More information about the wine-cvs mailing list