Commit a0ec5fec authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

kernel32/tests: Use todo_wine_if() in tests.

parent 1bb4b7ec
......@@ -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++;
......
......@@ -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);
}
......
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment