From e2463c955c8dcb8fbbec110b13474882cdfc805a Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Tue, 27 Apr 2010 13:06:42 +0000 Subject: [PATCH] [KMTEST] - Add KeStallExecutionProcessor test. svn path=/trunk/; revision=47047 --- rostests/drivers/kmtest/kmtest.c | 2 + rostests/drivers/kmtest/kmtest.rbuild | 1 + rostests/drivers/kmtest/ntos_ke.c | 86 +++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 rostests/drivers/kmtest/ntos_ke.c diff --git a/rostests/drivers/kmtest/kmtest.c b/rostests/drivers/kmtest/kmtest.c index 948797a3273..964486a93f6 100644 --- a/rostests/drivers/kmtest/kmtest.c +++ b/rostests/drivers/kmtest/kmtest.c @@ -106,6 +106,7 @@ PWCHAR CreateLowerDeviceRegistryKey(PUNICODE_STRING RegistryPath, PWCHAR NewDriv * Test Declarations */ VOID NtoskrnlIoTests(); +VOID NtoskrnlKeTests(); VOID NtoskrnlObTest(); VOID NtoskrnlExecutiveTests(); VOID NtoskrnlPoolsTest(); @@ -214,6 +215,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject, ThisDriverObject = DriverObject; NtoskrnlExecutiveTests(); + NtoskrnlKeTests(); NtoskrnlIoTests(); NtoskrnlObTest(); NtoskrnlPoolsTest(); diff --git a/rostests/drivers/kmtest/kmtest.rbuild b/rostests/drivers/kmtest/kmtest.rbuild index e45f8a6baea..9219db9f9c1 100644 --- a/rostests/drivers/kmtest/kmtest.rbuild +++ b/rostests/drivers/kmtest/kmtest.rbuild @@ -12,6 +12,7 @@ reghelper.c ntos_ex.c ntos_io.c + ntos_ke.c ntos_ob.c ntos_pools.c kmtest.rc diff --git a/rostests/drivers/kmtest/ntos_ke.c b/rostests/drivers/kmtest/ntos_ke.c new file mode 100644 index 00000000000..1c6032238be --- /dev/null +++ b/rostests/drivers/kmtest/ntos_ke.c @@ -0,0 +1,86 @@ +/* + * NTOSKRNL Executive Regressions KM-Test + * ReactOS Kernel Mode Regression Testing framework + * + * Copyright 2006 Aleksey Bragin + * + * 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. + */ + +/* INCLUDES *******************************************************************/ + +#include +#include +#include +#include "kmtest.h" + +#define NDEBUG +#include "debug.h" + +/* PRIVATE FUNCTIONS ***********************************************************/ + +VOID +NTAPI +KeStallTest() +{ + ULONG i; + LARGE_INTEGER TimeStart, TimeFinish; + + StartTest(); + + DPRINT1("Waiting for 30 secs with 50us stalls...\n"); + KeQuerySystemTime(&TimeStart); + for (i = 0; i < (30*1000*20); i++) + { + KeStallExecutionProcessor(50); + } + KeQuerySystemTime(&TimeFinish); + DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 30 + + DPRINT1("Waiting for 30 secs with 1000us stalls...\n"); + KeQuerySystemTime(&TimeStart); + for (i = 0; i < (30*1000); i++) + { + KeStallExecutionProcessor(1000); + } + KeQuerySystemTime(&TimeFinish); + DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 30 + + DPRINT1("Waiting for 30 secs with 1us stalls...\n"); + KeQuerySystemTime(&TimeStart); + for (i = 0; i < (30*1000*1000); i++) + { + KeStallExecutionProcessor(1); + } + KeQuerySystemTime(&TimeFinish); + DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 43 + + DPRINT1("Waiting for 30 secs with one huge stall...\n"); + KeQuerySystemTime(&TimeStart); + KeStallExecutionProcessor(30*1000000); + KeQuerySystemTime(&TimeFinish); + DPRINT1("Time elapsed: %d secs\n", (TimeFinish.QuadPart - TimeStart.QuadPart) / 10000000); // 30 + + FinishTest("NTOSKRNL KeStallmanExecution test"); +} + +/* PUBLIC FUNCTIONS ***********************************************************/ + +VOID +NtoskrnlKeTests() +{ + KeStallTest(); +}