From: Francois Gouget fgouget@codeweavers.com
Also repeat the test to increase the chance of a failure. --- dlls/kernel32/tests/heap.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/dlls/kernel32/tests/heap.c b/dlls/kernel32/tests/heap.c index a81cb1b7a15..a36df058afb 100644 --- a/dlls/kernel32/tests/heap.c +++ b/dlls/kernel32/tests/heap.c @@ -3549,6 +3549,7 @@ static void test_GlobalMemoryStatus(void) VM_COUNTERS_EX vmc; NTSTATUS status; BOOL ret; + static BOOL first = 1;
SetLastError( 0xdeadbeef ); ret = GlobalMemoryStatusEx( &memex ); @@ -3590,13 +3591,24 @@ static void test_GlobalMemoryStatus(void) /* allow some variability, info sources are not always in sync */ #define IS_WITHIN_RANGE(a, b) (((a) - (b) + (256 * basic_info.PageSize)) <= (512 * basic_info.PageSize))
+#ifndef PRId64 +#define PRId64 "#I64d" +#endif + if (first) + printf("PageSize = %ld -> %ld - %ld\n", basic_info.PageSize, 256 * basic_info.PageSize, 512 * basic_info.PageSize); + printf("memex-expect: Phys: %" PRId64 " - %" PRId64 " = %" PRId64 " / %" PRId64 " - %" PRId64 " = %" PRId64 " PageFile %" PRId64 " - %" PRId64 " = %" PRId64 " / %" PRId64 " - %" PRId64 " = %" PRId64 "\n", + memex.ullAvailPhys, expect.ullAvailPhys, memex.ullAvailPhys - expect.ullAvailPhys, + memex.ullTotalPhys, expect.ullTotalPhys, memex.ullTotalPhys - expect.ullTotalPhys, + memex.ullAvailPageFile, expect.ullAvailPageFile, memex.ullAvailPageFile - expect.ullAvailPageFile, + memex.ullTotalPageFile, expect.ullTotalPageFile, memex.ullTotalPageFile - expect.ullTotalPageFile ); + ok( memex.dwMemoryLoad == expect.dwMemoryLoad, "got dwMemoryLoad %lu\n", memex.dwMemoryLoad ); - ok( memex.ullTotalPhys == expect.ullTotalPhys, "got ullTotalPhys %#I64x\n", memex.ullTotalPhys ); - ok( IS_WITHIN_RANGE( memex.ullAvailPhys, expect.ullAvailPhys ), "got ullAvailPhys %#I64x\n", memex.ullAvailPhys ); - ok( memex.ullTotalPageFile == expect.ullTotalPageFile, "got ullTotalPageFile %#I64x\n", memex.ullTotalPageFile ); - ok( IS_WITHIN_RANGE( memex.ullAvailPageFile, expect.ullAvailPageFile ), "got ullAvailPageFile %#I64x\n", memex.ullAvailPageFile ); - ok( memex.ullTotalVirtual == expect.ullTotalVirtual, "got ullTotalVirtual %#I64x\n", memex.ullTotalVirtual ); - ok( memex.ullAvailVirtual <= expect.ullAvailVirtual, "got ullAvailVirtual %#I64x\n", memex.ullAvailVirtual ); + ok( memex.ullTotalPhys == expect.ullTotalPhys, "got ullTotalPhys %#I64x, expected %#I64x\n", memex.ullTotalPhys, expect.ullTotalPhys ); + ok( IS_WITHIN_RANGE( memex.ullAvailPhys, expect.ullAvailPhys ), "got ullAvailPhys %#I64x, expected %#I64x\n", memex.ullAvailPhys, expect.ullAvailPhys ); + ok( memex.ullTotalPageFile == expect.ullTotalPageFile, "got ullTotalPageFile %#I64x, expected %#I64x\n", memex.ullTotalPageFile, expect.ullTotalPageFile ); + ok( IS_WITHIN_RANGE( memex.ullAvailPageFile, expect.ullAvailPageFile ), "got ullAvailPageFile %#I64x, expected %#I64x\n", memex.ullAvailPageFile, expect.ullAvailPageFile ); + ok( memex.ullTotalVirtual == expect.ullTotalVirtual, "got ullTotalVirtual %#I64x, expected %#I64x\n", memex.ullTotalVirtual, expect.ullTotalVirtual ); + ok( memex.ullAvailVirtual <= expect.ullAvailVirtual, "got ullAvailVirtual %#I64x, expected %#I64x\n", memex.ullAvailVirtual, expect.ullAvailVirtual ); ok( memex.ullAvailExtendedVirtual == 0, "got ullAvailExtendedVirtual %#I64x\n", memex.ullAvailExtendedVirtual );
ok( mem.dwMemoryLoad == memex.dwMemoryLoad, "got dwMemoryLoad %lu\n", mem.dwMemoryLoad ); @@ -3621,6 +3633,7 @@ START_TEST(heap) { int argc; char **argv; + int i;
load_functions();
@@ -3631,13 +3644,20 @@ START_TEST(heap) return; }
+ if (0) { test_HeapCreate(); test_GlobalAlloc(); test_LocalAlloc();
test_GetPhysicallyInstalledSystemMemory(); - test_GlobalMemoryStatus(); + } + for (i = 0; i < 20; i++) + { + test_GlobalMemoryStatus(); + Sleep(1000); + }
+ if (0) { if (pRtlGetNtGlobalFlags) { test_debug_heap( argv[0], 0 ); @@ -3653,4 +3673,5 @@ START_TEST(heap) test_debug_heap( argv[0], 0xdeadbeef ); } else win_skip( "RtlGetNtGlobalFlags not found, skipping heap debug tests\n" ); + } }