Author: tfaber
Date: Mon Jul 11 18:03:19 2011
New Revision: 52638
URL:
http://svn.reactos.org/svn/reactos?rev=52638&view=rev
Log:
[KMTESTS]
- add support for hidden tests also for kernel-mode
- small fixes and improvements
Modified:
branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h
branches/GSoC_2011/KMTestSuite/kmtests/kmtest/kmtest.c
branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.c
branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/testlist.c
branches/GSoC_2011/KMTestSuite/kmtests/ntos_ke/KeDpc.c
Modified: branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/i…
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h [iso-8859-1] (original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/include/kmt_test.h [iso-8859-1] Mon Jul 11
18:03:19 2011
@@ -129,6 +129,8 @@
#define ok_eq_uint(value, expected) ok_eq_print(value, expected, "%u")
#define ok_eq_long(value, expected) ok_eq_print(value, expected,
"%ld")
#define ok_eq_ulong(value, expected) ok_eq_print(value, expected,
"%lu")
+#define ok_eq_longlong(value, expected) ok_eq_print(value, expected,
"%I64d")
+#define ok_eq_ulonglong(value, expected) ok_eq_print(value, expected,
"%I64u")
#define ok_eq_hex(value, expected) ok_eq_print(value, expected,
"0x%08lx")
#define ok_bool_true(value, desc) ok((value) == TRUE, desc " FALSE,
expected TRUE\n")
#define ok_bool_false(value, desc) ok((value) == FALSE, desc " TRUE,
expected FALSE\n")
Modified: branches/GSoC_2011/KMTestSuite/kmtests/kmtest/kmtest.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/kmtest/kmtest.c [iso-8859-1] (original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest/kmtest.c [iso-8859-1] Mon Jul 11
18:03:19 2011
@@ -31,6 +31,7 @@
{
KMT_DO_NOTHING,
KMT_LIST_TESTS,
+ KMT_LIST_ALL_TESTS,
KMT_RUN_TEST,
} KMT_OPERATION;
@@ -38,11 +39,11 @@
SC_HANDLE KmtestServiceHandle;
PCSTR ErrorFileAndLine = "No error";
-static void OutputError(DWORD Error);
-static DWORD ListTests(VOID);
-static PKMT_TESTFUNC FindTest(PCSTR TestName);
-static DWORD OutputResult(PCSTR TestName);
-static DWORD RunTest(PCSTR TestName);
+static void OutputError(IN DWORD Error);
+static DWORD ListTests(IN BOOLEAN IncludeHidden);
+static PKMT_TESTFUNC FindTest(IN PCSTR TestName);
+static DWORD OutputResult(IN PCSTR TestName);
+static DWORD RunTest(IN PCSTR TestName);
int __cdecl main(int ArgCount, char **Arguments);
/**
@@ -56,7 +57,7 @@
static
void
OutputError(
- DWORD Error)
+ IN DWORD Error)
{
PSTR Message;
if (!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_ALLOCATE_BUFFER,
@@ -79,11 +80,15 @@
* The list will comprise tests as listed by the driver
* in addition to user-mode tests in TestList.
*
+ * @param IncludeHidden
+ * TRUE to include "hidden" tests prefixed with a '-'
+ *
* @return Win32 error code
*/
static
DWORD
-ListTests(VOID)
+ListTests(
+ IN BOOLEAN IncludeHidden)
{
DWORD Error = ERROR_SUCCESS;
CHAR Buffer[1024];
@@ -101,10 +106,6 @@
// output test list plus user-mode tests
while (TestEntry->TestName || *TestName)
{
- // tests starting with a '-' should not be listed
- while (TestEntry->TestName && *TestEntry->TestName == '-')
- ++TestEntry;
-
if (!TestEntry->TestName)
{
NextTestName = TestName;
@@ -136,7 +137,12 @@
TestName += strlen(TestName) + 1;
}
}
- printf(" %s\n", NextTestName);
+
+ if (IncludeHidden && NextTestName[0] == '-')
+ ++NextTestName;
+
+ if (NextTestName[0] != '-')
+ printf(" %s\n", NextTestName);
}
cleanup:
@@ -156,7 +162,7 @@
static
PKMT_TESTFUNC
FindTest(
- PCSTR TestName)
+ IN PCSTR TestName)
{
PCKMT_TEST TestEntry = TestList;
@@ -188,7 +194,7 @@
static
DWORD
OutputResult(
- PCSTR TestName)
+ IN PCSTR TestName)
{
DWORD Error = ERROR_SUCCESS;
DWORD BytesWritten;
@@ -214,7 +220,7 @@
static
DWORD
RunTest(
- PCSTR TestName)
+ IN PCSTR TestName)
{
DWORD Error = ERROR_SUCCESS;
PKMT_TESTFUNC TestFunction;
@@ -267,6 +273,7 @@
PCSTR AppName = "kmtest.exe";
PCSTR TestName = NULL;
KMT_OPERATION Operation = KMT_DO_NOTHING;
+ BOOLEAN ShowHidden = FALSE;
Error = KmtServiceInit();
if (Error)
@@ -279,6 +286,7 @@
{
printf("Usage: %s <test_name> - run the specified test
(creates/starts the driver(s) as appropriate)\n", AppName);
printf(" %s --list - list available
tests\n", AppName);
+ printf(" %s --list-all - list available tests,
including hidden\n", AppName);
printf(" %s <create|delete|start|stop> - manage the kmtest
driver\n\n", AppName);
Operation = KMT_LIST_TESTS;
}
@@ -296,6 +304,8 @@
else if (!lstrcmpA(TestName, "--list"))
Operation = KMT_LIST_TESTS;
+ else if (!lstrcmpA(TestName, "--list-all"))
+ Operation = KMT_LIST_ALL_TESTS;
else
Operation = KMT_RUN_TEST;
}
@@ -312,8 +322,11 @@
switch (Operation)
{
+ case KMT_LIST_ALL_TESTS:
+ ShowHidden = TRUE;
+ /* fall through */
case KMT_LIST_TESTS:
- Error = ListTests();
+ Error = ListTests(ShowHidden);
break;
case KMT_RUN_TEST:
Error = RunTest(TestName);
Modified: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.c [iso-8859-1]
(original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/kmtest_drv.c [iso-8859-1] Mon Jul 11
18:03:19 2011
@@ -284,7 +284,10 @@
for (TestEntry = TestList; TestEntry->TestName; ++TestEntry)
{
ANSI_STRING EntryName;
- RtlInitAnsiString(&EntryName, TestEntry->TestName);
+ if (TestEntry->TestName[0] == '-')
+ RtlInitAnsiString(&EntryName, TestEntry->TestName + 1);
+ else
+ RtlInitAnsiString(&EntryName, TestEntry->TestName);
if (!RtlCompareString(&TestName, &EntryName, FALSE))
{
Modified: branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/testlist.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/testlist.c [iso-8859-1] (original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest_drv/testlist.c [iso-8859-1] Mon Jul 11
18:03:19 2011
@@ -24,18 +24,18 @@
const KMT_TEST TestList[] =
{
- { "Example", Test_Example },
- { "ExPools", Test_ExPools },
- { "ExResource", Test_ExResource },
- { "ExTimer", Test_ExTimer },
- { "FsRtlExpression", Test_FsRtlExpression },
- { "IoDeviceInterface", Test_IoDeviceInterface },
- { "IoIrp", Test_IoIrp },
- { "IoMdl", Test_IoMdl },
- { "KeApc", Test_KeApc },
- { "KeDpc", Test_KeDpc },
- { "KeIrql", Test_KeIrql },
- { "KeProcessor", Test_KeProcessor },
- { "ObCreate", Test_ObCreate },
- { NULL, NULL }
+ { "Example", Test_Example },
+ { "ExPools", Test_ExPools },
+ { "ExResource", Test_ExResource },
+ { "ExTimer", Test_ExTimer },
+ { "FsRtlExpression", Test_FsRtlExpression },
+ { "IoDeviceInterface", Test_IoDeviceInterface },
+ { "IoIrp", Test_IoIrp },
+ { "IoMdl", Test_IoMdl },
+ { "KeApc", Test_KeApc },
+ { "KeDpc", Test_KeDpc },
+ { "KeIrql", Test_KeIrql },
+ { "KeProcessor", Test_KeProcessor },
+ { "ObCreate", Test_ObCreate },
+ { NULL, NULL }
};
Modified: branches/GSoC_2011/KMTestSuite/kmtests/ntos_ke/KeDpc.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/n…
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/ntos_ke/KeDpc.c [iso-8859-1] (original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/ntos_ke/KeDpc.c [iso-8859-1] Mon Jul 11
18:03:19 2011
@@ -16,8 +16,8 @@
/* TODO: DPC importance */
-static volatile LONG DpcCount = 0;
-static volatile UCHAR DpcImportance = MediumImportance;
+static volatile LONG DpcCount;
+static volatile UCHAR DpcImportance;
static KDEFERRED_ROUTINE DpcHandler;
@@ -73,6 +73,9 @@
LONG ExpectedDpcCount = 0;
BOOLEAN Ret;
int i;
+
+ DpcCount = 0;
+ DpcImportance = MediumImportance;
#define ok_dpccount() ok(DpcCount == ExpectedDpcCount, "DpcCount = %ld, expected
%ld\n", DpcCount, ExpectedDpcCount);
trace("Dpc = %p\n", &Dpc);