Commit ad1a4ecd authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

crypt32/tests: Use todo_wine_if() in tests.

parent 9cf095a1
...@@ -2809,10 +2809,7 @@ static PCCERT_CHAIN_CONTEXT getChain(HCERTCHAINENGINE engine, ...@@ -2809,10 +2809,7 @@ static PCCERT_CHAIN_CONTEXT getChain(HCERTCHAINENGINE engine,
checkTime->wDay, checkTime->wMonth, checkTime->wYear); checkTime->wDay, checkTime->wMonth, checkTime->wYear);
ret = pCertGetCertificateChain(engine, endCert, &fileTime, ret = pCertGetCertificateChain(engine, endCert, &fileTime,
includeStore ? store : NULL, &chainPara, flags, NULL, &chain); includeStore ? store : NULL, &chainPara, flags, NULL, &chain);
if (todo & TODO_CHAIN) todo_wine_if (todo & TODO_CHAIN)
todo_wine ok(ret, "Chain %d: CertGetCertificateChain failed: %08x\n",
testIndex, GetLastError());
else
ok(ret, "Chain %d: CertGetCertificateChain failed: %08x\n", ok(ret, "Chain %d: CertGetCertificateChain failed: %08x\n",
testIndex, GetLastError()); testIndex, GetLastError());
CertFreeCertificateContext(endCert); CertFreeCertificateContext(endCert);
...@@ -2838,15 +2835,7 @@ static void checkElementStatus(const CERT_TRUST_STATUS *expected, ...@@ -2838,15 +2835,7 @@ static void checkElementStatus(const CERT_TRUST_STATUS *expected,
"%s[%d], element [%d,%d]: expected error %08x, got %08x\n", "%s[%d], element [%d,%d]: expected error %08x, got %08x\n",
testName, testIndex, chainIndex, elementIndex, expected->dwErrorStatus, testName, testIndex, chainIndex, elementIndex, expected->dwErrorStatus,
got->dwErrorStatus); got->dwErrorStatus);
else if (todo & TODO_ERROR) else todo_wine_if (todo & TODO_ERROR)
todo_wine
ok(got->dwErrorStatus == expected->dwErrorStatus ||
broken((got->dwErrorStatus & ~ignore->dwErrorStatus) ==
(expected->dwErrorStatus & ~ignore->dwErrorStatus)),
"%s[%d], element [%d,%d]: expected error %08x, got %08x\n",
testName, testIndex, chainIndex, elementIndex, expected->dwErrorStatus,
got->dwErrorStatus);
else
ok(got->dwErrorStatus == expected->dwErrorStatus || ok(got->dwErrorStatus == expected->dwErrorStatus ||
broken((got->dwErrorStatus & ~ignore->dwErrorStatus) == broken((got->dwErrorStatus & ~ignore->dwErrorStatus) ==
(expected->dwErrorStatus & ~ignore->dwErrorStatus)), (expected->dwErrorStatus & ~ignore->dwErrorStatus)),
...@@ -2859,15 +2848,7 @@ static void checkElementStatus(const CERT_TRUST_STATUS *expected, ...@@ -2859,15 +2848,7 @@ static void checkElementStatus(const CERT_TRUST_STATUS *expected,
"%s[%d], element [%d,%d]: expected info %08x, got %08x\n", "%s[%d], element [%d,%d]: expected info %08x, got %08x\n",
testName, testIndex, chainIndex, elementIndex, expected->dwInfoStatus, testName, testIndex, chainIndex, elementIndex, expected->dwInfoStatus,
got->dwInfoStatus); got->dwInfoStatus);
else if (todo & TODO_INFO) else todo_wine_if (todo & TODO_INFO)
todo_wine
ok(got->dwInfoStatus == expected->dwInfoStatus ||
broken((got->dwInfoStatus & ~ignore->dwInfoStatus) ==
(expected->dwInfoStatus & ~ignore->dwInfoStatus)),
"%s[%d], element [%d,%d]: expected info %08x, got %08x\n",
testName, testIndex, chainIndex, elementIndex, expected->dwInfoStatus,
got->dwInfoStatus);
else
ok(got->dwInfoStatus == expected->dwInfoStatus || ok(got->dwInfoStatus == expected->dwInfoStatus ||
broken((got->dwInfoStatus & ~ignore->dwInfoStatus) == broken((got->dwInfoStatus & ~ignore->dwInfoStatus) ==
(expected->dwInfoStatus & ~ignore->dwInfoStatus)), (expected->dwInfoStatus & ~ignore->dwInfoStatus)),
...@@ -2881,11 +2862,7 @@ static void checkSimpleChainStatus(const CERT_SIMPLE_CHAIN *simpleChain, ...@@ -2881,11 +2862,7 @@ static void checkSimpleChainStatus(const CERT_SIMPLE_CHAIN *simpleChain,
const CERT_TRUST_STATUS *ignore, DWORD todo, LPCSTR testName, DWORD testIndex, const CERT_TRUST_STATUS *ignore, DWORD todo, LPCSTR testName, DWORD testIndex,
DWORD chainIndex) DWORD chainIndex)
{ {
if (todo & TODO_ELEMENTS) todo_wine_if (todo & TODO_ELEMENTS)
todo_wine ok(simpleChain->cElement == simpleChainStatus->cElement,
"%s[%d]: expected %d elements, got %d\n", testName, testIndex,
simpleChainStatus->cElement, simpleChain->cElement);
else
ok(simpleChain->cElement == simpleChainStatus->cElement, ok(simpleChain->cElement == simpleChainStatus->cElement,
"%s[%d]: expected %d elements, got %d\n", testName, testIndex, "%s[%d]: expected %d elements, got %d\n", testName, testIndex,
simpleChainStatus->cElement, simpleChain->cElement); simpleChainStatus->cElement, simpleChain->cElement);
...@@ -2915,18 +2892,8 @@ static void checkChainStatus(PCCERT_CHAIN_CONTEXT chain, ...@@ -2915,18 +2892,8 @@ static void checkChainStatus(PCCERT_CHAIN_CONTEXT chain,
ok(chain->cChain == chainStatus->cChain, ok(chain->cChain == chainStatus->cChain,
"%s[%d]: expected %d simple chains, got %d\n", testName, testIndex, "%s[%d]: expected %d simple chains, got %d\n", testName, testIndex,
chainStatus->cChain, chain->cChain); chainStatus->cChain, chain->cChain);
if (todo & TODO_ERROR && todo_wine_if (todo & TODO_ERROR &&
chain->TrustStatus.dwErrorStatus != chainStatus->status.dwErrorStatus) chain->TrustStatus.dwErrorStatus != chainStatus->status.dwErrorStatus)
todo_wine ok(chain->TrustStatus.dwErrorStatus ==
chainStatus->status.dwErrorStatus ||
broken((chain->TrustStatus.dwErrorStatus &
~chainStatus->statusToIgnore.dwErrorStatus) ==
(chainStatus->status.dwErrorStatus &
~chainStatus->statusToIgnore.dwErrorStatus)),
"%s[%d]: expected error %08x, got %08x\n",
testName, testIndex, chainStatus->status.dwErrorStatus,
chain->TrustStatus.dwErrorStatus);
else
ok(chain->TrustStatus.dwErrorStatus == ok(chain->TrustStatus.dwErrorStatus ==
chainStatus->status.dwErrorStatus || chainStatus->status.dwErrorStatus ||
broken((chain->TrustStatus.dwErrorStatus & broken((chain->TrustStatus.dwErrorStatus &
...@@ -2937,18 +2904,8 @@ static void checkChainStatus(PCCERT_CHAIN_CONTEXT chain, ...@@ -2937,18 +2904,8 @@ static void checkChainStatus(PCCERT_CHAIN_CONTEXT chain,
"Verisign root certificate is available.\n", "Verisign root certificate is available.\n",
testName, testIndex, chainStatus->status.dwErrorStatus, testName, testIndex, chainStatus->status.dwErrorStatus,
chain->TrustStatus.dwErrorStatus, CERT_TRUST_IS_UNTRUSTED_ROOT); chain->TrustStatus.dwErrorStatus, CERT_TRUST_IS_UNTRUSTED_ROOT);
if (todo & TODO_INFO && todo_wine_if (todo & TODO_INFO &&
chain->TrustStatus.dwInfoStatus != chainStatus->status.dwInfoStatus) chain->TrustStatus.dwInfoStatus != chainStatus->status.dwInfoStatus)
todo_wine ok(chain->TrustStatus.dwInfoStatus ==
chainStatus->status.dwInfoStatus ||
broken((chain->TrustStatus.dwInfoStatus &
~chainStatus->statusToIgnore.dwInfoStatus) ==
(chainStatus->status.dwInfoStatus &
~chainStatus->statusToIgnore.dwInfoStatus)),
"%s[%d]: expected info %08x, got %08x\n",
testName, testIndex, chainStatus->status.dwInfoStatus,
chain->TrustStatus.dwInfoStatus);
else
ok(chain->TrustStatus.dwInfoStatus == ok(chain->TrustStatus.dwInfoStatus ==
chainStatus->status.dwInfoStatus || chainStatus->status.dwInfoStatus ||
broken((chain->TrustStatus.dwInfoStatus & broken((chain->TrustStatus.dwInfoStatus &
...@@ -4411,16 +4368,7 @@ static void checkChainPolicyStatus(LPCSTR policy, HCERTCHAINENGINE engine, ...@@ -4411,16 +4368,7 @@ static void checkChainPolicyStatus(LPCSTR policy, HCERTCHAINENGINE engine,
} }
if (ret) if (ret)
{ {
if (check->todo & TODO_ERROR) todo_wine_if (check->todo & TODO_ERROR)
todo_wine ok(policyStatus.dwError == check->status.dwError ||
broken(policyStatus.dwError == CERT_TRUST_NO_ERROR) ||
(check->brokenStatus && broken(policyStatus.dwError ==
check->brokenStatus->dwError)),
"%s[%d](%s): expected %08x, got %08x\n",
testName, testIndex,
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
check->status.dwError, policyStatus.dwError);
else
ok(policyStatus.dwError == check->status.dwError || ok(policyStatus.dwError == check->status.dwError ||
broken(policyStatus.dwError == CERT_TRUST_NO_ERROR) || broken(policyStatus.dwError == CERT_TRUST_NO_ERROR) ||
(check->brokenStatus && broken(policyStatus.dwError == (check->brokenStatus && broken(policyStatus.dwError ==
...@@ -4438,16 +4386,7 @@ static void checkChainPolicyStatus(LPCSTR policy, HCERTCHAINENGINE engine, ...@@ -4438,16 +4386,7 @@ static void checkChainPolicyStatus(LPCSTR policy, HCERTCHAINENGINE engine,
pCertFreeCertificateChain(chain); pCertFreeCertificateChain(chain);
return; return;
} }
if (check->todo & TODO_CHAINS) todo_wine_if (check->todo & TODO_CHAINS)
todo_wine ok(policyStatus.lChainIndex ==
check->status.lChainIndex ||
(check->brokenStatus && broken(policyStatus.lChainIndex ==
check->brokenStatus->lChainIndex)),
"%s[%d](%s): expected %d, got %d\n",
testName, testIndex,
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
check->status.lChainIndex, policyStatus.lChainIndex);
else
ok(policyStatus.lChainIndex == check->status.lChainIndex || ok(policyStatus.lChainIndex == check->status.lChainIndex ||
(check->brokenStatus && broken(policyStatus.lChainIndex == (check->brokenStatus && broken(policyStatus.lChainIndex ==
check->brokenStatus->lChainIndex)), check->brokenStatus->lChainIndex)),
...@@ -4455,21 +4394,12 @@ static void checkChainPolicyStatus(LPCSTR policy, HCERTCHAINENGINE engine, ...@@ -4455,21 +4394,12 @@ static void checkChainPolicyStatus(LPCSTR policy, HCERTCHAINENGINE engine,
testName, testIndex, testName, testIndex,
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy, IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
check->status.lChainIndex, policyStatus.lChainIndex); check->status.lChainIndex, policyStatus.lChainIndex);
if (check->todo & TODO_ELEMENTS) todo_wine_if (check->todo & TODO_ELEMENTS)
todo_wine ok(policyStatus.lElementIndex ==
check->status.lElementIndex ||
(check->brokenStatus && broken(policyStatus.lElementIndex ==
check->brokenStatus->lElementIndex)),
"%s[%d](%s): expected %d, got %d\n",
testName, testIndex,
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
check->status.lElementIndex, policyStatus.lElementIndex);
else
ok(policyStatus.lElementIndex == check->status.lElementIndex || ok(policyStatus.lElementIndex == check->status.lElementIndex ||
(check->brokenStatus && broken(policyStatus.lElementIndex == (check->brokenStatus && broken(policyStatus.lElementIndex ==
check->brokenStatus->lElementIndex)), check->brokenStatus->lElementIndex)),
testName, testIndex,
"%s[%d](%s): expected %d, got %d\n", "%s[%d](%s): expected %d, got %d\n",
testName, testIndex,
IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy, IS_INTOID(policy) ? num_to_str(LOWORD(policy)) : policy,
check->status.lElementIndex, policyStatus.lElementIndex); check->status.lElementIndex, policyStatus.lElementIndex);
} }
......
...@@ -317,11 +317,7 @@ static void compareStore(HCERTSTORE store, LPCSTR name, const BYTE *pb, ...@@ -317,11 +317,7 @@ static void compareStore(HCERTSTORE store, LPCSTR name, const BYTE *pb,
ret = CertSaveStore(store, X509_ASN_ENCODING, CERT_STORE_SAVE_AS_STORE, ret = CertSaveStore(store, X509_ASN_ENCODING, CERT_STORE_SAVE_AS_STORE,
CERT_STORE_SAVE_TO_MEMORY, &blob, 0); CERT_STORE_SAVE_TO_MEMORY, &blob, 0);
ok(ret, "CertSaveStore failed: %08x\n", GetLastError()); ok(ret, "CertSaveStore failed: %08x\n", GetLastError());
if (todo) todo_wine_if (todo)
todo_wine
ok(blob.cbData == cb, "%s: expected size %d, got %d\n", name, cb,
blob.cbData);
else
ok(blob.cbData == cb, "%s: expected size %d, got %d\n", name, cb, ok(blob.cbData == cb, "%s: expected size %d, got %d\n", name, cb,
blob.cbData); blob.cbData);
blob.pbData = HeapAlloc(GetProcessHeap(), 0, blob.cbData); blob.pbData = HeapAlloc(GetProcessHeap(), 0, blob.cbData);
...@@ -330,10 +326,7 @@ static void compareStore(HCERTSTORE store, LPCSTR name, const BYTE *pb, ...@@ -330,10 +326,7 @@ static void compareStore(HCERTSTORE store, LPCSTR name, const BYTE *pb,
ret = CertSaveStore(store, X509_ASN_ENCODING, CERT_STORE_SAVE_AS_STORE, ret = CertSaveStore(store, X509_ASN_ENCODING, CERT_STORE_SAVE_AS_STORE,
CERT_STORE_SAVE_TO_MEMORY, &blob, 0); CERT_STORE_SAVE_TO_MEMORY, &blob, 0);
ok(ret, "CertSaveStore failed: %08x\n", GetLastError()); ok(ret, "CertSaveStore failed: %08x\n", GetLastError());
if (todo) todo_wine_if (todo)
todo_wine
ok(!memcmp(pb, blob.pbData, cb), "%s: unexpected value\n", name);
else
ok(!memcmp(pb, blob.pbData, cb), "%s: unexpected value\n", name); ok(!memcmp(pb, blob.pbData, cb), "%s: unexpected value\n", name);
HeapFree(GetProcessHeap(), 0, blob.pbData); HeapFree(GetProcessHeap(), 0, blob.pbData);
} }
......
...@@ -254,16 +254,7 @@ static void test_CertRDNValueToStrA(void) ...@@ -254,16 +254,7 @@ static void test_CertRDNValueToStrA(void)
{ {
ret = pCertRDNValueToStrA(attrs[i].dwValueType, &attrs[i].Value, ret = pCertRDNValueToStrA(attrs[i].dwValueType, &attrs[i].Value,
buffer, sizeof(buffer)); buffer, sizeof(buffer));
if (attrs[i].todo) todo_wine_if (attrs[i].todo)
{
todo_wine
ok(ret == strlen(attrs[i].str) + 1, "Expected length %d, got %d\n",
lstrlenA(attrs[i].str) + 1, ret);
todo_wine
ok(!strcmp(buffer, attrs[i].str), "Expected %s, got %s\n",
attrs[i].str, buffer);
}
else
{ {
ok(ret == strlen(attrs[i].str) + 1, "Expected length %d, got %d\n", ok(ret == strlen(attrs[i].str) + 1, "Expected length %d, got %d\n",
lstrlenA(attrs[i].str) + 1, ret); lstrlenA(attrs[i].str) + 1, ret);
...@@ -359,16 +350,7 @@ static void test_CertRDNValueToStrW(void) ...@@ -359,16 +350,7 @@ static void test_CertRDNValueToStrW(void)
{ {
ret = pCertRDNValueToStrW(attrs[i].dwValueType, &attrs[i].Value, ret = pCertRDNValueToStrW(attrs[i].dwValueType, &attrs[i].Value,
buffer, sizeof(buffer) / sizeof(buffer[0])); buffer, sizeof(buffer) / sizeof(buffer[0]));
if (attrs[i].todo) todo_wine_if (attrs[i].todo)
{
todo_wine
ok(ret == lstrlenW(attrs[i].str) + 1,
"Expected length %d, got %d\n", lstrlenW(attrs[i].str) + 1, ret);
todo_wine
ok(!lstrcmpW(buffer, attrs[i].str), "Expected %s, got %s\n",
wine_dbgstr_w(attrs[i].str), wine_dbgstr_w(buffer));
}
else
{ {
ok(ret == lstrlenW(attrs[i].str) + 1, ok(ret == lstrlenW(attrs[i].str) + 1,
"Expected length %d, got %d\n", lstrlenW(attrs[i].str) + 1, ret); "Expected length %d, got %d\n", lstrlenW(attrs[i].str) + 1, ret);
...@@ -394,27 +376,15 @@ static void test_NameToStrConversionA(PCERT_NAME_BLOB pName, DWORD dwStrType, ...@@ -394,27 +376,15 @@ static void test_NameToStrConversionA(PCERT_NAME_BLOB pName, DWORD dwStrType,
DWORD i; DWORD i;
i = pCertNameToStrA(X509_ASN_ENCODING, pName, dwStrType, NULL, 0); i = pCertNameToStrA(X509_ASN_ENCODING, pName, dwStrType, NULL, 0);
if (todo) todo_wine_if (todo)
todo_wine
ok(i == strlen(expected) + 1, "Expected %d chars, got %d\n",
lstrlenA(expected) + 1, i);
else
ok(i == strlen(expected) + 1, "Expected %d chars, got %d\n", ok(i == strlen(expected) + 1, "Expected %d chars, got %d\n",
lstrlenA(expected) + 1, i); lstrlenA(expected) + 1, i);
i = pCertNameToStrA(X509_ASN_ENCODING,pName, dwStrType, buffer, i = pCertNameToStrA(X509_ASN_ENCODING,pName, dwStrType, buffer,
sizeof(buffer)); sizeof(buffer));
if (todo) todo_wine_if (todo)
todo_wine
ok(i == strlen(expected) + 1, "Expected %d chars, got %d\n",
lstrlenA(expected) + 1, i);
else
ok(i == strlen(expected) + 1, "Expected %d chars, got %d\n", ok(i == strlen(expected) + 1, "Expected %d chars, got %d\n",
lstrlenA(expected) + 1, i); lstrlenA(expected) + 1, i);
if (todo) todo_wine_if (todo)
todo_wine
ok(!strcmp(buffer, expected), "Expected %s, got %s\n", expected,
buffer);
else
ok(!strcmp(buffer, expected), "Expected %s, got %s\n", expected, ok(!strcmp(buffer, expected), "Expected %s, got %s\n", expected,
buffer); buffer);
} }
...@@ -577,24 +547,15 @@ static void test_NameToStrConversionW(PCERT_NAME_BLOB pName, DWORD dwStrType, ...@@ -577,24 +547,15 @@ static void test_NameToStrConversionW(PCERT_NAME_BLOB pName, DWORD dwStrType,
DWORD i; DWORD i;
i = pCertNameToStrW(X509_ASN_ENCODING,pName, dwStrType, NULL, 0); i = pCertNameToStrW(X509_ASN_ENCODING,pName, dwStrType, NULL, 0);
if (todo) todo_wine_if (todo)
todo_wine ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %d\n",
lstrlenW(expected) + 1, i);
else
ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %d\n", ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %d\n",
lstrlenW(expected) + 1, i); lstrlenW(expected) + 1, i);
i = pCertNameToStrW(X509_ASN_ENCODING,pName, dwStrType, buffer, i = pCertNameToStrW(X509_ASN_ENCODING,pName, dwStrType, buffer,
sizeof(buffer) / sizeof(buffer[0])); sizeof(buffer) / sizeof(buffer[0]));
if (todo) todo_wine_if (todo)
todo_wine ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %d\n",
lstrlenW(expected) + 1, i);
else
ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %d\n", ok(i == lstrlenW(expected) + 1, "Expected %d chars, got %d\n",
lstrlenW(expected) + 1, i); lstrlenW(expected) + 1, i);
if (todo) todo_wine_if (todo)
todo_wine ok(!lstrcmpW(buffer, expected), "Expected %s, got %s\n",
wine_dbgstr_w(expected), wine_dbgstr_w(buffer));
else
ok(!lstrcmpW(buffer, expected), "Expected %s, got %s\n", ok(!lstrcmpW(buffer, expected), "Expected %s, got %s\n",
wine_dbgstr_w(expected), wine_dbgstr_w(buffer)); wine_dbgstr_w(expected), wine_dbgstr_w(buffer));
} }
......
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