Author: pschweitzer
Date: Mon May 25 11:14:12 2015
New Revision: 67900
URL:
http://svn.reactos.org/svn/reactos?rev=67900&view=rev
Log:
[KERNEL32_APITEST]
Add more tests for tunnel cache
Modified:
trunk/rostests/apitests/kernel32/TunnelCache.c
Modified: trunk/rostests/apitests/kernel32/TunnelCache.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/TunnelC…
==============================================================================
--- trunk/rostests/apitests/kernel32/TunnelCache.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/kernel32/TunnelCache.c [iso-8859-1] Mon May 25 11:14:12 2015
@@ -10,6 +10,92 @@
#define WIN32_NO_STATUS
#include <stdio.h>
#include <ndk/rtlfuncs.h>
+
+static
+void
+Test_LongTests(void)
+{
+ UCHAR i = 0;
+ HANDLE hFile;
+ CHAR TestDir[] = "XTestDirTunnelCache";
+ CHAR OldDir[MAX_PATH];
+ FILETIME FileTime, File1Time;
+
+ /* Create a blank test directory */
+ if (GetCurrentDirectory(MAX_PATH, OldDir) == 0)
+ {
+ win_skip("No test directory available\n");
+ return;
+ }
+
+ /* Create a blank test directory */
+ for (; i < 10; ++i)
+ {
+ TestDir[0] = '0' + i;
+ if (CreateDirectory(TestDir, NULL))
+ {
+ if (SetCurrentDirectory(TestDir) == 0)
+ {
+ RemoveDirectory(TestDir);
+ win_skip("No test directory available\n");
+ return;
+ }
+
+ break;
+ }
+ }
+
+ if (i == 10)
+ {
+ win_skip("No test directory available\n");
+ return;
+ }
+
+ hFile = CreateFile("file1",
+ GENERIC_READ | GENERIC_WRITE,
+ 0, NULL,
+ CREATE_NEW,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+ ok(hFile != INVALID_HANDLE_VALUE, "CreateFile() failed\n");
+ ok(GetFileTime(hFile, &FileTime, NULL, NULL) != FALSE, "GetFileTime()
failed\n");
+ CloseHandle(hFile);
+
+ /* Wait a least 10ms (resolution of FAT) */
+ /* XXX: Increased to 1s for ReactOS... */
+ Sleep(1000);
+
+ hFile = CreateFile("file2",
+ GENERIC_READ | GENERIC_WRITE,
+ 0, NULL,
+ CREATE_NEW,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+ ok(hFile != INVALID_HANDLE_VALUE, "CreateFile() failed\n");
+ CloseHandle(hFile);
+
+ ok(MoveFile("file1", "file") != FALSE, "MoveFile()
failed\n");
+ ok(MoveFile("file2", "file1") != FALSE, "MoveFile()
failed\n");
+
+ hFile = CreateFile("file1",
+ GENERIC_READ,
+ 0, NULL,
+ OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+ ok(hFile != INVALID_HANDLE_VALUE, "CreateFile() failed\n");
+ ok(GetFileTime(hFile, &File1Time, NULL, NULL) != FALSE, "GetFileTime()
failed\n");
+ CloseHandle(hFile);
+
+ ok(RtlCompareMemory(&FileTime, &File1Time, sizeof(FILETIME)) ==
sizeof(FILETIME), "Tunnel cache failed\n");
+
+ DeleteFile("file2");
+ DeleteFile("file1");
+ DeleteFile("file");
+
+ SetCurrentDirectory(OldDir);
+ RemoveDirectory(TestDir);
+}
static
void
@@ -98,4 +184,5 @@
START_TEST(TunnelCache)
{
Test_ShortTests();
+ Test_LongTests();
}