mirror of
https://github.com/reactos/reactos.git
synced 2024-07-05 12:15:46 +00:00
- Add IRP tests based on a Alexander Morozov's patch to Wine ("[try 3] Add tests for IoInitializeIrp and IoAllocateIrp").
svn path=/trunk/; revision=34947
This commit is contained in:
parent
c6de7a80b8
commit
8edd5bdaa0
|
@ -103,8 +103,7 @@ int kmtest_ok(int condition, const char *msg, ... )
|
||||||
/*
|
/*
|
||||||
* Test Declarations
|
* Test Declarations
|
||||||
*/
|
*/
|
||||||
VOID NtoskrnlIoMdlTest();
|
VOID NtoskrnlIoTests();
|
||||||
VOID NtoskrnlIoDeviceInterface();
|
|
||||||
VOID NtoskrnlObTest();
|
VOID NtoskrnlObTest();
|
||||||
VOID NtoskrnlExecutiveTests();
|
VOID NtoskrnlExecutiveTests();
|
||||||
VOID NtoskrnlPoolsTest();
|
VOID NtoskrnlPoolsTest();
|
||||||
|
@ -120,10 +119,9 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
|
||||||
DbgPrint("\n===============================================\nKernel Mode Regression Test driver starting...\n");
|
DbgPrint("\n===============================================\nKernel Mode Regression Test driver starting...\n");
|
||||||
//NtoskrnlExecutiveTests();
|
//NtoskrnlExecutiveTests();
|
||||||
//NtoskrnlIoDeviceInterface();
|
//NtoskrnlIoDeviceInterface();
|
||||||
//NtoskrnlIoMdlTest();
|
NtoskrnlIoTests();
|
||||||
//NtoskrnlObTest();
|
//NtoskrnlObTest();
|
||||||
//NtoskrnlObTest();
|
//NtoskrnlPoolsTest();
|
||||||
NtoskrnlPoolsTest();
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
* ReactOS Kernel Mode Regression Testing framework
|
* ReactOS Kernel Mode Regression Testing framework
|
||||||
*
|
*
|
||||||
* Copyright 2006 Aleksey Bragin <aleksey@reactos.org>
|
* Copyright 2006 Aleksey Bragin <aleksey@reactos.org>
|
||||||
|
* Copyright 2008 Etersoft (Alexander Morozov)
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -28,6 +29,9 @@
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
VOID NtoskrnlIoDeviceInterface();
|
||||||
|
|
||||||
|
|
||||||
/* PUBLIC FUNCTIONS ***********************************************************/
|
/* PUBLIC FUNCTIONS ***********************************************************/
|
||||||
|
|
||||||
VOID NtoskrnlIoMdlTest()
|
VOID NtoskrnlIoMdlTest()
|
||||||
|
@ -79,3 +83,91 @@ VOID NtoskrnlIoMdlTest()
|
||||||
|
|
||||||
FinishTest("NTOSKRNL Io Mdl");
|
FinishTest("NTOSKRNL Io Mdl");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID NtoskrnlIoIrpTest()
|
||||||
|
{
|
||||||
|
USHORT size;
|
||||||
|
IRP *iorp;
|
||||||
|
|
||||||
|
// 1st test
|
||||||
|
size = sizeof(IRP) + 5 * sizeof(IO_STACK_LOCATION);
|
||||||
|
iorp = ExAllocatePool(NonPagedPool, size);
|
||||||
|
|
||||||
|
if (NULL != iorp)
|
||||||
|
{
|
||||||
|
IoInitializeIrp(iorp, size, 5);
|
||||||
|
|
||||||
|
ok(6 == iorp->Type, "Irp type should be 6, but got %d\n", iorp->Type);
|
||||||
|
ok(iorp->Size == size, "Irp size should be %d, but got %d\n",
|
||||||
|
iorp->Size, size);
|
||||||
|
ok(5 == iorp->StackCount, "Irp StackCount should be 5, but got %d\n",
|
||||||
|
iorp->StackCount);
|
||||||
|
ok(6 == iorp->CurrentLocation, "Irp CurrentLocation should be 6, but got %d\n",
|
||||||
|
iorp->CurrentLocation);
|
||||||
|
ok(IsListEmpty(&iorp->ThreadListEntry), "IRP thread list is not empty\n");
|
||||||
|
ok ((PIO_STACK_LOCATION)(iorp + 1) + 5 ==
|
||||||
|
iorp->Tail.Overlay.CurrentStackLocation,
|
||||||
|
"CurrentStackLocation mismatch\n");
|
||||||
|
|
||||||
|
ExFreePool(iorp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2nd test
|
||||||
|
size = sizeof(IRP) + 2 * sizeof(IO_STACK_LOCATION);
|
||||||
|
iorp = IoAllocateIrp(2, FALSE);
|
||||||
|
|
||||||
|
if (NULL != iorp)
|
||||||
|
{
|
||||||
|
ok(6 == iorp->Type, "Irp type should be 6, but got %d\n", iorp->Type);
|
||||||
|
ok(iorp->Size >= size,
|
||||||
|
"Irp size should be more or equal to %d, but got %d\n",
|
||||||
|
iorp->Size, size);
|
||||||
|
ok(2 == iorp->StackCount, "Irp StackCount should be 2, but got %d\n",
|
||||||
|
iorp->StackCount);
|
||||||
|
ok(3 == iorp->CurrentLocation, "Irp CurrentLocation should be 3, but got %d\n",
|
||||||
|
iorp->CurrentLocation);
|
||||||
|
ok(IsListEmpty(&iorp->ThreadListEntry), "IRP thread list is not empty\n");
|
||||||
|
ok ((PIO_STACK_LOCATION)(iorp + 1) + 2 ==
|
||||||
|
iorp->Tail.Overlay.CurrentStackLocation,
|
||||||
|
"CurrentStackLocation mismatch\n");
|
||||||
|
ok((IRP_ALLOCATED_FIXED_SIZE & iorp->AllocationFlags),
|
||||||
|
"IRP Allocation flags lack fixed size attribute\n");
|
||||||
|
ok(!(IRP_LOOKASIDE_ALLOCATION & iorp->AllocationFlags),
|
||||||
|
"IRP Allocation flags should not have lookaside allocation\n");
|
||||||
|
|
||||||
|
IoFreeIrp(iorp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3rd test
|
||||||
|
size = sizeof(IRP) + 2 * sizeof(IO_STACK_LOCATION);
|
||||||
|
iorp = IoAllocateIrp(2, TRUE);
|
||||||
|
|
||||||
|
if (NULL != iorp)
|
||||||
|
{
|
||||||
|
ok(6 == iorp->Type, "Irp type should be 6, but got %d\n", iorp->Type);
|
||||||
|
ok(iorp->Size >= size,
|
||||||
|
"Irp size should be more or equal to %d, but got %d\n",
|
||||||
|
iorp->Size, size);
|
||||||
|
ok(2 == iorp->StackCount, "Irp StackCount should be 2, but got %d\n",
|
||||||
|
iorp->StackCount);
|
||||||
|
ok(3 == iorp->CurrentLocation, "Irp CurrentLocation should be 3, but got %d\n",
|
||||||
|
iorp->CurrentLocation);
|
||||||
|
ok(IsListEmpty(&iorp->ThreadListEntry), "IRP thread list is not empty\n");
|
||||||
|
ok ((PIO_STACK_LOCATION)(iorp + 1) + 2 ==
|
||||||
|
iorp->Tail.Overlay.CurrentStackLocation,
|
||||||
|
"CurrentStackLocation mismatch\n");
|
||||||
|
ok((IRP_ALLOCATED_FIXED_SIZE & iorp->AllocationFlags),
|
||||||
|
"IRP Allocation flags lack fixed size attribute\n");
|
||||||
|
ok((IRP_LOOKASIDE_ALLOCATION & iorp->AllocationFlags),
|
||||||
|
"IRP Allocation flags lack lookaside allocation\n");
|
||||||
|
|
||||||
|
IoFreeIrp(iorp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID NtoskrnlIoTests()
|
||||||
|
{
|
||||||
|
//NtoskrnlIoMdlTest();
|
||||||
|
//NtoskrnlIoDeviceInterface();
|
||||||
|
NtoskrnlIoIrpTest();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue