kernel32: Log more information in case of a test failure, and don't run tests that are guaranteed to fail.

This commit is contained in:
Juan Lang 2009-02-12 14:15:22 -08:00 committed by Alexandre Julliard
parent 0edcef6d5e
commit 5dd87ec9b1
1 changed files with 26 additions and 21 deletions

View File

@ -2217,27 +2217,32 @@ static void test_ReplaceFileA(void)
/* make sure that the "replaced" file has the size of the replacement file */ /* make sure that the "replaced" file has the size of the replacement file */
hReplacedFile = CreateFileA(replaced, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0); hReplacedFile = CreateFileA(replaced, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
ok(hReplacedFile != INVALID_HANDLE_VALUE, ok(hReplacedFile != INVALID_HANDLE_VALUE,
"failed to open replaced file\n"); "failed to open replaced file: %d\n", GetLastError());
ret = GetFileSize(hReplacedFile, NULL); if (hReplacedFile != INVALID_HANDLE_VALUE)
ok(ret == sizeof(replacementData), {
"replaced file has wrong size %d\n", ret); ret = GetFileSize(hReplacedFile, NULL);
/* make sure that the replacement file no-longer exists */ ok(ret == sizeof(replacementData),
hReplacementFile = CreateFileA(replacement, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0); "replaced file has wrong size %d\n", ret);
ok(hReplacementFile == INVALID_HANDLE_VALUE, /* make sure that the replacement file no-longer exists */
"unexpected error, replacement file should not exist %d\n", GetLastError()); hReplacementFile = CreateFileA(replacement, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
/* make sure that the backup has the old "replaced" filetime */ ok(hReplacementFile == INVALID_HANDLE_VALUE,
ret = GetFileTime(hBackupFile, NULL, NULL, &ftBackup); "unexpected error, replacement file should not exist %d\n", GetLastError());
ok( ret, "GetFileTime error (backup %d\n", GetLastError()); /* make sure that the backup has the old "replaced" filetime */
ok(check_file_time(&ftBackup, &ftReplaced, 20000000), "backup file has wrong filetime\n"); ret = GetFileTime(hBackupFile, NULL, NULL, &ftBackup);
CloseHandle(hBackupFile); ok( ret, "GetFileTime error (backup %d\n", GetLastError());
/* make sure that the "replaced" has the old replacement filetime */ ok(check_file_time(&ftBackup, &ftReplaced, 20000000), "backup file has wrong filetime\n");
ret = GetFileTime(hReplacedFile, NULL, NULL, &ftReplaced); CloseHandle(hBackupFile);
ok( ret, "GetFileTime error (backup %d\n", GetLastError()); /* make sure that the "replaced" has the old replacement filetime */
ok(check_file_time(&ftReplaced, &ftReplacement, 20000000), ret = GetFileTime(hReplacedFile, NULL, NULL, &ftReplaced);
"replaced file has wrong filetime %x%08x / %x%08x\n", ok( ret, "GetFileTime error (backup %d\n", GetLastError());
ftReplaced.dwHighDateTime, ftReplaced.dwLowDateTime, ok(check_file_time(&ftReplaced, &ftReplacement, 20000000),
ftReplacement.dwHighDateTime, ftReplacement.dwLowDateTime ); "replaced file has wrong filetime %x%08x / %x%08x\n",
CloseHandle(hReplacedFile); ftReplaced.dwHighDateTime, ftReplaced.dwLowDateTime,
ftReplacement.dwHighDateTime, ftReplacement.dwLowDateTime );
CloseHandle(hReplacedFile);
}
else
skip("couldn't open replacement file, skipping tests\n");
/* re-create replacement file for pass w/o backup (blank) */ /* re-create replacement file for pass w/o backup (blank) */
ret = GetTempFileNameA(temp_path, prefix, 0, replacement); ret = GetTempFileNameA(temp_path, prefix, 0, replacement);