- Misc cleanup of kmtest.

- Add paged/nonpaged pools test routines.
- Comment out invocations of other tests temporary.

svn path=/trunk/; revision=33852
This commit is contained in:
Aleksey Bragin 2008-06-04 09:50:19 +00:00
parent 170743424f
commit 97e7725dc9
8 changed files with 153 additions and 17 deletions

View file

@ -70,7 +70,7 @@
* function worked correctly. * function worked correctly.
*/ */
NTSTATUS STDCALL NTSTATUS NTAPI
ReactOS_IoGetDeviceInterfaces( ReactOS_IoGetDeviceInterfaces(
IN CONST GUID *InterfaceClassGuid, IN CONST GUID *InterfaceClassGuid,
IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,

View file

@ -31,21 +31,21 @@
/* PRIVATE FUNCTIONS **********************************************************/ /* PRIVATE FUNCTIONS **********************************************************/
NTSTATUS STDCALL NTSTATUS NTAPI
(*IoGetDeviceInterfaces_Func)( (*IoGetDeviceInterfaces_Func)(
IN CONST GUID *InterfaceClassGuid, IN CONST GUID *InterfaceClassGuid,
IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
IN ULONG Flags, IN ULONG Flags,
OUT PWSTR *SymbolicLinkList); OUT PWSTR *SymbolicLinkList);
NTSTATUS STDCALL NTSTATUS NTAPI
ReactOS_IoGetDeviceInterfaces( ReactOS_IoGetDeviceInterfaces(
IN CONST GUID *InterfaceClassGuid, IN CONST GUID *InterfaceClassGuid,
IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL, IN PDEVICE_OBJECT PhysicalDeviceObject OPTIONAL,
IN ULONG Flags, IN ULONG Flags,
OUT PWSTR *SymbolicLinkList); OUT PWSTR *SymbolicLinkList);
VOID FASTCALL DeviceInterfaceTest_Func() VOID DeviceInterfaceTest_Func()
{ {
NTSTATUS Status; NTSTATUS Status;
PWSTR SymbolicLinkList; PWSTR SymbolicLinkList;
@ -134,7 +134,7 @@ VOID RegisterDI_Test()
"IoRegisterDeviceInterface returned 0x%08lX\n", Status); "IoRegisterDeviceInterface returned 0x%08lX\n", Status);
} }
VOID FASTCALL NtoskrnlIoDeviceInterface() VOID NtoskrnlIoDeviceInterface()
{ {
StartTest(); StartTest();

View file

@ -103,10 +103,11 @@ int kmtest_ok(int condition, const char *msg, ... )
/* /*
* Test Declarations * Test Declarations
*/ */
VOID FASTCALL NtoskrnlIoMdlTest(); VOID NtoskrnlIoMdlTest();
VOID FASTCALL NtoskrnlIoDeviceInterface(); VOID NtoskrnlIoDeviceInterface();
VOID FASTCALL NtoskrnlObTest(); VOID NtoskrnlObTest();
VOID FASTCALL NtoskrnlExecutiveTests(); VOID NtoskrnlExecutiveTests();
VOID NtoskrnlPoolsTest();
/* /*
* DriverEntry * DriverEntry
@ -117,10 +118,12 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
PUNICODE_STRING RegistryPath) PUNICODE_STRING RegistryPath)
{ {
DbgPrint("\n===============================================\nKernel Mode Regression Test driver starting...\n"); DbgPrint("\n===============================================\nKernel Mode Regression Test driver starting...\n");
NtoskrnlExecutiveTests(); //NtoskrnlExecutiveTests();
NtoskrnlIoDeviceInterface(); //NtoskrnlIoDeviceInterface();
NtoskrnlIoMdlTest(); //NtoskrnlIoMdlTest();
NtoskrnlObTest(); //NtoskrnlObTest();
//NtoskrnlObTest();
NtoskrnlPoolsTest();
return STATUS_UNSUCCESSFUL; return STATUS_SUCCESS;
} }

View file

@ -10,5 +10,6 @@
<file>ntos_ex.c</file> <file>ntos_ex.c</file>
<file>ntos_io.c</file> <file>ntos_io.c</file>
<file>ntos_ob.c</file> <file>ntos_ob.c</file>
<file>ntos_pools.c</file>
<file>kmtest.rc</file> <file>kmtest.rc</file>
</module> </module>

View file

@ -173,7 +173,6 @@ ExTimerTest()
/* PUBLIC FUNCTIONS ***********************************************************/ /* PUBLIC FUNCTIONS ***********************************************************/
VOID VOID
FASTCALL
NtoskrnlExecutiveTests() NtoskrnlExecutiveTests()
{ {
ExTimerTest(); ExTimerTest();

View file

@ -30,7 +30,7 @@
/* PUBLIC FUNCTIONS ***********************************************************/ /* PUBLIC FUNCTIONS ***********************************************************/
VOID FASTCALL NtoskrnlIoMdlTest() VOID NtoskrnlIoMdlTest()
{ {
PMDL Mdl; PMDL Mdl;
PIRP Irp; PIRP Irp;

View file

@ -487,7 +487,6 @@ ObtReferenceTests()
/* PUBLIC FUNCTIONS ***********************************************************/ /* PUBLIC FUNCTIONS ***********************************************************/
VOID VOID
FASTCALL
NtoskrnlObTest() NtoskrnlObTest()
{ {
StartTest(); StartTest();

View file

@ -0,0 +1,134 @@
/*
* NTOSKRNL Pools test routines KM-Test
* ReactOS Kernel Mode Regression Testing framework
*
* Copyright 2008 Aleksey Bragin <aleksey@reactos.org>
*
* 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 <ddk/ntddk.h>
#include <ntifs.h>
#include <ndk/ntndk.h>
#include "kmtest.h"
//#define NDEBUG
#include "debug.h"
#define TAG_POOLTEST TAG('P','t','s','t')
/* PRIVATE FUNCTIONS ***********************************************************/
VOID
PoolsTest()
{
PVOID Ptr;
ULONG AllocSize, i, AllocNumber;
PVOID *Allocs;
StartTest();
// Stress-test nonpaged pool
for (i=1; i<10000; i++)
{
// make up some increasing, a bit irregular size
AllocSize = i*10;
if (i % 10)
AllocSize++;
if (i % 25)
AllocSize += 13;
// start with non-paged pool
Ptr = ExAllocatePoolWithTag(NonPagedPool, AllocSize, TAG_POOLTEST);
// it may fail due to no-memory condition
if (!Ptr) break;
// try to fully fill it
RtlFillMemory(Ptr, AllocSize, 0xAB);
// free it
ExFreePoolWithTag(Ptr, TAG_POOLTEST);
}
// now paged one
for (i=1; i<10000; i++)
{
// make up some increasing, a bit irregular size
AllocSize = i*50;
if (i % 10)
AllocSize++;
if (i % 25)
AllocSize += 13;
// start with non-paged pool
Ptr = ExAllocatePoolWithTag(PagedPool, AllocSize, TAG_POOLTEST);
// it may fail due to no-memory condition
if (!Ptr) break;
// try to fully fill it
RtlFillMemory(Ptr, AllocSize, 0xAB);
// free it
ExFreePoolWithTag(Ptr, TAG_POOLTEST);
}
// test super-big allocations
/*AllocSize = 2UL * 1024 * 1024 * 1024;
Ptr = ExAllocatePoolWithTag(NonPagedPool, AllocSize, TAG_POOLTEST);
ok(Ptr == NULL, "Allocating 2Gb of nonpaged pool should fail\n");
Ptr = ExAllocatePoolWithTag(PagedPool, AllocSize, TAG_POOLTEST);
ok(Ptr == NULL, "Allocating 2Gb of paged pool should fail\n");*/
// now test allocating lots of small/medium blocks
AllocNumber = 100000;
Allocs = ExAllocatePoolWithTag(PagedPool, sizeof(Allocs) * AllocNumber, TAG_POOLTEST);
// alloc blocks
for (i=0; i<AllocNumber; i++)
{
AllocSize = 42;
Allocs[i] = ExAllocatePoolWithTag(NonPagedPool, AllocSize, TAG_POOLTEST);
}
// now free them
for (i=0; i<AllocNumber; i++)
{
ExFreePoolWithTag(Allocs[i], TAG_POOLTEST);
}
ExFreePoolWithTag(Allocs, TAG_POOLTEST);
FinishTest("NTOSKRNL Pools Tests");
}
/* PUBLIC FUNCTIONS ***********************************************************/
VOID
NtoskrnlPoolsTest()
{
PoolsTest();
}