KERNEL/tests: respect 9x-ness of HeapAlloc
Saulius Krasuckas
saulius2 at ar.fi.lt
Mon Nov 7 12:43:43 CST 2005
Log message:
Saulius Krasuckas <saulius.krasuckas at ieee.org>
Take into account some alignment done by HeapAlloc() on Win9x.
Index: dlls/kernel/tests/heap.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/heap.c,v
retrieving revision 1.6
diff -p -u -r1.6 heap.c
--- dlls/kernel/tests/heap.c 11 Jul 2005 13:20:40 -0000 1.6
+++ dlls/kernel/tests/heap.c 7 Nov 2005 17:47:13 -0000
@@ -25,6 +25,19 @@
#include "winbase.h"
#include "wine/test.h"
+static SIZE_T resize_9x(SIZE_T size)
+{
+ DWORD dwSizeAligned;
+ DWORD dwPageSizeKiB;
+ SYSTEM_INFO si;
+
+ GetSystemInfo(&si);
+ dwPageSizeKiB = si.dwPageSize / 1024; /* 4 KiB */
+ dwSizeAligned = ((size - 1)/dwPageSizeKiB + 1) * dwPageSizeKiB;
+
+ return max(dwSizeAligned, 3*dwPageSizeKiB); /* at least 12 KiB */
+}
+
START_TEST(heap)
{
void *mem;
@@ -43,7 +56,8 @@ START_TEST(heap)
SIZE_T heap_size;
mem = HeapAlloc(GetProcessHeap(), 0, size);
heap_size = HeapSize(GetProcessHeap(), 0, mem);
- ok(size == heap_size, "HeapSize returned %lu instead of %lu\n", heap_size, size);
+ ok(heap_size == size || heap_size == resize_9x(size),
+ "HeapSize returned %lu instead of %lu or %lu\n", heap_size, size, resize_9x(size));
HeapFree(GetProcessHeap(), 0, mem);
}
More information about the wine-patches
mailing list