Author: pschweitzer
Date: Mon May 25 10:30:12 2015
New Revision: 67897
URL:
http://svn.reactos.org/svn/reactos?rev=67897&view=rev
Log:
[KERNEL32_APITEST]
Add simple tests regarding renaming and tunnel cache behavior for short names in user
mode.
Longer tests should be added to show what happens in case of cache expiry.
All pass on w2k3 but not on ReactOS.
CORE-3875
Added:
trunk/rostests/apitests/kernel32/TunnelCache.c (with props)
Modified:
trunk/rostests/apitests/kernel32/CMakeLists.txt
trunk/rostests/apitests/kernel32/testlist.c
Modified: trunk/rostests/apitests/kernel32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/CMakeLi…
==============================================================================
--- trunk/rostests/apitests/kernel32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/kernel32/CMakeLists.txt [iso-8859-1] Mon May 25 10:30:12 2015
@@ -12,6 +12,7 @@
SetCurrentDirectory.c
SetUnhandledExceptionFilter.c
TerminateProcess.c
+ TunnelCache.c
testlist.c)
add_executable(kernel32_apitest ${SOURCE})
Added: trunk/rostests/apitests/kernel32/TunnelCache.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/TunnelC…
==============================================================================
--- trunk/rostests/apitests/kernel32/TunnelCache.c (added)
+++ trunk/rostests/apitests/kernel32/TunnelCache.c [iso-8859-1] Mon May 25 10:30:12 2015
@@ -0,0 +1,101 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPLv2+ - See COPYING in the top level directory
+ * PURPOSE: Tests for Tunnel Cache
+ * PROGRAMMER: Pierre Schweitzer <pierre.schweitzer(a)reactos.org>
+ */
+
+#include <apitest.h>
+
+#define WIN32_NO_STATUS
+#include <stdio.h>
+#include <ndk/rtlfuncs.h>
+
+static
+void
+Test_ShortTests(void)
+{
+ UCHAR i = 0;
+ CHAR ShortName[14];
+ HANDLE hFile, hFind;
+ WIN32_FIND_DATA FileInfo;
+ CHAR TestDir[] = "XTestDirTunnelCache";
+ CHAR OldDir[MAX_PATH];
+
+ /* 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("verylongfilename",
+ GENERIC_READ | GENERIC_WRITE,
+ 0, NULL,
+ CREATE_NEW,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+ ok(hFile != INVALID_HANDLE_VALUE, "CreateFile() failed\n");
+ CloseHandle(hFile);
+
+ hFind = FindFirstFile("verylongfilename", &FileInfo);
+ ok(hFind != INVALID_HANDLE_VALUE, "FindFirstFile() failed\n");
+ FindClose(hFind);
+ RtlCopyMemory(ShortName, FileInfo.cAlternateFileName, sizeof(ShortName));
+
+ ok(MoveFile("verylongfilename", "verylongfilename2") != FALSE,
"MoveFile() failed\n");
+ hFind = FindFirstFile("verylongfilename2", &FileInfo);
+ ok(hFind != INVALID_HANDLE_VALUE, "FindFirstFile() failed\n");
+ FindClose(hFind);
+ ok(strcmp(FileInfo.cAlternateFileName, ShortName) == 0, "strcmp()
failed\n");
+
+ hFile = CreateFile("randomfilename",
+ GENERIC_READ | GENERIC_WRITE,
+ 0, NULL,
+ CREATE_NEW,
+ FILE_ATTRIBUTE_NORMAL,
+ NULL);
+ ok(hFile != INVALID_HANDLE_VALUE, "CreateFile() failed\n");
+ CloseHandle(hFile);
+
+ ok(MoveFileEx("randomfilename", "verylongfilename2",
MOVEFILE_REPLACE_EXISTING) != FALSE, "MoveFile() failed\n");
+ hFind = FindFirstFile("verylongfilename2", &FileInfo);
+ ok(hFind != INVALID_HANDLE_VALUE, "FindFirstFile() failed\n");
+ FindClose(hFind);
+ ok(strcmp(FileInfo.cAlternateFileName, ShortName) == 0, "strcmp()
failed\n");
+
+ DeleteFile("randomfilename");
+ DeleteFile("verylongfilename");
+ DeleteFile("verylongfilename2");
+
+ SetCurrentDirectory(OldDir);
+ RemoveDirectory(TestDir);
+}
+
+START_TEST(TunnelCache)
+{
+ Test_ShortTests();
+}
Propchange: trunk/rostests/apitests/kernel32/TunnelCache.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/rostests/apitests/kernel32/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/kernel32/testlis…
==============================================================================
--- trunk/rostests/apitests/kernel32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/kernel32/testlist.c [iso-8859-1] Mon May 25 10:30:12 2015
@@ -15,6 +15,7 @@
extern void func_SetCurrentDirectory(void);
extern void func_SetUnhandledExceptionFilter(void);
extern void func_TerminateProcess(void);
+extern void func_TunnelCache(void);
const struct test winetest_testlist[] =
{
@@ -30,6 +31,7 @@
{ "SetCurrentDirectory", func_SetCurrentDirectory },
{ "SetUnhandledExceptionFilter", func_SetUnhandledExceptionFilter },
{ "TerminateProcess", func_TerminateProcess },
+ { "TunnelCache", func_TunnelCache },
{ 0, 0 }
};