Author: fireball
Date: Wed Jun 5 22:50:57 2013
New Revision: 59177
URL:
http://svn.reactos.org/svn/reactos?rev=59177&view=rev
Log:
[KMTEST]
- Add tests for FsRtl Tunnel Cache APIs. By Moscow State Technical University students
Arseny Ashuha, Marina Volosnikova and Denis Petkevich.
- Disabled from testbot because they bugcheck ReactOS (unimplemented functions bugcheck).
Added:
trunk/rostests/kmtests/ntos_fsrtl/FsRtlTunnel.c (with props)
Modified:
trunk/rostests/kmtests/CMakeLists.txt
trunk/rostests/kmtests/kmtest_drv/testlist.c
Modified: trunk/rostests/kmtests/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/CMakeLists.txt?re…
==============================================================================
--- trunk/rostests/kmtests/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/kmtests/CMakeLists.txt [iso-8859-1] Wed Jun 5 22:50:57 2013
@@ -37,6 +37,7 @@
ntos_ex/ExTimer.c
ntos_fsrtl/FsRtlExpression.c
ntos_fsrtl/FsRtlMcb.c
+ ntos_fsrtl/FsRtlTunnel.c
ntos_io/IoDeviceInterface.c
ntos_io/IoEvent.c
ntos_io/IoInterrupt.c
Modified: trunk/rostests/kmtests/kmtest_drv/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/testli…
==============================================================================
--- trunk/rostests/kmtests/kmtest_drv/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/kmtest_drv/testlist.c [iso-8859-1] Wed Jun 5 22:50:57 2013
@@ -21,6 +21,7 @@
KMT_TESTFUNC Test_ExTimer;
KMT_TESTFUNC Test_FsRtlExpression;
KMT_TESTFUNC Test_FsRtlMcb;
+KMT_TESTFUNC Test_FsRtlTunnel;
KMT_TESTFUNC Test_IoDeviceInterface;
KMT_TESTFUNC Test_IoEvent;
KMT_TESTFUNC Test_IoInterrupt;
@@ -67,6 +68,7 @@
{ "FsRtlExpression", Test_FsRtlExpression },
/* Skipped on testman. See ROSTESTS-106. */
{ "-FsRtlMcb", Test_FsRtlMcb },
+ { "-FsRtlTunnel", Test_FsRtlTunnel },
{ "IoDeviceInterface", Test_IoDeviceInterface },
{ "IoEvent", Test_IoEvent },
{ "IoInterrupt", Test_IoInterrupt },
Added: trunk/rostests/kmtests/ntos_fsrtl/FsRtlTunnel.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_fsrtl/FsRtlT…
==============================================================================
--- trunk/rostests/kmtests/ntos_fsrtl/FsRtlTunnel.c (added)
+++ trunk/rostests/kmtests/ntos_fsrtl/FsRtlTunnel.c [iso-8859-1] Wed Jun 5 22:50:57 2013
@@ -0,0 +1,158 @@
+/*
+ Lab 4, at the rate of the OS.
+
+ Tested with the system kmtest
+ the following functions:
+ FsRtlInitializeTunnelCache
+ FsRtlDeleteTunnelCache
+ FsRtlAddToTunnelCache
+ FsRtlDeleteKeyFromTunnelCache
+ FsRtlFindInTunnelCache
+
+ Ashuha Arseny IU9-41. 2013.
+*/
+
+#include <kmt_test.h>
+
+#define NDEBUG
+#include <debug.h>
+
+static PTUNNEL T;
+static PTUNNEL Tb;
+
+#define BufSize 10000
+
+PUNICODE_STRING CopyUS(PUNICODE_STRING a)
+{
+ PUNICODE_STRING b = (PUNICODE_STRING)ExAllocatePool(PagedPool,sizeof(UNICODE_STRING));
+ ok(b != NULL, "US is NULL after allocated memory\n");
+ b->Length = 0;
+ b->MaximumLength =a->MaximumLength;
+ b->Buffer = (PWSTR)ExAllocatePoolWithTag(PagedPool, b->MaximumLength, 1633);
+ ok(b->Buffer != NULL, "US->Buffer is NULL after allocated memory\n");
+ RtlCopyUnicodeString(b, a);
+ return b;
+}
+
+void TestFsRtlInitializeTunnelCache()
+{
+ SIZE_T eq;
+ T = ExAllocatePool(PagedPool, sizeof(TUNNEL));
+ ok(T != NULL, "PTUNEL is NULL after allocated memory\n");
+ Tb = ExAllocatePool(PagedPool, sizeof(TUNNEL));
+ ok(Tb != NULL, "PTUNEL is NULL after allocated memory\n");
+
+ memset((void*)T, 0, sizeof(TUNNEL));
+ memset((void*)Tb, 0, sizeof(TUNNEL));
+
+ FsRtlInitializeTunnelCache(T);
+
+ eq = RtlCompareMemory((const VOID*)T, (const VOID*)Tb, sizeof(TUNNEL));
+
+ ok ( eq != sizeof(TUNNEL), "FsRtlInitializeTunnelCache function did not change
anything in the memory at the address PTUNEL.\n");
+}
+
+void TestFsRtlAddToTunnelCache(ULONGLONG DirectoryKey, PUNICODE_STRING s_name,
PUNICODE_STRING l_name, BOOLEAN KeyByShortName)
+{
+ SIZE_T eq;
+ LONG b;
+ PUNICODE_STRING bs_name;
+ PUNICODE_STRING bl_name;
+ PVOID Bufb;
+ PVOID Buf;
+
+ Buf = ExAllocatePool(PagedPool, BufSize);
+ ok(Buf != NULL, "Buff in TestFsRtlAddToTunnelCache is NULL after allocated
memory\n");
+ Bufb = ExAllocatePool(PagedPool, BufSize);
+ ok(Bufb != NULL, "Buff in TestFsRtlAddToTunnelCache is NULL after allocated
memory\n");
+
+ //allocate memory for the bufs_name
+ bs_name = CopyUS(s_name);
+
+ //allocate memory for the l_name and bl_name
+ bl_name = CopyUS(l_name);
+
+ memset((void*)Buf, 0, BufSize);
+ memset((void*)Bufb, 0, BufSize);
+
+ FsRtlAddToTunnelCache(T, DirectoryKey, s_name, l_name, KeyByShortName, BufSize, Buf);
+
+ eq = RtlCompareMemory((const VOID*)Buf, (const VOID*)Bufb, BufSize);
+
+ ok( eq != sizeof(TUNNEL),"FsRtlAddToTunnelCache function did not change anything
in the memory at the address Buf.\n");
+
+ b = RtlCompareUnicodeString(l_name, bl_name, TRUE);
+ ok (b == 0, "long name after call FsRtlAddToTunnelCache != long name befo call
FsRtlAddToTunnelCache\n\n");
+ b = RtlCompareUnicodeString(s_name, bs_name, TRUE);
+ ok (b == 0, "short name after call FsRtlAddToTunnelCache != short name befo call
FsRtlAddToTunnelCache\n\n");
+}
+
+BOOLEAN TestFsRtlFindInTunnelCache(ULONG DirectoryKey, PUNICODE_STRING name,
PUNICODE_STRING s_name, PUNICODE_STRING l_name)
+{
+ // Allocate memory for the Buf
+ ULONG BufsizeTemp = BufSize;
+ PVOID Buf = ExAllocatePool(PagedPool, BufSize*2);
+ ok(Buf != NULL, "Buff in FsRtlFindInTunnelCache is NULL after allocated
memory\n");
+
+ return FsRtlFindInTunnelCache(T, DirectoryKey, name, s_name, l_name, &BufsizeTemp,
Buf);
+}
+
+void TestFsRtlDeleteKeyFromTunnelCache(ULONGLONG a)
+{
+ FsRtlDeleteKeyFromTunnelCache(T, a);
+}
+
+START_TEST(FsRtlTunnel)
+{
+ PUNICODE_STRING s_name;
+ PUNICODE_STRING l_name;
+ PUNICODE_STRING name;
+ PUNICODE_STRING a;
+ BOOLEAN is;
+
+ //Initialize Cash
+ TestFsRtlInitializeTunnelCache();
+
+ s_name = (PUNICODE_STRING)ExAllocatePool(PagedPool,sizeof(UNICODE_STRING));
+ ok(s_name != NULL, "s_name in TestFsRtlAddToTunnelCache is NULL after allocated
memory\n");
+ RtlInitUnicodeString(s_name, L"smal");
+
+ l_name = (PUNICODE_STRING)ExAllocatePool(PagedPool,sizeof(UNICODE_STRING));
+ ok(l_name != NULL, "l_name in TestFsRtlAddToTunnelCache is NULL after allocated
memory\n");
+ RtlInitUnicodeString(l_name, L"bigbigbigbigbig");
+
+ // Add elem
+ TestFsRtlAddToTunnelCache(12345, s_name, l_name, TRUE);
+
+ name = (PUNICODE_STRING)ExAllocatePool(PagedPool,sizeof(UNICODE_STRING));
+ ok(name != NULL, "name in FsRtlFindInTunnelCache is NULL after allocated
memory\n");
+ RtlInitUnicodeString(name, L"smal");
+
+ // Find
+ is = TestFsRtlFindInTunnelCache(12345, name, s_name, l_name);
+ ok(is == TRUE, "FsRtlFindInTunnelCache dosn't find elem id = 12345\n");
+
+ TestFsRtlDeleteKeyFromTunnelCache(12345); //Delete
+ is = TestFsRtlFindInTunnelCache(12345, name, s_name, l_name);
+ ok(is == FALSE, "TestFsRtlDeleteKeyFromTunnelCache dosn't delete elem id =
12345\n");
+
+ is = TestFsRtlFindInTunnelCache(12347, name, s_name, l_name);
+ ok(is == FALSE, "FsRtlDeleteTunnelCache dosn't clear cash\n");
+
+ TestFsRtlAddToTunnelCache(12345, s_name, l_name, TRUE);
+ TestFsRtlAddToTunnelCache(12347, s_name, l_name, TRUE);
+ a = (PUNICODE_STRING)ExAllocatePool(PagedPool,sizeof(UNICODE_STRING));
+ TestFsRtlAddToTunnelCache(12346, a, l_name, FALSE);
+
+ //Clear all
+ FsRtlDeleteTunnelCache(T);
+
+ is = TestFsRtlFindInTunnelCache(12345, name, s_name, l_name);
+ ok(is == FALSE, "FsRtlDeleteTunnelCache dosn't clear cash\n");
+
+ is = TestFsRtlFindInTunnelCache(12346, name, a, l_name);
+ ok(is == FALSE, "FsRtlDeleteTunnelCache dosn't clear cash\n");
+
+ is = TestFsRtlFindInTunnelCache(12347, name, s_name, l_name);
+ ok(is == FALSE, "FsRtlDeleteTunnelCache dosn't clear cash\n");
+}
Propchange: trunk/rostests/kmtests/ntos_fsrtl/FsRtlTunnel.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/rostests/kmtests/ntos_fsrtl/FsRtlTunnel.c
------------------------------------------------------------------------------
svn:mime-type = text/plain