mirror of
https://github.com/reactos/reactos.git
synced 2025-07-24 14:23:41 +00:00
[KMTESTS\NTOS_KE] - Add KeTimer test stub which tests only KeInitializeTimerEx (Note: this function initializes more fields of dispatch header than KeInitializeEvent).
svn path=/trunk/; revision=54047
This commit is contained in:
parent
2d9f70c370
commit
b2b0280779
4 changed files with 74 additions and 0 deletions
|
@ -43,6 +43,7 @@ list(APPEND KMTEST_DRV_SOURCE
|
|||
ntos_ke/KeIrql.c
|
||||
ntos_ke/KeProcessor.c
|
||||
ntos_ke/KeSpinLock.c
|
||||
ntos_ke/KeTimer.c
|
||||
ntos_mm/MmSection.c
|
||||
ntos_ob/ObReference.c
|
||||
ntos_ob/ObType.c
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
<file>KeIrql.c</file>
|
||||
<file>KeProcessor.c</file>
|
||||
<file>KeSpinLock.c</file>
|
||||
<file>KeTimer.c</file>
|
||||
</directory>
|
||||
<directory name="ntos_mm">
|
||||
<file>MmSection.c</file>
|
||||
|
|
|
@ -29,6 +29,7 @@ KMT_TESTFUNC Test_KeEvent;
|
|||
KMT_TESTFUNC Test_KeGuardedMutex;
|
||||
KMT_TESTFUNC Test_KeIrql;
|
||||
KMT_TESTFUNC Test_KeProcessor;
|
||||
KMT_TESTFUNC Test_KeTimer;
|
||||
KMT_TESTFUNC Test_KernelType;
|
||||
KMT_TESTFUNC Test_MmSection;
|
||||
KMT_TESTFUNC Test_ObReference;
|
||||
|
@ -63,6 +64,7 @@ const KMT_TEST TestList[] =
|
|||
{ "KeGuardedMutex", Test_KeGuardedMutex },
|
||||
{ "KeIrql", Test_KeIrql },
|
||||
{ "-KeProcessor", Test_KeProcessor },
|
||||
{ "KeTimer", Test_KeTimer },
|
||||
{ "-KernelType", Test_KernelType },
|
||||
{ "MmSection", Test_MmSection },
|
||||
{ "ObReference", Test_ObReference },
|
||||
|
|
70
rostests/kmtests/ntos_ke/KeTimer.c
Normal file
70
rostests/kmtests/ntos_ke/KeTimer.c
Normal file
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* PROJECT: ReactOS kernel-mode tests
|
||||
* LICENSE: GPLv2+ - See COPYING in the top level directory
|
||||
* PURPOSE: Kernel-Mode Test Suite Timer test
|
||||
* PROGRAMMER: Rafal Harabien <rafalh@reactos.org>
|
||||
*/
|
||||
|
||||
#include <kmt_test.h>
|
||||
|
||||
#define CheckTimer(Timer, ExpectedType, State, ExpectedWaitNext, \
|
||||
Irql, ThreadList, ThreadCount) do \
|
||||
{ \
|
||||
INT TheIndex; \
|
||||
PLIST_ENTRY TheEntry; \
|
||||
PKTHREAD TheThread; \
|
||||
ok_eq_uint((Timer)->Header.Type, ExpectedType); \
|
||||
ok_eq_uint((Timer)->Header.Hand, sizeof *(Timer) / sizeof(ULONG)); \
|
||||
ok_eq_hex((Timer)->Header.Lock & 0xFF00FF00L, 0x00005500L); \
|
||||
ok_eq_long((Timer)->Header.SignalState, State); \
|
||||
TheEntry = (Timer)->Header.WaitListHead.Flink; \
|
||||
for (TheIndex = 0; TheIndex < (ThreadCount); ++TheIndex) \
|
||||
{ \
|
||||
TheThread = CONTAINING_RECORD(TheEntry, KTHREAD, \
|
||||
WaitBlock[0].WaitListEntry); \
|
||||
ok_eq_pointer(TheThread, (ThreadList)[TheIndex]); \
|
||||
ok_eq_pointer(TheEntry->Flink->Blink, TheEntry); \
|
||||
TheEntry = TheEntry->Flink; \
|
||||
} \
|
||||
ok_eq_pointer(TheEntry, &(Timer)->Header.WaitListHead); \
|
||||
ok_eq_pointer(TheEntry->Flink->Blink, TheEntry); \
|
||||
ok_eq_long(KeReadStateTimer(Timer), State); \
|
||||
ok_eq_bool(Thread->WaitNext, ExpectedWaitNext); \
|
||||
ok_irql(Irql); \
|
||||
} while (0)
|
||||
|
||||
static
|
||||
VOID
|
||||
TestTimerFunctional(
|
||||
IN PKTIMER Timer,
|
||||
IN TIMER_TYPE Type,
|
||||
IN KIRQL OriginalIrql)
|
||||
{
|
||||
PKTHREAD Thread = KeGetCurrentThread();
|
||||
|
||||
memset(Timer, 0x55, sizeof *Timer);
|
||||
KeInitializeTimerEx(Timer, Type);
|
||||
CheckTimer(Timer, TimerNotificationObject + Type, 0L, FALSE, OriginalIrql, (PVOID *)NULL, 0);
|
||||
}
|
||||
|
||||
START_TEST(KeTimer)
|
||||
{
|
||||
KTIMER Timer;
|
||||
KIRQL Irql;
|
||||
KIRQL Irqls[] = { PASSIVE_LEVEL, APC_LEVEL, DISPATCH_LEVEL, HIGH_LEVEL };
|
||||
INT i;
|
||||
|
||||
for (i = 0; i < sizeof Irqls / sizeof Irqls[0]; ++i)
|
||||
{
|
||||
/* DRIVER_IRQL_NOT_LESS_OR_EQUAL (TODO: on MP only?) */
|
||||
if (Irqls[i] > DISPATCH_LEVEL && KmtIsCheckedBuild)
|
||||
return;
|
||||
KeRaiseIrql(Irqls[i], &Irql);
|
||||
TestTimerFunctional(&Timer, NotificationTimer, Irqls[i]);
|
||||
TestTimerFunctional(&Timer, SynchronizationTimer, Irqls[i]);
|
||||
KeLowerIrql(Irql);
|
||||
}
|
||||
|
||||
ok_irql(PASSIVE_LEVEL);
|
||||
KmtSetIrql(PASSIVE_LEVEL);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue