diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2013-08-13 15:33:00 +0000 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2013-08-13 15:33:00 +0000 |
| commit | 97f0eae0a5adfd9f72b32184c2cb9d3e51237f06 (patch) | |
| tree | 59d4086500ae1702938b1c4b28d94518f3f948b4 /compiler-rt/lib/tsan/lit_tests | |
| parent | 7757073c21e40e2735b23a7b097f3246d6071e3c (diff) | |
| download | bcm5719-llvm-97f0eae0a5adfd9f72b32184c2cb9d3e51237f06.tar.gz bcm5719-llvm-97f0eae0a5adfd9f72b32184c2cb9d3e51237f06.zip | |
tsan/msan: add halt_on_error flag
If halt_on_error==true, program terminates after reporting first error.
llvm-svn: 188279
Diffstat (limited to 'compiler-rt/lib/tsan/lit_tests')
| -rw-r--r-- | compiler-rt/lib/tsan/lit_tests/halt_on_error.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/compiler-rt/lib/tsan/lit_tests/halt_on_error.cc b/compiler-rt/lib/tsan/lit_tests/halt_on_error.cc new file mode 100644 index 00000000000..fddaffff29a --- /dev/null +++ b/compiler-rt/lib/tsan/lit_tests/halt_on_error.cc @@ -0,0 +1,25 @@ +// RUN: %clang_tsan -O1 %s -o %t && TSAN_OPTIONS="$TSAN_OPTIONS halt_on_error=1" not %t 2>&1 | FileCheck %s +#include <pthread.h> +#include <stdio.h> + +int X; + +void *Thread(void *x) { + X = 42; + return 0; +} + +int main() { + fprintf(stderr, "BEFORE\n"); + pthread_t t; + pthread_create(&t, 0, Thread, 0); + X = 43; + pthread_join(t, 0); + fprintf(stderr, "AFTER\n"); + return 0; +} + +// CHECK: BEFORE +// CHECK: WARNING: ThreadSanitizer: data race +// CHECK-NOT: AFTER + |

