wer/tests: Enable compilation with long types.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-03-08 09:31:47 +01:00 committed by Alexandre Julliard
parent 2fec470ade
commit f42ab60a01
2 changed files with 41 additions and 42 deletions

View File

@ -1,4 +1,3 @@
EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = wer.dll
IMPORTS = wer

View File

@ -42,43 +42,43 @@ static void test_WerAddExcludedApplication(void)
/* clean state */
hr = WerRemoveExcludedApplication(winetest_wer, FALSE);
ok((hr == S_OK) || (hr == E_FAIL) || (hr == __HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND)),
"got 0x%x (expected S_OK, E_FAIL or HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND))\n", hr);
"got 0x%lx (expected S_OK, E_FAIL or HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND))\n", hr);
hr = WerAddExcludedApplication(NULL, FALSE);
ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
ok(hr == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hr);
hr = WerAddExcludedApplication(L"", FALSE);
ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
ok(hr == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hr);
hr = WerAddExcludedApplication(winetest_wer, FALSE);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
/* app already in the list */
hr = WerAddExcludedApplication(winetest_wer, FALSE);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
/* cleanup */
hr = WerRemoveExcludedApplication(winetest_wer, FALSE);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
/* appname has a path */
res = GetWindowsDirectoryW(buffer, ARRAY_SIZE(buffer));
if (res > 0) {
/* the last part from the path is added to the inclusion list */
hr = WerAddExcludedApplication(buffer, FALSE);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
hr = WerRemoveExcludedApplication(buffer, FALSE);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
lstrcatW(buffer, L"\\");
hr = WerAddExcludedApplication(buffer, FALSE);
ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
ok(hr == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hr);
lstrcatW(buffer, winetest_wer);
hr = WerAddExcludedApplication(buffer, FALSE);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
hr = WerRemoveExcludedApplication(buffer, FALSE);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
}
}
@ -94,49 +94,49 @@ static void test_WerRemoveExcludedApplication(void)
/* clean state */
hr = WerRemoveExcludedApplication(winetest_wer, FALSE);
ok((hr == S_OK) || (hr == E_FAIL) || (hr == __HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND)),
"got 0x%x (expected S_OK, E_FAIL or HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND))\n", hr);
"got 0x%lx (expected S_OK, E_FAIL or HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND))\n", hr);
hr = WerAddExcludedApplication(winetest_wer, FALSE);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
hr = WerRemoveExcludedApplication(NULL, FALSE);
ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
ok(hr == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hr);
hr = WerRemoveExcludedApplication(L"", FALSE);
ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
ok(hr == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hr);
hr = WerRemoveExcludedApplication(winetest_wer, FALSE);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
/* app not in the list */
hr = WerRemoveExcludedApplication(winetest_wer, FALSE);
ok((hr == E_FAIL) || (hr == __HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND)),
"got 0x%x (expected E_FAIL or HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND))\n", hr);
"got 0x%lx (expected E_FAIL or HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND))\n", hr);
/* appname has a path */
res = GetWindowsDirectoryW(buffer, ARRAY_SIZE(buffer));
if (res > 0) {
hr = WerRemoveExcludedApplication(buffer, FALSE);
ok((hr == E_FAIL) || (hr == __HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND)),
"got 0x%x (expected E_FAIL or HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND))\n", hr);
"got 0x%lx (expected E_FAIL or HRESULT_FROM_WIN32(ERROR_ENVVAR_NOT_FOUND))\n", hr);
/* the last part from the path is added to the inclusion list */
hr = WerAddExcludedApplication(buffer, FALSE);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
hr = WerRemoveExcludedApplication(buffer, FALSE);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
lstrcatW(buffer, L"\\");
hr = WerAddExcludedApplication(buffer, FALSE);
ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
ok(hr == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hr);
hr = WerRemoveExcludedApplication(buffer, FALSE);
ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
ok(hr == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hr);
lstrcatW(buffer, winetest_wer);
hr = WerAddExcludedApplication(buffer, FALSE);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
hr = WerRemoveExcludedApplication(buffer, FALSE);
ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
ok(hr == S_OK, "got 0x%lx (expected S_OK)\n", hr);
}
}
@ -149,7 +149,7 @@ static void test_WerReportCloseHandle(void)
report = (void *) 0xdeadbeef;
hr = WerReportCreate(L"APPCRASH", WerReportCritical, NULL, &report);
ok(hr == S_OK, "got 0x%x and %p (expected S_OK)\n", hr, report);
ok(hr == S_OK, "got 0x%lx and %p (expected S_OK)\n", hr, report);
if (!report) {
skip("Nothing left to test\n");
@ -158,14 +158,14 @@ static void test_WerReportCloseHandle(void)
/* close the handle */
hr = WerReportCloseHandle(report);
ok(hr == S_OK, "got 0x%x for %p (expected S_OK)\n", hr, report);
ok(hr == S_OK, "got 0x%lx for %p (expected S_OK)\n", hr, report);
/* close the handle again */
hr = WerReportCloseHandle(report);
ok(hr == E_INVALIDARG, "got 0x%x for %p again (expected E_INVALIDARG)\n", hr, report);
ok(hr == E_INVALIDARG, "got 0x%lx for %p again (expected E_INVALIDARG)\n", hr, report);
hr = WerReportCloseHandle(NULL);
ok(hr == E_INVALIDARG, "got 0x%x for NULL(expected E_INVALIDARG)\n", hr);
ok(hr == E_INVALIDARG, "got 0x%lx for NULL(expected E_INVALIDARG)\n", hr);
}
/* #### */
@ -180,7 +180,7 @@ static void test_WerReportCreate(void)
report = (void *) 0xdeadbeef;
/* test a simple valid case */
hr = WerReportCreate(L"APPCRASH", WerReportCritical, NULL, &report);
ok(hr == S_OK, "got 0x%x and %p (expected S_OK)\n", hr, report);
ok(hr == S_OK, "got 0x%lx and %p (expected S_OK)\n", hr, report);
if (!report) {
skip("Nothing left to test\n");
@ -188,29 +188,29 @@ static void test_WerReportCreate(void)
}
hr = WerReportCloseHandle(report);
ok(hr == S_OK, "got 0x%x for %p (expected S_OK)\n", hr, report);
ok(hr == S_OK, "got 0x%lx for %p (expected S_OK)\n", hr, report);
/* the ptr to store the created handle is always needed */
hr = WerReportCreate(L"APPCRASH", WerReportCritical, NULL, NULL);
ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
ok(hr == E_INVALIDARG, "got 0x%lx (expected E_INVALIDARG)\n", hr);
/* the event type must be a valid string */
report = (void *) 0xdeadbeef;
hr = WerReportCreate(NULL, WerReportCritical, NULL, &report);
ok(hr == E_INVALIDARG, "got 0x%x and %p(expected E_INVALIDARG)\n", hr, report);
ok(hr == E_INVALIDARG, "got 0x%lx and %p(expected E_INVALIDARG)\n", hr, report);
report = (void *) 0xdeadbeef;
hr = WerReportCreate(L"", WerReportCritical, NULL, &report);
ok(hr == E_INVALIDARG, "got 0x%x and %p(expected E_INVALIDARG)\n", hr, report);
ok(hr == E_INVALIDARG, "got 0x%lx and %p(expected E_INVALIDARG)\n", hr, report);
/* a valid WER_REPORT_TYPE works */
for (i = 0; i < WerReportInvalid; i++) {
report = (void *) 0xdeadbeef;
hr = WerReportCreate(L"APPCRASH", i, NULL, &report);
ok(hr == S_OK, "%d: got 0x%x and %p (expected S_OK)\n", i, hr, report);
ok(hr == S_OK, "%d: got 0x%lx and %p (expected S_OK)\n", i, hr, report);
hr = WerReportCloseHandle(report);
ok(hr == S_OK, "%d: got 0x%x for %p (expected S_OK)\n", i, hr, report);
ok(hr == S_OK, "%d: got 0x%lx for %p (expected S_OK)\n", i, hr, report);
}
@ -220,19 +220,19 @@ static void test_WerReportCreate(void)
report = (void *) 0xdeadbeef;
hr = WerReportCreate(L"APPCRASH", WerReportInvalid, NULL, &report);
ok((hr == E_INVALIDARG) | broken(hr == S_OK),
"%d: got 0x%x and %p (expected E_INVALIDARG or a broken S_OK)\n", i, hr, report);
"%d: got 0x%lx and %p (expected E_INVALIDARG or a broken S_OK)\n", i, hr, report);
if (hr == S_OK) {
hr = WerReportCloseHandle(report);
ok(hr == S_OK, "%d: got 0x%x for %p (expected S_OK)\n", i, hr, report);
ok(hr == S_OK, "%d: got 0x%lx for %p (expected S_OK)\n", i, hr, report);
}
report = (void *) 0xdeadbeef;
hr = WerReportCreate(L"APPCRASH", 42, NULL, &report);
ok((hr == E_INVALIDARG) | broken(hr == S_OK),
"%d: got 0x%x and %p (expected E_INVALIDARG or a broken S_OK)\n", i, hr, report);
"%d: got 0x%lx and %p (expected E_INVALIDARG or a broken S_OK)\n", i, hr, report);
if (hr == S_OK) {
hr = WerReportCloseHandle(report);
ok(hr == S_OK, "%d: got 0x%x for %p (expected S_OK)\n", i, hr, report);
ok(hr == S_OK, "%d: got 0x%lx for %p (expected S_OK)\n", i, hr, report);
}
/* multiple active reports are possible */
@ -240,13 +240,13 @@ static void test_WerReportCreate(void)
for (i = 0; i < (ARRAY_SIZE(table) - 1); i++) {
report = (void *) 0xdeadbeef;
hr = WerReportCreate(L"APPCRASH", WerReportCritical, NULL, &table[i]);
ok(hr == S_OK, "%02d: got 0x%x and %p (expected S_OK)\n", i, hr, table[i]);
ok(hr == S_OK, "%02d: got 0x%lx and %p (expected S_OK)\n", i, hr, table[i]);
}
while (i > 0) {
i--;
hr = WerReportCloseHandle(table[i]);
ok(hr == S_OK, "got 0x%x for %p (expected S_OK)\n", hr, table[i]);
ok(hr == S_OK, "got 0x%lx for %p (expected S_OK)\n", hr, table[i]);
}
}