Author: fireball
Date: Sun Jun 4 22:27:48 2006
New Revision: 22217
URL:
http://svn.reactos.ru/svn/reactos?rev=22217&view=rev
Log:
Add a little more tests for Mdl testing, only 1 failes in ReactOS currently
Modified:
trunk/reactos/drivers/test/kmtest/ntos_io.c
Modified: trunk/reactos/drivers/test/kmtest/ntos_io.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/test/kmtest/ntos_io…
==============================================================================
--- trunk/reactos/drivers/test/kmtest/ntos_io.c (original)
+++ trunk/reactos/drivers/test/kmtest/ntos_io.c Sun Jun 4 22:27:48 2006
@@ -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(a)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");
}