[3/5] kernel32/tests: Ensure VirtualAlloc tests do not depend on previous memory allocations.

Sebastian Lackner sebastian at fds-team.de
Sat Feb 13 15:25:48 CST 2016


Following tests try to allocate memory at (char *)addr1 + 0x1000.
We expect that no memory is mapped at this location.

Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---

Patch 5 would let a test marked as todo_wine succeed otherwise.

 dlls/kernel32/tests/virtual.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
index f47a54c..c35f4db 100644
--- a/dlls/kernel32/tests/virtual.c
+++ b/dlls/kernel32/tests/virtual.c
@@ -383,9 +383,13 @@ static void test_VirtualAlloc(void)
 
     ok(VirtualFree(addr1, 0, MEM_RELEASE), "VirtualFree failed\n");
 
-    addr1 = VirtualAlloc(0, 0x1000, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+    /* memory returned by VirtualAlloc should be aligned to 64k */
+    addr1 = VirtualAlloc(0, 0x2000, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
     ok(addr1 != NULL, "VirtualAlloc failed\n");
     ok(!((ULONG_PTR)addr1 & 0xffff), "returned memory %p is not aligned to 64k\n", addr1);
+    ok(VirtualFree(addr1, 0, MEM_RELEASE), "VirtualFree failed\n");
+    addr2 = VirtualAlloc(addr1, 0x1000, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+    ok(addr2 == addr1, "VirtualAlloc returned %p, expected %p\n", addr2, addr1);
 
     /* allocation conflicts because of 64k align */
     size = 0x1000;
-- 
2.7.1



More information about the wine-patches mailing list