From: Pierre Schweitzer Date: Sun, 30 Mar 2014 18:25:13 +0000 (+0000) Subject: [TUNNELTEST] X-Git-Tag: backups/0.3.17@66124~1879 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=b6aa0990cdc57c673af489bba99e4d178f102e43 [TUNNELTEST] Reshuffle the test a bit so that it clearly fails on ReactOS: - Gather creation timestamp right after the first creation and always compare to it. This is to workaround the move = copy + delete hack from ReactOS which is resetting the timestamps (and thus making the test pass ;-)). - Wait more than 20ms (1s). If Microsoft FastFAT has a creation resolution of 10ms, we don't. So it would hide the thing as well. With such changes, the test still works on Windows, whereas it fails on ReactOS CORE-7272 svn path=/trunk/; revision=62589 --- diff --git a/rostests/win32/fs/tunneltest/tunneltest.c b/rostests/win32/fs/tunneltest/tunneltest.c index 89c63cfb04a..e9c34d58e19 100644 --- a/rostests/win32/fs/tunneltest/tunneltest.c +++ b/rostests/win32/fs/tunneltest/tunneltest.c @@ -75,10 +75,21 @@ int wmain(int argc, WCHAR * argv[]) fprintf(stderr, "Failed to create file1\n"); return GetLastError(); } + + /* Get its creation timestamp. It will be our reference */ + /* Get it in FileTime because file1 will renamed to file */ + if (GetFileTime(hFile, &FileTime, NULL, NULL) == FALSE) + { + fprintf(stderr, "Failed to read creation time\n"); + CloseHandle(hFile); + return GetLastError(); + } + CloseHandle(hFile); /* Wait a least 10ms (resolution of FAT) */ - Sleep(10 * 2); + /* XXX: Increased to 1s for ReactOS... */ + Sleep(1000); /* Create second file */ /* Remove old file from buffer */ @@ -114,24 +125,6 @@ int wmain(int argc, WCHAR * argv[]) return GetLastError(); } - /* Time to compare creation time of both file & file1 */ - CopyPath[wcslen(TempPath) - 1] = 0; - - /* Open file and get its creation time */ - hFile = CreateFileW(CopyPath, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (hFile == INVALID_HANDLE_VALUE) - { - fprintf(stderr, "Failed to open file\n"); - return GetLastError(); - } - if (GetFileTime(hFile, &FileTime, NULL, NULL) == FALSE) - { - fprintf(stderr, "Failed to read creation time\n"); - CloseHandle(hFile); - return GetLastError(); - } - CloseHandle(hFile); - /* Open file1 and get its creation time */ hFile = CreateFileW(TempPath, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) @@ -147,7 +140,8 @@ int wmain(int argc, WCHAR * argv[]) } CloseHandle(hFile); - /* Delete file */ + /* Delete files */ + CopyPath[wcslen(TempPath) - 1] = 0; DeleteFileW(TempPath); DeleteFileW(CopyPath);