Author: tfaber
Date: Wed Aug 3 12:48:22 2011
New Revision: 53047
URL:
http://svn.reactos.org/svn/reactos?rev=53047&view=rev
Log:
[KMTESTS]
- add IoDriverObject test, partly ported from old kmtests. Should possibly be merged with
another test
- ExDoubleList: add another small testcase
Added:
branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/CMakeLists.txt
- copied, changed from r52780,
branches/GSoC_2011/KMTestSuite/kmtests/example/CMakeLists.txt
branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/IoDriverObject_drv.c
- copied, changed from r52215,
branches/GSoC_2011/KMTestSuite/drivers/kmtest/drvobj_test.c
branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/IoDriverObject_user.c (with props)
branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/iodriverobject_drv.rbuild
- copied, changed from r52780,
branches/GSoC_2011/KMTestSuite/kmtests/example/example_drv.rbuild
Modified:
branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt
branches/GSoC_2011/KMTestSuite/kmtests/directory.rbuild
branches/GSoC_2011/KMTestSuite/kmtests/kmtest.rbuild
branches/GSoC_2011/KMTestSuite/kmtests/kmtest/testlist.c
branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExDoubleList.c
Modified: branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/C…
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt [iso-8859-1] (original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/CMakeLists.txt [iso-8859-1] Wed Aug 3 12:48:22
2011
@@ -5,6 +5,7 @@
# subdirectories containing special-purpose drivers
#
add_subdirectory(example)
+add_subdirectory(ntos_io)
#
# kmtest_drv.sys driver
@@ -65,6 +66,7 @@
kmtest/testlist.c
example/Example_user.c
+ ntos_io/IoDriverObject_user.c
rtl/RtlAvlTree.c
rtl/RtlMemory.c
rtl/RtlSplayTree.c
@@ -82,7 +84,7 @@
# Group targets
#
add_custom_target(kmtest_drivers)
-add_dependencies(kmtest_drivers kmtest_drv example_drv)
+add_dependencies(kmtest_drivers kmtest_drv example_drv iodriverobject_drv)
add_custom_target(kmtest_all)
add_dependencies(kmtest_all kmtest_drivers kmtest)
Modified: branches/GSoC_2011/KMTestSuite/kmtests/directory.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/d…
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/directory.rbuild [iso-8859-1] (original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/directory.rbuild [iso-8859-1] Wed Aug 3
12:48:22 2011
@@ -4,6 +4,9 @@
<directory name="example">
<xi:include href="example/example_drv.rbuild" />
</directory>
+ <directory name="ntos_io">
+ <xi:include href="ntos_io/iodriverobject_drv.rbuild" />
+ </directory>
<xi:include href="kmtest.rbuild" />
<xi:include href="kmtest_drv.rbuild" />
</group>
Modified: branches/GSoC_2011/KMTestSuite/kmtests/kmtest.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/kmtest.rbuild [iso-8859-1] (original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest.rbuild [iso-8859-1] Wed Aug 3 12:48:22
2011
@@ -12,6 +12,9 @@
<directory name="example">
<file>Example_user.c</file>
</directory>
+ <directory name="ntos_io">
+ <file>IoDriverObject_user.c</file>
+ </directory>
<directory name="rtl">
<file>RtlAvlTree.c</file>
<file>RtlMemory.c</file>
Modified: branches/GSoC_2011/KMTestSuite/kmtests/kmtest/testlist.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/k…
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/kmtest/testlist.c [iso-8859-1] (original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/kmtest/testlist.c [iso-8859-1] Wed Aug 3
12:48:22 2011
@@ -8,6 +8,7 @@
#include <kmt_test.h>
KMT_TESTFUNC Test_Example;
+KMT_TESTFUNC Test_IoDriverObject;
KMT_TESTFUNC Test_RtlAvlTree;
KMT_TESTFUNC Test_RtlMemory;
KMT_TESTFUNC Test_RtlSplayTree;
@@ -16,6 +17,7 @@
const KMT_TEST TestList[] =
{
{ "Example", Test_Example },
+ { "IoDriverObject", Test_IoDriverObject },
{ "RtlAvlTree", Test_RtlAvlTree },
{ "RtlMemory", Test_RtlMemory },
{ "RtlSplayTree", Test_RtlSplayTree },
Modified: branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExDoubleList.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/n…
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExDoubleList.c [iso-8859-1] (original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/ntos_ex/ExDoubleList.c [iso-8859-1] Wed Aug 3
12:48:22 2011
@@ -35,16 +35,16 @@
KSPIN_LOCK SpinLock;
LIST_ENTRY ListHead;
PLIST_ENTRY Ret;
-
+
KeInitializeSpinLock(&SpinLock);
-
+
memset(&ListHead, 0x55, sizeof ListHead);
InitializeListHead(&ListHead);
ok_eq_pointer(ListHead.Flink, &ListHead);
ok_eq_pointer(ListHead.Blink, &ListHead);
ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
ok_irql(PASSIVE_LEVEL);
-
+
Ret = ExInterlockedInsertHeadList(&ListHead, &Entries[0], &SpinLock);
ok_eq_pointer(Ret, NULL);
ok_eq_pointer(ListHead.Flink, &Entries[0]);
@@ -53,61 +53,61 @@
ok_eq_pointer(Entries[0].Blink, &ListHead);
ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
ok_irql(PASSIVE_LEVEL);
-
- Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
- ok_eq_pointer(Ret, &Entries[0]);
- ok_eq_pointer(ListHead.Flink, &ListHead);
- ok_eq_pointer(ListHead.Blink, &ListHead);
- ok_eq_free(Entries[0].Flink, &ListHead);
- ok_eq_free(Entries[0].Blink, &ListHead);
- ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
- ok_irql(PASSIVE_LEVEL);
-
- Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
- ok_eq_pointer(Ret, NULL);
- ok_eq_pointer(ListHead.Flink, &ListHead);
- ok_eq_pointer(ListHead.Blink, &ListHead);
- ok_eq_free(Entries[0].Flink, &ListHead);
- ok_eq_free(Entries[0].Blink, &ListHead);
- ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
- ok_irql(PASSIVE_LEVEL);
-
- Ret = ExInterlockedInsertTailList(&ListHead, &Entries[0], &SpinLock);
- ok_eq_pointer(Ret, NULL);
- ok_eq_pointer(ListHead.Flink, &Entries[0]);
- ok_eq_pointer(ListHead.Blink, &Entries[0]);
- ok_eq_pointer(Entries[0].Flink, &ListHead);
- ok_eq_pointer(Entries[0].Blink, &ListHead);
- ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
- ok_irql(PASSIVE_LEVEL);
-
- Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
- ok_eq_pointer(Ret, &Entries[0]);
- ok_eq_pointer(ListHead.Flink, &ListHead);
- ok_eq_pointer(ListHead.Blink, &ListHead);
- ok_eq_free(Entries[0].Flink, &ListHead);
- ok_eq_free(Entries[0].Blink, &ListHead);
- ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
- ok_irql(PASSIVE_LEVEL);
-
- Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
- ok_eq_pointer(Ret, NULL);
- ok_eq_pointer(ListHead.Flink, &ListHead);
- ok_eq_pointer(ListHead.Blink, &ListHead);
- ok_eq_free(Entries[0].Flink, &ListHead);
- ok_eq_free(Entries[0].Blink, &ListHead);
- ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
- ok_irql(PASSIVE_LEVEL);
-
- Ret = ExInterlockedInsertTailList(&ListHead, &Entries[0], &SpinLock);
- ok_eq_pointer(Ret, NULL);
- ok_eq_pointer(ListHead.Flink, &Entries[0]);
- ok_eq_pointer(ListHead.Blink, &Entries[0]);
- ok_eq_pointer(Entries[0].Flink, &ListHead);
- ok_eq_pointer(Entries[0].Blink, &ListHead);
- ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
- ok_irql(PASSIVE_LEVEL);
-
+
+ Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
+ ok_eq_pointer(Ret, &Entries[0]);
+ ok_eq_pointer(ListHead.Flink, &ListHead);
+ ok_eq_pointer(ListHead.Blink, &ListHead);
+ ok_eq_free(Entries[0].Flink, &ListHead);
+ ok_eq_free(Entries[0].Blink, &ListHead);
+ ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
+ ok_irql(PASSIVE_LEVEL);
+
+ Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
+ ok_eq_pointer(Ret, NULL);
+ ok_eq_pointer(ListHead.Flink, &ListHead);
+ ok_eq_pointer(ListHead.Blink, &ListHead);
+ ok_eq_free(Entries[0].Flink, &ListHead);
+ ok_eq_free(Entries[0].Blink, &ListHead);
+ ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
+ ok_irql(PASSIVE_LEVEL);
+
+ Ret = ExInterlockedInsertTailList(&ListHead, &Entries[0], &SpinLock);
+ ok_eq_pointer(Ret, NULL);
+ ok_eq_pointer(ListHead.Flink, &Entries[0]);
+ ok_eq_pointer(ListHead.Blink, &Entries[0]);
+ ok_eq_pointer(Entries[0].Flink, &ListHead);
+ ok_eq_pointer(Entries[0].Blink, &ListHead);
+ ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
+ ok_irql(PASSIVE_LEVEL);
+
+ Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
+ ok_eq_pointer(Ret, &Entries[0]);
+ ok_eq_pointer(ListHead.Flink, &ListHead);
+ ok_eq_pointer(ListHead.Blink, &ListHead);
+ ok_eq_free(Entries[0].Flink, &ListHead);
+ ok_eq_free(Entries[0].Blink, &ListHead);
+ ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
+ ok_irql(PASSIVE_LEVEL);
+
+ Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
+ ok_eq_pointer(Ret, NULL);
+ ok_eq_pointer(ListHead.Flink, &ListHead);
+ ok_eq_pointer(ListHead.Blink, &ListHead);
+ ok_eq_free(Entries[0].Flink, &ListHead);
+ ok_eq_free(Entries[0].Blink, &ListHead);
+ ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
+ ok_irql(PASSIVE_LEVEL);
+
+ Ret = ExInterlockedInsertTailList(&ListHead, &Entries[0], &SpinLock);
+ ok_eq_pointer(Ret, NULL);
+ ok_eq_pointer(ListHead.Flink, &Entries[0]);
+ ok_eq_pointer(ListHead.Blink, &Entries[0]);
+ ok_eq_pointer(Entries[0].Flink, &ListHead);
+ ok_eq_pointer(Entries[0].Blink, &ListHead);
+ ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
+ ok_irql(PASSIVE_LEVEL);
+
Ret = ExInterlockedInsertHeadList(&ListHead, &Entries[1], &SpinLock);
ok_eq_pointer(Ret, &Entries[0]);
ok_eq_pointer(ListHead.Flink, &Entries[1]);
@@ -118,7 +118,20 @@
ok_eq_pointer(Entries[1].Blink, &ListHead);
ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
ok_irql(PASSIVE_LEVEL);
-
+
+ Ret = ExInterlockedInsertTailList(&ListHead, &Entries[2], &SpinLock);
+ ok_eq_pointer(Ret, &Entries[0]);
+ ok_eq_pointer(ListHead.Flink, &Entries[1]);
+ ok_eq_pointer(ListHead.Blink, &Entries[2]);
+ ok_eq_pointer(Entries[0].Flink, &Entries[2]);
+ ok_eq_pointer(Entries[0].Blink, &Entries[1]);
+ ok_eq_pointer(Entries[1].Flink, &Entries[0]);
+ ok_eq_pointer(Entries[1].Blink, &ListHead);
+ ok_eq_pointer(Entries[2].Flink, &ListHead);
+ ok_eq_pointer(Entries[2].Blink, &Entries[0]);
+ ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
+ ok_irql(PASSIVE_LEVEL);
+
memset(Entries, 0x55, sizeof Entries);
#undef ExInterlockedInsertHeadList
#undef ExInterlockedInsertTailList
@@ -130,7 +143,7 @@
ok_eq_pointer(ListHead.Blink, &ListHead);
ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
ok_irql(PASSIVE_LEVEL);
-
+
Ret = ExInterlockedInsertHeadList(&ListHead, &Entries[0], &SpinLock);
ok_eq_pointer(Ret, NULL);
ok_eq_pointer(ListHead.Flink, &Entries[0]);
@@ -139,61 +152,61 @@
ok_eq_pointer(Entries[0].Blink, &ListHead);
ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
ok_irql(PASSIVE_LEVEL);
-
- Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
- ok_eq_pointer(Ret, &Entries[0]);
- ok_eq_pointer(ListHead.Flink, &ListHead);
- ok_eq_pointer(ListHead.Blink, &ListHead);
- ok_eq_free2(Entries[0].Flink, &ListHead);
- ok_eq_free2(Entries[0].Blink, &ListHead);
- ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
- ok_irql(PASSIVE_LEVEL);
-
- Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
- ok_eq_pointer(Ret, NULL);
- ok_eq_pointer(ListHead.Flink, &ListHead);
- ok_eq_pointer(ListHead.Blink, &ListHead);
- ok_eq_free2(Entries[0].Flink, &ListHead);
- ok_eq_free2(Entries[0].Blink, &ListHead);
- ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
- ok_irql(PASSIVE_LEVEL);
-
- Ret = ExInterlockedInsertTailList(&ListHead, &Entries[0], &SpinLock);
- ok_eq_pointer(Ret, NULL);
- ok_eq_pointer(ListHead.Flink, &Entries[0]);
- ok_eq_pointer(ListHead.Blink, &Entries[0]);
- ok_eq_pointer(Entries[0].Flink, &ListHead);
- ok_eq_pointer(Entries[0].Blink, &ListHead);
- ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
- ok_irql(PASSIVE_LEVEL);
-
- Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
- ok_eq_pointer(Ret, &Entries[0]);
- ok_eq_pointer(ListHead.Flink, &ListHead);
- ok_eq_pointer(ListHead.Blink, &ListHead);
- ok_eq_free2(Entries[0].Flink, &ListHead);
- ok_eq_free2(Entries[0].Blink, &ListHead);
- ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
- ok_irql(PASSIVE_LEVEL);
-
- Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
- ok_eq_pointer(Ret, NULL);
- ok_eq_pointer(ListHead.Flink, &ListHead);
- ok_eq_pointer(ListHead.Blink, &ListHead);
- ok_eq_free2(Entries[0].Flink, &ListHead);
- ok_eq_free2(Entries[0].Blink, &ListHead);
- ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
- ok_irql(PASSIVE_LEVEL);
-
- Ret = ExInterlockedInsertTailList(&ListHead, &Entries[0], &SpinLock);
- ok_eq_pointer(Ret, NULL);
- ok_eq_pointer(ListHead.Flink, &Entries[0]);
- ok_eq_pointer(ListHead.Blink, &Entries[0]);
- ok_eq_pointer(Entries[0].Flink, &ListHead);
- ok_eq_pointer(Entries[0].Blink, &ListHead);
- ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
- ok_irql(PASSIVE_LEVEL);
-
+
+ Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
+ ok_eq_pointer(Ret, &Entries[0]);
+ ok_eq_pointer(ListHead.Flink, &ListHead);
+ ok_eq_pointer(ListHead.Blink, &ListHead);
+ ok_eq_free2(Entries[0].Flink, &ListHead);
+ ok_eq_free2(Entries[0].Blink, &ListHead);
+ ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
+ ok_irql(PASSIVE_LEVEL);
+
+ Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
+ ok_eq_pointer(Ret, NULL);
+ ok_eq_pointer(ListHead.Flink, &ListHead);
+ ok_eq_pointer(ListHead.Blink, &ListHead);
+ ok_eq_free2(Entries[0].Flink, &ListHead);
+ ok_eq_free2(Entries[0].Blink, &ListHead);
+ ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
+ ok_irql(PASSIVE_LEVEL);
+
+ Ret = ExInterlockedInsertTailList(&ListHead, &Entries[0], &SpinLock);
+ ok_eq_pointer(Ret, NULL);
+ ok_eq_pointer(ListHead.Flink, &Entries[0]);
+ ok_eq_pointer(ListHead.Blink, &Entries[0]);
+ ok_eq_pointer(Entries[0].Flink, &ListHead);
+ ok_eq_pointer(Entries[0].Blink, &ListHead);
+ ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
+ ok_irql(PASSIVE_LEVEL);
+
+ Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
+ ok_eq_pointer(Ret, &Entries[0]);
+ ok_eq_pointer(ListHead.Flink, &ListHead);
+ ok_eq_pointer(ListHead.Blink, &ListHead);
+ ok_eq_free2(Entries[0].Flink, &ListHead);
+ ok_eq_free2(Entries[0].Blink, &ListHead);
+ ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
+ ok_irql(PASSIVE_LEVEL);
+
+ Ret = ExInterlockedRemoveHeadList(&ListHead, &SpinLock);
+ ok_eq_pointer(Ret, NULL);
+ ok_eq_pointer(ListHead.Flink, &ListHead);
+ ok_eq_pointer(ListHead.Blink, &ListHead);
+ ok_eq_free2(Entries[0].Flink, &ListHead);
+ ok_eq_free2(Entries[0].Blink, &ListHead);
+ ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
+ ok_irql(PASSIVE_LEVEL);
+
+ Ret = ExInterlockedInsertTailList(&ListHead, &Entries[0], &SpinLock);
+ ok_eq_pointer(Ret, NULL);
+ ok_eq_pointer(ListHead.Flink, &Entries[0]);
+ ok_eq_pointer(ListHead.Blink, &Entries[0]);
+ ok_eq_pointer(Entries[0].Flink, &ListHead);
+ ok_eq_pointer(Entries[0].Blink, &ListHead);
+ ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
+ ok_irql(PASSIVE_LEVEL);
+
Ret = ExInterlockedInsertHeadList(&ListHead, &Entries[1], &SpinLock);
ok_eq_pointer(Ret, &Entries[0]);
ok_eq_pointer(ListHead.Flink, &Entries[1]);
@@ -204,6 +217,19 @@
ok_eq_pointer(Entries[1].Blink, &ListHead);
ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
ok_irql(PASSIVE_LEVEL);
-
+
+ Ret = ExInterlockedInsertTailList(&ListHead, &Entries[2], &SpinLock);
+ ok_eq_pointer(Ret, &Entries[0]);
+ ok_eq_pointer(ListHead.Flink, &Entries[1]);
+ ok_eq_pointer(ListHead.Blink, &Entries[2]);
+ ok_eq_pointer(Entries[0].Flink, &Entries[2]);
+ ok_eq_pointer(Entries[0].Blink, &Entries[1]);
+ ok_eq_pointer(Entries[1].Flink, &Entries[0]);
+ ok_eq_pointer(Entries[1].Blink, &ListHead);
+ ok_eq_pointer(Entries[2].Flink, &ListHead);
+ ok_eq_pointer(Entries[2].Blink, &Entries[0]);
+ ok_bool_true(KmtAreInterruptsEnabled(), "Interrupts enabled:");
+ ok_irql(PASSIVE_LEVEL);
+
KmtSetIrql(PASSIVE_LEVEL);
}
Copied: branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/CMakeLists.txt (from r52780,
branches/GSoC_2011/KMTestSuite/kmtests/example/CMakeLists.txt)
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/n…
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/example/CMakeLists.txt [iso-8859-1] (original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/CMakeLists.txt [iso-8859-1] Wed Aug 3
12:48:22 2011
@@ -3,13 +3,13 @@
list(APPEND EXAMPLE_DRV_SOURCE
../kmtest_drv/kmtest_standalone.c
- Example_drv.c)
+ IoDriverObject_drv.c)
-add_library(example_drv SHARED ${EXAMPLE_DRV_SOURCE})
+add_library(iodriverobject_drv SHARED ${EXAMPLE_DRV_SOURCE})
-set_module_type(example_drv kernelmodedriver)
-target_link_libraries(example_drv kmtest_printf ${PSEH_LIB})
-add_importlibs(example_drv ntoskrnl hal)
-set_property(TARGET example_drv PROPERTY COMPILE_DEFINITIONS KMT_STANDALONE_DRIVER)
+set_module_type(iodriverobject_drv kernelmodedriver)
+target_link_libraries(iodriverobject_drv kmtest_printf ${PSEH_LIB})
+add_importlibs(iodriverobject_drv ntoskrnl hal)
+set_property(TARGET iodriverobject_drv PROPERTY COMPILE_DEFINITIONS
KMT_STANDALONE_DRIVER)
-add_cd_file(TARGET example_drv DESTINATION reactos/bin FOR all)
+add_cd_file(TARGET iodriverobject_drv DESTINATION reactos/bin FOR all)
Copied: branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/IoDriverObject_drv.c (from r52215,
branches/GSoC_2011/KMTestSuite/drivers/kmtest/drvobj_test.c)
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/n…
==============================================================================
--- branches/GSoC_2011/KMTestSuite/drivers/kmtest/drvobj_test.c [iso-8859-1] (original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/IoDriverObject_drv.c [iso-8859-1] Wed
Aug 3 12:48:22 2011
@@ -1,31 +1,82 @@
/*
- * Driver Regression Tests
- *
- * Copyright 2009 Michael Martin <martinmnet(a)hotmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; see the file COPYING.LIB.
- * If not, write to the Free Software Foundation,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * PROJECT: ReactOS kernel-mode tests
+ * LICENSE: GPLv2+ - See COPYING in the top level directory
+ * PURPOSE: Kernel-Mode Test Suite Driver Object Test Driver
+ * PROGRAMMER: Michael Martin <martinmnet(a)hotmail.com>
+ * Thomas Faber <thfabba(a)gmx.de>
*/
-/* INCLUDES *******************************************************************/
+#include <kmt_test.h>
-#include "kmtest.h"
-#include <ddk/ntddk.h>
-#include <ddk/ntifs.h>
+//#define NDEBUG
+#include <debug.h>
-VOID DriverObjectTest(PDRIVER_OBJECT DriverObject, int DriverStatus)
+typedef enum
+{
+ DriverEntry,
+ DriverIrp,
+ DriverUnload
+} DRIVER_STATUS;
+
+static KMT_IRP_HANDLER TestIrpHandler;
+static VOID TestDriverObject(IN PDRIVER_OBJECT DriverObject, IN DRIVER_STATUS
DriverStatus);
+
+NTSTATUS
+TestEntry(
+ IN PDRIVER_OBJECT DriverObject,
+ IN PCUNICODE_STRING RegistryPath,
+ OUT PCWSTR *DeviceName,
+ OUT INT *Flags)
+{
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ PAGED_CODE();
+
+ UNREFERENCED_PARAMETER(RegistryPath);
+
+ *DeviceName = L"IoDriverObject";
+
+ KmtRegisterIrpHandler(IRP_MJ_CREATE, NULL, TestIrpHandler);
+ KmtRegisterIrpHandler(IRP_MJ_CLOSE, NULL, TestIrpHandler);
+
+ TestDriverObject(DriverObject, DriverEntry);
+
+ return Status;
+}
+
+VOID
+TestUnload(
+ IN PDRIVER_OBJECT DriverObject)
+{
+ PAGED_CODE();
+
+ TestDriverObject(DriverObject, DriverUnload);
+}
+
+static
+NTSTATUS
+TestIrpHandler(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+ IN PIO_STACK_LOCATION IoStackLocation)
+{
+ NTSTATUS Status = STATUS_SUCCESS;
+
+ TestDriverObject(DeviceObject->DriverObject, DriverIrp);
+
+ Irp->IoStatus.Status = Status;
+ Irp->IoStatus.Information = 0;
+
+ IoCompleteRequest(Irp, IO_NO_INCREMENT);
+
+ return Status;
+}
+
+static
+VOID
+TestDriverObject(
+ IN PDRIVER_OBJECT DriverObject,
+ IN DRIVER_STATUS DriverStatus)
{
BOOLEAN CheckThisDispatchRoutine;
PVOID FirstMajorFunc;
@@ -34,7 +85,7 @@
ok(DriverObject->Size == sizeof(DRIVER_OBJECT), "Size does not match, got
%x",DriverObject->Size);
ok(DriverObject->Type == 4, "Type does not match 4. got
%d",DriverObject->Type);
- if (DriverStatus == 0)
+ if (DriverStatus == DriverEntry)
{
ok(DriverObject->DeviceObject == NULL, "Expected DeviceObject pointer to
be 0, got %p",
DriverObject->DeviceObject);
@@ -42,26 +93,28 @@
"Expected Flags to be DRVO_LEGACY_DRIVER, got %lu",
DriverObject->Flags);
}
- else if (DriverStatus == 1)
+ else if (DriverStatus == DriverIrp)
{
ok(DriverObject->DeviceObject != NULL, "Expected DeviceObject pointer to
non null");
ok (DriverObject->Flags == (DRVO_LEGACY_DRIVER | DRVO_INITIALIZED),
"Expected Flags to be DRVO_LEGACY_DRIVER | DRVO_INITIALIZED, got
%lu",
DriverObject->Flags);
}
- else
+ else if (DriverStatus == DriverUnload)
{
ok(DriverObject->DeviceObject != NULL, "Expected DeviceObject pointer to
non null");
- ok (DriverObject->Flags == (DRVO_LEGACY_DRIVER | DRVO_INITIALIZED |
DRVO_UNLOAD_INVOKED),
+ ok (DriverObject->Flags == (DRVO_LEGACY_DRIVER | DRVO_INITIALIZED |
DRVO_UNLOAD_INVOKED),
"Expected Flags to be DRVO_LEGACY_DRIVER | DRVO_INITIALIZED |
DRVO_UNLOAD_INVOKED, got %lu",
DriverObject->Flags);
}
+ else
+ ASSERT(FALSE);
/* Select a routine that was not changed */
FirstMajorFunc = DriverObject->MajorFunction[1];
ok(FirstMajorFunc != 0, "Expected MajorFunction[1] to be non NULL");
- if (FirstMajorFunc)
+ if (!skip(FirstMajorFunc != NULL, "First major function not set!\n"))
{
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
{
@@ -75,67 +128,4 @@
}
}
}
- else
- {
- ok(TRUE, "Skipped testing for all MajorFunction");
- }
}
-
-BOOLEAN ZwLoadTest(PDRIVER_OBJECT DriverObject, PUNICODE_STRING DriverRegistryPath,
PWCHAR NewDriverRegPath)
-{
- UNICODE_STRING RegPath;
- NTSTATUS Status;
-
- /* Try to load ourself */
- Status = ZwLoadDriver(DriverRegistryPath);
- ok (Status == STATUS_IMAGE_ALREADY_LOADED, "Expected NTSTATUS
STATUS_IMAGE_ALREADY_LOADED, got 0x%lX", Status);
-
- if (Status != STATUS_IMAGE_ALREADY_LOADED)
- {
- DbgPrint("WARNING: Loading this a second time will cause
BUGCHECK!\n");
- }
-
- /* Try to load with a Registry Path that doesnt exist */
- RtlInitUnicodeString(&RegPath,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\deadbeef");
- Status = ZwLoadDriver(&RegPath);
- ok (Status == STATUS_OBJECT_NAME_NOT_FOUND, "Expected NTSTATUS
STATUS_OBJECT_NAME_NOT_FOUND, got 0x%lX", Status);
-
- /* Load the driver */
- RtlInitUnicodeString(&RegPath, NewDriverRegPath);
- Status = ZwLoadDriver(&RegPath);
- ok(Status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%lX",
Status);
-
- if (!NT_SUCCESS(Status))
- {
- return FALSE;
- }
-
- return TRUE;
-}
-
-BOOLEAN ZwUnloadTest(PDRIVER_OBJECT DriverObject, PUNICODE_STRING DriverRegistryPath,
PWCHAR NewDriverRegPath)
-{
- UNICODE_STRING RegPath;
- NTSTATUS Status;
-
- /* Try to unload ourself, which should fail as our Unload routine hasnt been set yet.
*/
- Status = ZwUnloadDriver(DriverRegistryPath);
- ok (Status == STATUS_INVALID_DEVICE_REQUEST, "Expected NTSTATUS
STATUS_INVALID_DEVICE_REQUEST, got 0x%lX", Status);
-
- /* Try to unload with a Registry Path that doesnt exist */
- RtlInitUnicodeString(&RegPath,
L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\deadbeef");
- Status = ZwUnloadDriver(&RegPath);
- ok (Status == STATUS_OBJECT_NAME_NOT_FOUND, "Expected NTSTATUS
STATUS_OBJECT_NAME_NOT_FOUND, got 0x%lX", Status);
-
- /* Unload the driver */
- RtlInitUnicodeString(&RegPath, NewDriverRegPath);
- Status = ZwUnloadDriver(&RegPath);
- ok(Status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got 0x%lX",
Status);
-
- if (!NT_SUCCESS(Status))
- {
- return FALSE;
- }
-
- return TRUE;
-}
Added: branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/IoDriverObject_user.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/n…
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/IoDriverObject_user.c (added)
+++ branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/IoDriverObject_user.c [iso-8859-1] Wed
Aug 3 12:48:22 2011
@@ -1,0 +1,16 @@
+/*
+ * PROJECT: ReactOS kernel-mode tests
+ * LICENSE: GPLv2+ - See COPYING in the top level directory
+ * PURPOSE: Kernel-Mode Test Suite Driver Object test user-mode part
+ * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de>
+ */
+
+#include <kmt_test.h>
+
+START_TEST(IoDriverObject)
+{
+ KmtLoadDriver(L"IoDriverObject", FALSE);
+ KmtOpenDriver();
+ KmtCloseDriver();
+ KmtUnloadDriver();
+}
Propchange: branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/IoDriverObject_user.c
------------------------------------------------------------------------------
svn:eol-style = native
Copied: branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/iodriverobject_drv.rbuild (from
r52780, branches/GSoC_2011/KMTestSuite/kmtests/example/example_drv.rbuild)
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2011/KMTestSuite/kmtests/n…
==============================================================================
--- branches/GSoC_2011/KMTestSuite/kmtests/example/example_drv.rbuild [iso-8859-1]
(original)
+++ branches/GSoC_2011/KMTestSuite/kmtests/ntos_io/iodriverobject_drv.rbuild [iso-8859-1]
Wed Aug 3 12:48:22 2011
@@ -1,11 +1,11 @@
-<module name="example_drv" type="kernelmodedriver"
installbase="bin" installname="example_drv.sys">
+<module name="iodriverobject_drv" type="kernelmodedriver"
installbase="bin" installname="iodriverobject_drv.sys">
<include base="kmtest_drv">include</include>
<library>ntoskrnl</library>
<library>hal</library>
<library>pseh</library>
<library>kmtest_printf</library>
<define name="KMT_STANDALONE_DRIVER" />
- <file>Example_drv.c</file>
+ <file>IoDriverObject_drv.c</file>
<directory name="..">
<directory name="kmtest_drv">
<file>kmtest_standalone.c</file>