From: Francois Gouget fgouget@codeweavers.com
Also repeat the test to increase the chance of a failure. --- dlls/kernel32/tests/heap.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-)
diff --git a/dlls/kernel32/tests/heap.c b/dlls/kernel32/tests/heap.c index a81cb1b7a15..ea7ff0079e6 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 = TRUE;
SetLastError( 0xdeadbeef ); ret = GlobalMemoryStatusEx( &memex ); @@ -3590,13 +3591,22 @@ 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))
+ if (first) + printf("PageSize = %ld -> %ld - %ld\n", basic_info.PageSize, 256 * basic_info.PageSize, 512 * basic_info.PageSize); + first = FALSE; + printf("memex-expect: Phys: %#I64x - %#I64x = %ld / %#I64x - %#I64x = %ld PageFile %#I64x - %#I64x = %ld / %#I64x - %#I64x = %ld\n", + memex.ullAvailPhys, expect.ullAvailPhys, (LONG)(memex.ullAvailPhys - expect.ullAvailPhys), + memex.ullTotalPhys, expect.ullTotalPhys, (LONG)(memex.ullTotalPhys - expect.ullTotalPhys), + memex.ullAvailPageFile, expect.ullAvailPageFile, (LONG)(memex.ullAvailPageFile - expect.ullAvailPageFile), + memex.ullTotalPageFile, expect.ullTotalPageFile, (LONG)(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 +3631,7 @@ START_TEST(heap) { int argc; char **argv; + int i;
load_functions();
@@ -3631,13 +3642,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 +3671,5 @@ START_TEST(heap) test_debug_heap( argv[0], 0xdeadbeef ); } else win_skip( "RtlGetNtGlobalFlags not found, skipping heap debug tests\n" ); + } }