=?UTF-8?Q?R=C3=A9mi=20Bernon=20?=: ntdll/tests: Use MEM_TOP_DOWN parameter to consistently fail zero_bits tests.

Alexandre Julliard julliard at winehq.org
Tue Aug 13 14:54:33 CDT 2019


Module: wine
Branch: master
Commit: 54ba6b0ce5542f92f9863fd38810892e6773932a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=54ba6b0ce5542f92f9863fd38810892e6773932a

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Thu Aug  1 10:07:42 2019 +0200

ntdll/tests: Use MEM_TOP_DOWN parameter to consistently fail zero_bits tests.

The todo_wine_if made the tests not really test anything, and one test
was succeeding when it shouldn't. Now we can actually remove the todo
when 1 zero_bits handling is implemented.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/tests/virtual.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/dlls/ntdll/tests/virtual.c b/dlls/ntdll/tests/virtual.c
index d45df72..8a53562 100644
--- a/dlls/ntdll/tests/virtual.c
+++ b/dlls/ntdll/tests/virtual.c
@@ -101,12 +101,14 @@ static void test_NtAllocateVirtualMemory(void)
     addr2 = NULL;
     zero_bits = 1;
     status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, zero_bits, &size,
-                                     MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
+                                     MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN,
+                                     PAGE_READWRITE);
     ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY ||
        broken(status == STATUS_INVALID_PARAMETER_3) /* winxp */,
        "NtAllocateVirtualMemory returned %08x\n", status);
     if (status == STATUS_SUCCESS)
     {
+        todo_wine_if(is_win64)
         ok(((UINT_PTR)addr2 >> (32 - zero_bits)) == 0,
            "NtAllocateVirtualMemory returned address: %p\n", addr2);
 
@@ -120,13 +122,14 @@ static void test_NtAllocateVirtualMemory(void)
         size = 0x1000;
         addr2 = NULL;
         status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, zero_bits, &size,
-                                         MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
+                                         MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN,
+                                         PAGE_READWRITE);
         ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY ||
            broken(zero_bits == 20 && status == STATUS_CONFLICTING_ADDRESSES) /* w1064v1809 */,
            "NtAllocateVirtualMemory with %d zero_bits returned %08x\n", (int)zero_bits, status);
         if (status == STATUS_SUCCESS)
         {
-            todo_wine_if((UINT_PTR)addr2 >> (32 - zero_bits))
+            todo_wine
             ok(((UINT_PTR)addr2 >> (32 - zero_bits)) == 0,
                "NtAllocateVirtualMemory with %d zero_bits returned address %p\n", (int)zero_bits, addr2);
 
@@ -164,7 +167,8 @@ static void test_NtAllocateVirtualMemory(void)
     addr2 = NULL;
     zero_bits = 0x1fffffff;
     status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr2, zero_bits, &size,
-                                      MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
+                                      MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN,
+                                      PAGE_READWRITE);
 
     if (!is_win64 && !is_wow64)
     {
@@ -176,7 +180,7 @@ static void test_NtAllocateVirtualMemory(void)
            "NtAllocateVirtualMemory returned %08x\n", status);
         if (status == STATUS_SUCCESS)
         {
-            todo_wine_if((UINT_PTR)addr2 & ~zero_bits)
+            todo_wine
             ok(((UINT_PTR)addr2 & ~zero_bits) == 0,
                "NtAllocateVirtualMemory returned address %p\n", addr2);
 
@@ -308,12 +312,12 @@ static void test_NtMapViewOfSection(void)
     size = 0;
     zero_bits = 1;
     offset.QuadPart = 0;
-    status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, 0, PAGE_READWRITE);
+    status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, MEM_TOP_DOWN, PAGE_READWRITE);
     ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY,
        "NtMapViewOfSection returned %08x\n", status);
     if (status == STATUS_SUCCESS)
     {
-        todo_wine_if((UINT_PTR)ptr2 >> (32 - zero_bits))
+        todo_wine_if(is_win64)
         ok(((UINT_PTR)ptr2 >> (32 - zero_bits)) == 0,
            "NtMapViewOfSection returned address: %p\n", ptr2);
 
@@ -326,12 +330,12 @@ static void test_NtMapViewOfSection(void)
         ptr2 = NULL;
         size = 0;
         offset.QuadPart = 0;
-        status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, 0, PAGE_READWRITE);
+        status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, MEM_TOP_DOWN, PAGE_READWRITE);
         ok(status == STATUS_SUCCESS || status == STATUS_NO_MEMORY,
            "NtMapViewOfSection with %d zero_bits returned %08x\n", (int)zero_bits, status);
         if (status == STATUS_SUCCESS)
         {
-            todo_wine_if((UINT_PTR)ptr2 >> (32 - zero_bits))
+            todo_wine
             ok(((UINT_PTR)ptr2 >> (32 - zero_bits)) == 0,
                "NtMapViewOfSection with %d zero_bits returned address %p\n", (int)zero_bits, ptr2);
 
@@ -362,7 +366,7 @@ static void test_NtMapViewOfSection(void)
     size = 0;
     zero_bits = 0x1fffffff;
     offset.QuadPart = 0;
-    status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, 0, PAGE_READWRITE);
+    status = NtMapViewOfSection(mapping, process, &ptr2, zero_bits, 0, &offset, &size, 1, MEM_TOP_DOWN, PAGE_READWRITE);
 
     if (!is_win64 && !is_wow64)
     {
@@ -374,7 +378,7 @@ static void test_NtMapViewOfSection(void)
            "NtMapViewOfSection returned %08x\n", status);
         if (status == STATUS_SUCCESS)
         {
-            todo_wine_if((UINT_PTR)ptr2 & ~zero_bits)
+            todo_wine
             ok(((UINT_PTR)ptr2 & ~zero_bits) == 0,
                "NtMapViewOfSection returned address %p\n", ptr2);
 




More information about the wine-cvs mailing list