Paul Gofman : kernel32/tests: Fix test_GlobalMemoryStatus() for Win up to 8.1 and RAM size above 4GB.

Alexandre Julliard julliard at winehq.org
Fri Apr 30 16:03:29 CDT 2021


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

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Fri Apr 30 21:29:04 2021 +0300

kernel32/tests: Fix test_GlobalMemoryStatus() for Win up to 8.1 and RAM size above 4GB.

Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/heap.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/kernel32/tests/heap.c b/dlls/kernel32/tests/heap.c
index 0a4e3367f60..8558bd7f1b3 100644
--- a/dlls/kernel32/tests/heap.c
+++ b/dlls/kernel32/tests/heap.c
@@ -1223,9 +1223,9 @@ static BOOL compare_ulong64(ULONG64 v1, ULONG64 v2, ULONG64 max_diff)
 static void test_GlobalMemoryStatus(void)
 {
     static const ULONG64 max_diff = 0x200000;
+    SIZE_T size, size_broken;
     MEMORYSTATUSEX memex;
     MEMORYSTATUS mem;
-    SIZE_T size;
 
     mem.dwLength = sizeof(mem);
     GlobalMemoryStatus(&mem);
@@ -1236,10 +1236,16 @@ static void test_GlobalMemoryStatus(void)
      * GlobalMemoryStatus() and GlobalMemoryStatusEx() calls. */
 
     size = min(memex.ullTotalPhys, ~(SIZE_T)0 >> 1);
-    ok(compare_ulong64(mem.dwTotalPhys, size, max_diff), "Got unexpected dwTotalPhys %s, size %s.\n",
+    size_broken = min(memex.ullTotalPhys, ~(SIZE_T)0);
+    ok(compare_ulong64(mem.dwTotalPhys, size, max_diff)
+            || broken(compare_ulong64(mem.dwTotalPhys, size_broken, max_diff)) /* Win <= 8.1 with RAM size > 4GB */,
+            "Got unexpected dwTotalPhys %s, size %s.\n",
             wine_dbgstr_longlong(mem.dwTotalPhys), wine_dbgstr_longlong(size));
     size = min(memex.ullAvailPhys, ~(SIZE_T)0 >> 1);
-    ok(compare_ulong64(mem.dwAvailPhys, size, max_diff), "Got unexpected dwAvailPhys %s, size %s.\n",
+    size_broken = min(memex.ullAvailPhys, ~(SIZE_T)0);
+    ok(compare_ulong64(mem.dwAvailPhys, size, max_diff)
+            || broken(compare_ulong64(mem.dwAvailPhys, size_broken, max_diff)) /* Win <= 8.1 with RAM size > 4GB */,
+            "Got unexpected dwAvailPhys %s, size %s.\n",
             wine_dbgstr_longlong(mem.dwAvailPhys), wine_dbgstr_longlong(size));
 
     size = min(memex.ullTotalPageFile, ~(SIZE_T)0);




More information about the wine-cvs mailing list