Nikolay Sivov : kernel32/tests: Use todo_wine_if() in tests.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Feb 16 09:54:58 CST 2016


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Feb 15 23:06:44 2016 +0300

kernel32/tests: Use todo_wine_if() in tests.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/file.c   | 17 ++++++-----------
 dlls/kernel32/tests/loader.c | 20 ++++----------------
 dlls/kernel32/tests/locale.c | 45 +++++++-------------------------------------
 3 files changed, 17 insertions(+), 65 deletions(-)

diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 58ddddf..77249fa 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -1325,20 +1325,15 @@ static void test_CreateFileA(void)
                 skip("Do not have authority to access volumes. Test for %s skipped\n", filename);
         }
         /* otherwise validate results with expectations */
-        else if (p[i].todo_flag)
-            todo_wine ok(
-                (hFile == INVALID_HANDLE_VALUE &&
-                  (p[i].err == GetLastError() || p[i].err2 == GetLastError())) ||
-                (hFile != INVALID_HANDLE_VALUE && p[i].err == ERROR_SUCCESS),
-                "CreateFileA failed on %s, hFile %p, err=%u, should be %u\n",
-                filename, hFile, GetLastError(), p[i].err);
         else
-            ok(
-                (hFile == INVALID_HANDLE_VALUE &&
-                 (p[i].err == GetLastError() || p[i].err2 == GetLastError())) ||
-                (hFile != INVALID_HANDLE_VALUE && p[i].err == ERROR_SUCCESS),
+        {
+            todo_wine_if (p[i].todo_flag)
+                ok((hFile == INVALID_HANDLE_VALUE &&
+                   (p[i].err == GetLastError() || p[i].err2 == GetLastError())) ||
+                   (hFile != INVALID_HANDLE_VALUE && p[i].err == ERROR_SUCCESS),
                 "CreateFileA failed on %s, hFile %p, err=%u, should be %u\n",
                 filename, hFile, GetLastError(), p[i].err);
+        }
         if (hFile != INVALID_HANDLE_VALUE)
             CloseHandle( hFile );
         i++;
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
index 25b7b08..c35cf25 100644
--- a/dlls/kernel32/tests/loader.c
+++ b/dlls/kernel32/tests/loader.c
@@ -452,10 +452,7 @@ static void test_Loader(void)
             ptr = VirtualAlloc(hlib, page_size, MEM_COMMIT, info.Protect);
             ok(!ptr, "%d: VirtualAlloc should fail\n", i);
             /* FIXME: Remove once Wine is fixed */
-            if (info.Protect == PAGE_WRITECOPY || info.Protect == PAGE_EXECUTE_WRITECOPY)
-todo_wine
-            ok(GetLastError() == ERROR_ACCESS_DENIED, "%d: expected ERROR_ACCESS_DENIED, got %d\n", i, GetLastError());
-            else
+            todo_wine_if (info.Protect == PAGE_WRITECOPY || info.Protect == PAGE_EXECUTE_WRITECOPY)
             ok(GetLastError() == ERROR_ACCESS_DENIED, "%d: expected ERROR_ACCESS_DENIED, got %d\n", i, GetLastError());
 
             SetLastError(0xdeadbeef);
@@ -541,11 +538,7 @@ todo_wine
                 ptr = VirtualAlloc((char *)hlib + section.VirtualAddress, page_size, MEM_COMMIT, info.Protect);
                 ok(!ptr, "%d: VirtualAlloc should fail\n", i);
                 /* FIXME: Remove once Wine is fixed */
-                if (info.Protect == PAGE_WRITECOPY || info.Protect == PAGE_EXECUTE_WRITECOPY)
-todo_wine
-                ok(GetLastError() == ERROR_ACCESS_DENIED || GetLastError() == ERROR_INVALID_ADDRESS,
-                   "%d: expected ERROR_ACCESS_DENIED, got %d\n", i, GetLastError());
-                else
+                todo_wine_if (info.Protect == PAGE_WRITECOPY || info.Protect == PAGE_EXECUTE_WRITECOPY)
                 ok(GetLastError() == ERROR_ACCESS_DENIED || GetLastError() == ERROR_INVALID_ADDRESS,
                    "%d: expected ERROR_ACCESS_DENIED, got %d\n", i, GetLastError());
             }
@@ -1139,9 +1132,7 @@ static void test_section_access(void)
             size = VirtualQuery((char *)hlib + section.VirtualAddress, &info, sizeof(info));
             ok(size == sizeof(info), "%d: VirtualQuery error %d\n", i, GetLastError());
             /* FIXME: remove the condition below once Wine is fixed */
-            if (info.Protect == PAGE_WRITECOPY || info.Protect == PAGE_EXECUTE_WRITECOPY)
-                todo_wine ok(info.Protect == td[i].scn_page_access_after_write, "%d: got %#x != expected %#x\n", i, info.Protect, td[i].scn_page_access_after_write);
-            else
+            todo_wine_if (info.Protect == PAGE_WRITECOPY || info.Protect == PAGE_EXECUTE_WRITECOPY)
                 ok(info.Protect == td[i].scn_page_access_after_write, "%d: got %#x != expected %#x\n", i, info.Protect, td[i].scn_page_access_after_write);
         }
 
@@ -1498,10 +1489,7 @@ static BOOL WINAPI dll_entry_point(HINSTANCE hinst, DWORD reason, LPVOID param)
             ret = pRtlDllShutdownInProgress();
 
             /* FIXME: remove once Wine is fixed */
-            if (expected_code == STILL_ACTIVE || expected_code == 196)
-                ok(!ret || broken(ret) /* before Vista */, "RtlDllShutdownInProgress returned %d\n", ret);
-            else
-            todo_wine
+            todo_wine_if (!(expected_code == STILL_ACTIVE || expected_code == 196))
                 ok(!ret || broken(ret) /* before Vista */, "RtlDllShutdownInProgress returned %d\n", ret);
         }
 
diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c
index d49e0d6..0117a39 100644
--- a/dlls/kernel32/tests/locale.c
+++ b/dlls/kernel32/tests/locale.c
@@ -329,24 +329,13 @@ static void test_GetLocaleInfoW(void)
 
           val = 0;
           GetLocaleInfoW(lcid, LOCALE_ILANGUAGE|LOCALE_RETURN_NUMBER, (WCHAR*)&val, sizeof(val)/sizeof(WCHAR));
-          if (ptr->todo & 0x1)
-          {
-          todo_wine
-              ok(val == ptr->lcid || (val && broken(val == ptr->lcid_broken)), "%s: got wrong lcid 0x%04x, expected 0x%04x\n",
-                  wine_dbgstr_w(ptr->name), val, ptr->lcid);
-          }
-          else
+          todo_wine_if (ptr->todo & 0x1)
               ok(val == ptr->lcid || (val && broken(val == ptr->lcid_broken)), "%s: got wrong lcid 0x%04x, expected 0x%04x\n",
                   wine_dbgstr_w(ptr->name), val, ptr->lcid);
 
           /* now check LOCALE_SNAME */
           GetLocaleInfoW(lcid, LOCALE_SNAME, bufferW, COUNTOF(bufferW));
-          if (ptr->todo & 0x2)
-          todo_wine
-              ok(!lstrcmpW(bufferW, ptr->sname) ||
-                 (*ptr->sname_broken && broken(!lstrcmpW(bufferW, ptr->sname_broken))),
-                  "%s: got %s\n", wine_dbgstr_w(ptr->name), wine_dbgstr_w(bufferW));
-          else
+          todo_wine_if (ptr->todo & 0x2)
               ok(!lstrcmpW(bufferW, ptr->sname) ||
                  (*ptr->sname_broken && broken(!lstrcmpW(bufferW, ptr->sname_broken))),
                   "%s: got %s\n", wine_dbgstr_w(ptr->name), wine_dbgstr_w(bufferW));
@@ -2010,16 +1999,9 @@ static void test_CompareStringEx(void)
 
         MultiByteToWideChar(CP_ACP, 0, e->locale, -1, locale, sizeof(locale)/sizeof(WCHAR));
         ret = pCompareStringEx(locale, e->flags, e->first, -1, e->second, -1, NULL, NULL, 0);
-        if (e->todo)
-        {
-            todo_wine ok(ret == e->ret || broken(ret == e->broken),
-                         "%d: got %s, expected %s\n", i, op[ret], op[e->ret]);
-        }
-        else
-        {
+        todo_wine_if (e->todo)
             ok(ret == e->ret || broken(ret == e->broken),
                "%d: got %s, expected %s\n", i, op[ret], op[e->ret]);
-        }
     }
 
 }
@@ -2486,11 +2468,7 @@ static void test_LocaleNameToLCID(void)
         while (*ptr->name)
         {
             lcid = pLocaleNameToLCID(ptr->name, 0);
-            if (ptr->todo)
-            todo_wine
-                ok(lcid == ptr->lcid, "%s: got wrong lcid 0x%04x, expected 0x%04x\n",
-                    wine_dbgstr_w(ptr->name), lcid, ptr->lcid);
-            else
+            todo_wine_if (ptr->todo)
                 ok(lcid == ptr->lcid, "%s: got wrong lcid 0x%04x, expected 0x%04x\n",
                     wine_dbgstr_w(ptr->name), lcid, ptr->lcid);
 
@@ -3934,16 +3912,10 @@ static void test_IdnToNameprepUnicode(void)
                 test_data[i].in_len, buf, sizeof(buf)/sizeof(WCHAR));
         err = GetLastError();
 
-        if (!test_data[i].todo)
-        {
+        todo_wine_if (test_data[i].todo)
             ok(ret == test_data[i].ret ||
                     broken(ret == test_data[i].broken_ret), "%d) ret = %d\n", i, ret);
-        }
-        else
-        {
-            todo_wine ok(ret == test_data[i].ret ||
-                    broken(ret == test_data[i].broken_ret), "%d) ret = %d\n", i, ret);
-        }
+
         if(ret != test_data[i].ret)
             continue;
 
@@ -4165,10 +4137,7 @@ static void test_GetLocaleInfoEx(void)
         {
             val = 0;
             pGetLocaleInfoEx(ptr->name, LOCALE_ILANGUAGE|LOCALE_RETURN_NUMBER, (WCHAR*)&val, sizeof(val)/sizeof(WCHAR));
-            if (ptr->todo)
-            todo_wine
-                ok(val == ptr->lcid, "%s: got wrong lcid 0x%04x, expected 0x%04x\n", wine_dbgstr_w(ptr->name), val, ptr->lcid);
-            else
+            todo_wine_if (ptr->todo)
                 ok(val == ptr->lcid, "%s: got wrong lcid 0x%04x, expected 0x%04x\n", wine_dbgstr_w(ptr->name), val, ptr->lcid);
             bufferW[0] = 0;
             ret = pGetLocaleInfoEx(ptr->name, LOCALE_SNAME, bufferW, sizeof(bufferW)/sizeof(WCHAR));




More information about the wine-cvs mailing list