2011-05-18 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Wed, 18 May 2011 09:40:00 +0000 (09:40 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:59 +0000 (21:06 +0400)
* 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.

ChangeLog
include/private/gcconfig.h
tests/test.c

index 2bf0456..88fefdc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 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.
+
+2011-05-18  Ivan Maidanski  <ivmai@mail.ru>
+
        * checksums.c (GC_check_blocks, GC_check_dirty): Do log printing
        only if GC_print_stats; print errors using GC_err_printf.
        * checksums.c (GC_check_blocks): Join adjacent printf() calls into
index 9e277e5..9052d22 100644 (file)
   /* #undef GWW_VDB - handled in os_dep.c       */
 #endif
 
+#ifdef PROC_VDB
+  /* Multi-VDB mode is not implemented. */
+# undef MPROTECT_VDB
+#endif
+
 #if !defined(PCR_VDB) && !defined(PROC_VDB) && !defined(MPROTECT_VDB) \
     && !defined(GWW_VDB) && !defined(GC_DISABLE_INCREMENTAL)
 # define DEFAULT_VDB
index 63a1052..b844b63 100644 (file)
@@ -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