summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorivmai <ivmai>2011-05-18 11:40:00 +0200
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:59 +0200
commitca58b8ecc27bf3c617751405b9bbc0ffbd9f0a14 (patch)
treeb1a86dbba6ee6b00b7334ddd55ba0e64c551a079 /tests
parentf59c2f6edec882278860b1fef554671502994293 (diff)
2011-05-18 Ivan Maidanski <ivmai@mail.ru>
* include/private/gcconfig.h (MPROTECT_VDB): Undefine if PROC_VDB. * tests/test.c (NUMBER_ROUND_UP): New macro. * tests/test.c (check_heap_stats): Round up total expected heap size to the nearest 4 MiB bound. * tests/test.c (check_heap_stats): Print the current and expected heap sizes in case of failure.
Diffstat (limited to 'tests')
-rw-r--r--tests/test.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/test.c b/tests/test.c
index 63a1052..b844b63 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -1236,6 +1236,8 @@ void run_one_test(void)
GC_log_printf("Finished %p\n", &start_time);
}
+#define NUMBER_ROUND_UP(v, bound) ((((v) + (bound) - 1) / (bound)) * (bound))
+
void check_heap_stats(void)
{
size_t max_heap_sz;
@@ -1272,6 +1274,10 @@ void check_heap_stats(void)
# endif
# endif
# endif
+ max_heap_sz *= n_tests;
+# ifdef USE_MMAP
+ max_heap_sz = NUMBER_ROUND_UP(max_heap_sz, 4 * 1024 * 1024);
+# endif
/* Garbage collect repeatedly so that all inaccessible objects */
/* can be finalized. */
while (GC_collect_a_little()) { }
@@ -1337,8 +1343,11 @@ void check_heap_stats(void)
GC_printf("Incorrect execution - missed some allocations\n");
FAIL;
}
- if (GC_get_heap_size() + GC_get_unmapped_bytes() > max_heap_sz*n_tests) {
- GC_printf("Unexpected heap growth - collector may be broken\n");
+ if (GC_get_heap_size() + GC_get_unmapped_bytes() > max_heap_sz) {
+ GC_printf("Unexpected heap growth - collector may be broken"
+ " (heapsize: %lu, expected: %u)\n",
+ (unsigned long)(GC_get_heap_size() + GC_get_unmapped_bytes()),
+ max_heap_sz);
FAIL;
}
# ifdef THREADS