summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-11-08 09:29:16 -0500
committerBen Gamari <ben@smart-cactus.org>2020-11-08 09:29:16 -0500
commit638f38c50e80a19275f3a06535a0dd8130a17a53 (patch)
treeac18855cd2f39544e4841866fbabb3f86a4d1f35 /testsuite
parentb1d2c1f3246b3740589a59bdf7648c13de47c32b (diff)
parent07e82ba52228580cfbd90ff031e657acbecc715b (diff)
downloadhaskell-638f38c50e80a19275f3a06535a0dd8130a17a53.tar.gz
Merge remote-tracking branch 'origin/wip/tsan/all'
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/driver/testglobals.py3
-rw-r--r--testsuite/driver/testlib.py7
-rw-r--r--testsuite/tests/concurrent/should_run/all.T1
-rw-r--r--testsuite/tests/concurrent/should_run/hs_try_putmvar001_c.c1
-rw-r--r--testsuite/tests/concurrent/should_run/hs_try_putmvar003_c.c5
-rw-r--r--testsuite/tests/dynlibs/all.T12
-rw-r--r--testsuite/tests/hiefile/should_compile/all.T1
-rw-r--r--testsuite/tests/perf/compiler/all.T9
-rw-r--r--testsuite/tests/rts/all.T4
9 files changed, 35 insertions, 8 deletions
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index 71a81bf509..ed34ce9ff0 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -151,6 +151,9 @@ class TestConfig:
# Is the compiler dynamically linked?
self.ghc_dynamic = False
+ # Are we running in a ThreadSanitizer-instrumented build?
+ self.have_thread_sanitizer = False
+
# Do symbols use leading underscores?
self.leading_underscore = False
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 348c198d56..8ef5a8450c 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -591,6 +591,9 @@ def have_slow_bignum( ) -> bool:
def llvm_build ( ) -> bool:
return config.ghc_built_by_llvm
+def have_thread_sanitizer( ) -> bool:
+ return config.have_thread_sanitizer
+
# ---
# Note [Measuring residency]
@@ -642,6 +645,10 @@ def collect_compiler_residency(tolerance_pct: float):
def high_memory_usage(name, opts):
opts.alone = True
+ # ThreadSanitizer significantly increases memory footprint; skip
+ if have_thread_sanitizer():
+ opts.skip = True
+
# If a test is for a multi-CPU race, then running the test alone
# increases the chance that we'll actually see it.
def multi_cpu_race(name, opts):
diff --git a/testsuite/tests/concurrent/should_run/all.T b/testsuite/tests/concurrent/should_run/all.T
index 9297c5890e..2b8375e61e 100644
--- a/testsuite/tests/concurrent/should_run/all.T
+++ b/testsuite/tests/concurrent/should_run/all.T
@@ -245,6 +245,7 @@ test('conc068', [ omit_ways(concurrent_ways), exit_code(1) ], compile_and_run, [
test('setnumcapabilities001',
[ only_ways(['threaded1','threaded2', 'nonmoving_thr']),
extra_run_opts('8 12 2000'),
+ when(have_thread_sanitizer(), expect_broken(18808)),
req_smp ],
compile_and_run, [''])
diff --git a/testsuite/tests/concurrent/should_run/hs_try_putmvar001_c.c b/testsuite/tests/concurrent/should_run/hs_try_putmvar001_c.c
index f214c5c4d0..583c23c2c6 100644
--- a/testsuite/tests/concurrent/should_run/hs_try_putmvar001_c.c
+++ b/testsuite/tests/concurrent/should_run/hs_try_putmvar001_c.c
@@ -28,4 +28,5 @@ void scheduleCallback(HsStablePtr mvar, HsInt cap, int *presult)
p->cap = cap;
p->presult = presult;
pthread_create(&t, NULL, callback, p);
+ pthread_detach(t);
}
diff --git a/testsuite/tests/concurrent/should_run/hs_try_putmvar003_c.c b/testsuite/tests/concurrent/should_run/hs_try_putmvar003_c.c
index d67ca43218..d3bf142455 100644
--- a/testsuite/tests/concurrent/should_run/hs_try_putmvar003_c.c
+++ b/testsuite/tests/concurrent/should_run/hs_try_putmvar003_c.c
@@ -6,6 +6,7 @@
#include "hs_try_putmvar003_stub.h"
struct callback_queue {
+ pthread_t thread;
pthread_mutex_t lock;
pthread_cond_t cond;
int use_foreign_export;
@@ -54,18 +55,18 @@ typedef void* threadfunc(void *);
struct callback_queue* mkCallbackQueue(int use_foreign_export, int n_requests)
{
struct callback_queue *q = malloc(sizeof(struct callback_queue));
- pthread_t t;
pthread_mutex_init(&q->lock, NULL);
pthread_cond_init(&q->cond, NULL);
q->pending = NULL;
q->use_foreign_export = use_foreign_export;
q->n_requests = n_requests;
- pthread_create(&t, NULL, (threadfunc*)callback, q);
+ pthread_create(&q->thread, NULL, (threadfunc*)callback, q);
return q;
}
void destroyCallbackQueue(struct callback_queue *q)
{
+ pthread_join(q->thread, NULL);
pthread_mutex_destroy(&q->lock);
pthread_cond_destroy(&q->cond);
free(q);
diff --git a/testsuite/tests/dynlibs/all.T b/testsuite/tests/dynlibs/all.T
index b7272d4bac..092c983389 100644
--- a/testsuite/tests/dynlibs/all.T
+++ b/testsuite/tests/dynlibs/all.T
@@ -1,12 +1,18 @@
-
-test('T3807', [req_shared_libs, when(opsys('mingw32'), skip)], makefile_test, [])
+test('T3807',
+ [req_shared_libs,
+ when(have_thread_sanitizer(), expect_broken(18883)),
+ when(opsys('mingw32'),
+ skip)], makefile_test, [])
test('T4464', [req_shared_libs, unless(opsys('mingw32'), skip)], makefile_test, [])
test('T5373', [req_shared_libs], makefile_test, [])
# It's not clear exactly what platforms we can expect this to succeed on.
-test('T13702', unless(opsys('linux'), skip), makefile_test, [])
+test('T13702',
+ [when(have_thread_sanitizer(), expect_broken(18884)),
+ unless(opsys('linux'), skip)],
+ makefile_test, [])
# test that -shared and -flink-rts actually links the rts
test('T18072', [req_shared_libs, unless(opsys('linux'), skip)], makefile_test, [])
diff --git a/testsuite/tests/hiefile/should_compile/all.T b/testsuite/tests/hiefile/should_compile/all.T
index a98a042ca0..489cff28d0 100644
--- a/testsuite/tests/hiefile/should_compile/all.T
+++ b/testsuite/tests/hiefile/should_compile/all.T
@@ -4,6 +4,7 @@ test('hie002',
when(wordsize(32), skip),
# No linting in perf tests:
no_lint,
+ high_memory_usage,
collect_compiler_stats('bytes allocated',10)],
compile,
['-fno-code -fwrite-ide-info'])
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index 04e8f14b3a..a0440ca173 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -132,20 +132,23 @@ test('T9675',
test('T9872a',
[ only_ways(['normal']),
- collect_compiler_stats('bytes allocated', 1)
+ collect_compiler_stats('bytes allocated', 1),
+ high_memory_usage
],
compile_fail,
[''])
test('T9872b',
[ only_ways(['normal']),
- collect_compiler_stats('bytes allocated', 1)
+ collect_compiler_stats('bytes allocated', 1),
+ high_memory_usage
],
compile_fail,
[''])
test('T9872c',
[ only_ways(['normal']),
- collect_compiler_stats('bytes allocated', 1)
+ collect_compiler_stats('bytes allocated', 1),
+ high_memory_usage
],
compile_fail,
[''])
diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T
index e469783e80..62c893cde1 100644
--- a/testsuite/tests/rts/all.T
+++ b/testsuite/tests/rts/all.T
@@ -38,6 +38,8 @@ test('derefnull',
when(platform('i386-apple-darwin'), [ignore_stderr, exit_code(139)]),
when(platform('x86_64-apple-darwin'), [ignore_stderr, exit_code(139)]),
when(opsys('mingw32'), [ignore_stderr, exit_code(11)]),
+ # ThreadSanitizer changes the output
+ when(have_thread_sanitizer(), skip),
# since these test are supposed to crash the
# profile report will be empty always.
# so disable the check for profiling
@@ -64,6 +66,8 @@ test('divbyzero',
# The output under OS X is too unstable to readily compare
when(platform('i386-apple-darwin'), [ignore_stderr, exit_code(136)]),
when(platform('x86_64-apple-darwin'), [ignore_stderr, exit_code(136)]),
+ # ThreadSanitizer changes the output
+ when(have_thread_sanitizer(), skip),
# since these test are supposed to crash the
# profile report will be empty always.
# so disable the check for profiling