summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2021-08-06 21:29:49 +0300
committerIvan Maidanski <ivmai@mail.ru>2021-08-06 21:29:49 +0300
commitdd1d0bc645368355cd62bf1a74ac5dcc58f2ed7f (patch)
tree559a3748fd8bd25ccdc15387e8dd4addf2f3ff12
parent7c3694525a2006bf738d132229735a4805bc30f4 (diff)
downloadbdwgc-dd1d0bc645368355cd62bf1a74ac5dcc58f2ed7f.tar.gz
Repeat run_one_test NTHREADS times by gctest if single-threaded
Also, allow to customize BIG value in gctest. * tests/test.c [!NTHREADS] (NTHREADS): Update comment. * tests/test.c (BIG): Do not define if already defined. * tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && NTHREADS>0] (main): Call run_one_test() NTHREADS times additionally.
-rw-r--r--tests/test.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/test.c b/tests/test.c
index 6ba83aec..990147ca 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -42,7 +42,8 @@
#include "gc.h"
#ifndef NTHREADS /* Number of additional threads to fork. */
-# define NTHREADS 5 /* excludes main thread, which also runs a test. */
+# define NTHREADS 5 /* Excludes main thread, which also runs a test. */
+ /* In the single-threaded case, the number of times to rerun it. */
/* Not respected by PCR test. */
#endif
@@ -723,6 +724,7 @@ void *GC_CALLBACK reverse_test_inner(void *data)
return GC_call_with_gc_active(reverse_test_inner, (void*)(word)1);
}
+# ifndef BIG
# if defined(MACOS) \
|| (defined(UNIX_LIKE) && defined(NO_GETCONTEXT)) /* e.g. musl */
/* Assume 128 KB stacks at least. */
@@ -741,6 +743,7 @@ void *GC_CALLBACK reverse_test_inner(void *data)
# else
# define BIG 4500
# endif
+# endif
a_set(ints(1, 49));
b = ints(1, 50);
@@ -1976,6 +1979,13 @@ void GC_CALLBACK warn_proc(char *msg, GC_word p)
set_print_procs();
GC_start_incremental_collection();
run_one_test();
+# if NTHREADS > 0
+ {
+ int i;
+ for (i = 0; i < NTHREADS; i++)
+ run_one_test();
+ }
+# endif
run_single_threaded_test();
check_heap_stats();
# ifndef MSWINCE