mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 20:47:21 +00:00
Add a little more tests for Mdl testing, only 1 failes in ReactOS currently
svn path=/trunk/; revision=22217
This commit is contained in:
parent
eac8defeed
commit
39635013ab
1 changed files with 36 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* NTOSKRNL Io Regressions KM-Test
|
||||
* ReactOS Device Interface functions implementation
|
||||
* ReactOS Kernel Mode Regression Testing framework
|
||||
*
|
||||
* Copyright 2006 Aleksey Bragin <aleksey@reactos.org>
|
||||
*
|
||||
|
@ -30,15 +30,49 @@
|
|||
VOID FASTCALL NtoskrnlIoMdlTest()
|
||||
{
|
||||
PMDL Mdl;
|
||||
PIRP Irp;
|
||||
PVOID VirtualAddress;
|
||||
ULONG MdlSize = 2*4096+184; // 2 pages and some random value
|
||||
|
||||
StartTest();
|
||||
|
||||
// Try to alloc 2Gb MDL
|
||||
Mdl = IoAllocateMdl(NULL, 2048UL*0x100000, FALSE, FALSE, NULL);
|
||||
|
||||
ok(Mdl == NULL, "IoAllocateMdl should fail allocation of 2Gb or more, but got Mdl=0x%X", (UINT)Mdl);
|
||||
ok(Mdl == NULL,
|
||||
"IoAllocateMdl should fail allocation of 2Gb or more, but got Mdl=0x%X",
|
||||
(UINT)Mdl);
|
||||
|
||||
if (Mdl)
|
||||
IoFreeMdl(Mdl);
|
||||
|
||||
// Now create a valid MDL
|
||||
VirtualAddress = ExAllocatePool(NonPagedPool, MdlSize);
|
||||
Mdl = IoAllocateMdl(VirtualAddress, MdlSize, FALSE, FALSE, NULL);
|
||||
ok(Mdl != NULL, "Mdl allocation failed");
|
||||
// Check fields of the allocated struct
|
||||
ok(Mdl->Next == NULL, "Mdl->Next should be NULL, but is 0x%X",
|
||||
(UINT)Mdl->Next);
|
||||
ok(Mdl->ByteCount == MdlSize,
|
||||
"Mdl->ByteCount should be equal to MdlSize, but is 0x%X",
|
||||
(UINT)Mdl->ByteCount);
|
||||
// TODO: Check other fields of MDL struct
|
||||
|
||||
IoFreeMdl(Mdl);
|
||||
// Allocate now with pointer to an Irp
|
||||
Irp = IoAllocateIrp(1, FALSE);
|
||||
ok(Irp != NULL, "IRP allocation failed");
|
||||
Mdl = IoAllocateMdl(VirtualAddress, MdlSize, FALSE, FALSE, Irp);
|
||||
ok(Mdl != NULL, "Mdl allocation failed");
|
||||
ok(Irp->MdlAddress == Mdl, "Irp->MdlAddress should be 0x%X, but is 0x%X",
|
||||
(UINT)Mdl, (UINT)Irp->MdlAddress);
|
||||
|
||||
IoFreeMdl(Mdl);
|
||||
|
||||
// TODO: Check a case when SecondaryBuffer == TRUE
|
||||
|
||||
IoFreeIrp(Irp);
|
||||
ExFreePool(VirtualAddress);
|
||||
|
||||
FinishTest("NTOSKRNL Io Mdl");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue