advapi32/tests: Fix test failures on Vista and higher for multiple runs.

This commit is contained in:
Paul Vriens 2009-11-23 09:35:08 +01:00 committed by Alexandre Julliard
parent 88bd52daaf
commit b5446ea525
1 changed files with 10 additions and 9 deletions

View File

@ -769,9 +769,10 @@ static void test_readwrite(void)
ok(ret, "Expected success : %d\n", GetLastError()); ok(ret, "Expected success : %d\n", GetLastError());
/* This will clear the eventlog. The record numbering for new /* This will clear the eventlog. The record numbering for new
* events however differs on Vista+. Before Vista the first * events however differs on Vista SP1+. Before Vista the first
* event would be numbered 1, on Vista+ it's now 2 as we already * event would be numbered 1, on Vista SP1+ it's higher as we already
* had one event. * had at least one event (more in case of multiple test runs without
* a reboot).
*/ */
ClearEventLogA(handle, NULL); ClearEventLogA(handle, NULL);
CloseEventLog(handle); CloseEventLog(handle);
@ -803,9 +804,9 @@ static void test_readwrite(void)
ret = GetOldestEventLogRecord(handle, &oldest); ret = GetOldestEventLogRecord(handle, &oldest);
ok(ret, "Expected success\n"); ok(ret, "Expected success\n");
ok(oldest == 1 || ok(oldest == 1 ||
oldest == 2, /* Vista SP1, W2K8 and Win7 */ (oldest > 1 && oldest != 0xdeadbeef), /* Vista SP1+, W2K8 and Win7 */
"Expected oldest to be 1 or 2, got %d\n", oldest); "Expected oldest to be 1 or higher, got %d\n", oldest);
if (oldest == 2) if (oldest > 1 && oldest != 0xdeadbeef)
on_vista = TRUE; on_vista = TRUE;
if (i % 2) if (i % 2)
@ -830,7 +831,7 @@ static void test_readwrite(void)
/* Report only once */ /* Report only once */
if (on_vista) if (on_vista)
skip("There is no DWORD alignment for UserSid on Vista, W2K8 or Win7\n"); skip("There is no DWORD alignment enforced for UserSid on Vista, W2K8 or Win7\n");
/* Read all events from our created eventlog, one by one */ /* Read all events from our created eventlog, one by one */
handle = OpenEventLogA(NULL, eventlogname); handle = OpenEventLogA(NULL, eventlogname);
@ -870,8 +871,8 @@ static void test_readwrite(void)
ok(record->Reserved == 0x654c664c, ok(record->Reserved == 0x654c664c,
"Expected 0x654c664c, got %d\n", record->Reserved); "Expected 0x654c664c, got %d\n", record->Reserved);
ok(record->RecordNumber == i + 1 || ok(record->RecordNumber == i + 1 ||
(on_vista && (record->RecordNumber == i + 2)), (on_vista && (record->RecordNumber > i + 1)),
"Expected %d or %d, got %d\n", i + 1, i + 2, record->RecordNumber); "Expected %d or higher, got %d\n", i + 1, record->RecordNumber);
ok(record->EventID == read_write[i].evt_id, ok(record->EventID == read_write[i].evt_id,
"Expected %d, got %d\n", read_write[i].evt_id, record->EventID); "Expected %d, got %d\n", read_write[i].evt_id, record->EventID);
ok(record->EventType == read_write[i].evt_type, ok(record->EventType == read_write[i].evt_type,