https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2f63da62e305b6609045b…
commit 2f63da62e305b6609045bf09ac0d853d610bc2fb
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Sat Jan 28 19:55:19 2023 -0500
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Sat Jan 28 23:17:52 2023 -0500
[KMTESTS:MM] Fix failures in MmMdl test on machines with 2GB of free RAM.
---
modules/rostests/kmtests/ntos_mm/MmMdl.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/modules/rostests/kmtests/ntos_mm/MmMdl.c
b/modules/rostests/kmtests/ntos_mm/MmMdl.c
index 3ee201f5e0d..e84e3b2ecab 100644
--- a/modules/rostests/kmtests/ntos_mm/MmMdl.c
+++ b/modules/rostests/kmtests/ntos_mm/MmMdl.c
@@ -1,8 +1,9 @@
/*
- * PROJECT: ReactOS kernel-mode tests
- * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
- * PURPOSE: Kernel-Mode Test Suite MDL test
- * PROGRAMMER: Thomas Faber <thomas.faber(a)reactos.org>
+ * PROJECT: ReactOS kernel-mode tests
+ * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
+ * PURPOSE: Kernel-Mode Test Suite MDL test
+ * COPYRIGHT: Copyright 2015,2023 Thomas Faber (thomas.faber(a)reactos.org)
+ * COPYRIGHT: Copyright 2017 Pierre Schweitzer (pierre(a)reactos.org)
*/
#include <kmt_test.h>
@@ -104,7 +105,7 @@ TestMmAllocatePagesForMdl(VOID)
MmFreePagesFromMdl(Mdl);
ExFreePoolWithTag(Mdl, 0);
- /* try to allocate 2 GB -- should succeed but not map */
+ /* try to allocate 2 GB -- should succeed (possibly with fewer pages) but not map */
Mdl = MmAllocatePagesForMdl(LowAddress,
HighAddress,
SkipBytes,
@@ -112,12 +113,12 @@ TestMmAllocatePagesForMdl(VOID)
ok(Mdl != NULL, "MmAllocatePagesForMdl failed for 2 GB\n");
if (Mdl != NULL)
{
- ok(MmGetMdlByteCount(Mdl) != 2UL * 1024 * 1024 * 1024, "Byte count:
%lu\n", MmGetMdlByteCount(Mdl));
+ ok(MmGetMdlByteCount(Mdl) <= 2UL * 1024 * 1024 * 1024, "Byte count:
%lu\n", MmGetMdlByteCount(Mdl));
ok(MmGetMdlVirtualAddress(Mdl) == NULL, "Virtual address: %p\n",
MmGetMdlVirtualAddress(Mdl));
ok(!(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA), "MdlFlags:
%lx\n", Mdl->MdlFlags);
MdlPages = MmGetMdlPfnArray(Mdl);
MdlPageCount = ADDRESS_AND_SIZE_TO_SPAN_PAGES(MmGetMdlVirtualAddress(Mdl),
MmGetMdlByteCount(Mdl));
- ok(MdlPageCount < 2UL * 1024 * 1024 * 1024 / PAGE_SIZE, "MdlPageCount =
%lu\n", MdlPageCount);
+ ok(MdlPageCount <= 2UL * 1024 * 1024 * 1024 / PAGE_SIZE, "MdlPageCount =
%lu\n", MdlPageCount);
for (i = 0; i < MdlPageCount; i++)
{
if (MdlPages[i] == 0 ||
@@ -135,7 +136,7 @@ TestMmAllocatePagesForMdl(VOID)
ok(SystemVa == NULL, "MmMapLockedPagesSpecifyCache succeeded for 2
GB\n");
if (SystemVa != NULL)
MmUnmapLockedPages(SystemVa, Mdl);
- ok(MmGetMdlByteCount(Mdl) != 2UL * 1024 * 1024 * 1024, "Byte count:
%lu\n", MmGetMdlByteCount(Mdl));
+ ok(MmGetMdlByteCount(Mdl) <= 2UL * 1024 * 1024 * 1024, "Byte count:
%lu\n", MmGetMdlByteCount(Mdl));
ok(MmGetMdlVirtualAddress(Mdl) == NULL, "Virtual address: %p\n",
MmGetMdlVirtualAddress(Mdl));
ok(!(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA), "MdlFlags:
%lx\n", Mdl->MdlFlags);
MmFreePagesFromMdl(Mdl);