diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2013-03-21 16:55:17 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2013-03-21 16:55:17 +0000 |
commit | ebf63d0095ab60ea940e934c9cc0f62c5abd06b5 (patch) | |
tree | d5ff091b758840b736134aa4c9f612998f86e022 /compiler-rt/lib/tsan/lit_tests | |
parent | c4ca6e271c4a5b43ba8519119c72e4f6d7245aa9 (diff) | |
download | bcm5719-llvm-ebf63d0095ab60ea940e934c9cc0f62c5abd06b5.tar.gz bcm5719-llvm-ebf63d0095ab60ea940e934c9cc0f62c5abd06b5.zip |
tsan: better reporting of thread leaks
1. do not report running threads as leaks
2. aggregate leaked threads by creation stack
llvm-svn: 177647
Diffstat (limited to 'compiler-rt/lib/tsan/lit_tests')
-rw-r--r-- | compiler-rt/lib/tsan/lit_tests/thread_leak3.c | 2 | ||||
-rw-r--r-- | compiler-rt/lib/tsan/lit_tests/thread_leak4.c | 16 | ||||
-rw-r--r-- | compiler-rt/lib/tsan/lit_tests/thread_leak5.c | 19 |
3 files changed, 37 insertions, 0 deletions
diff --git a/compiler-rt/lib/tsan/lit_tests/thread_leak3.c b/compiler-rt/lib/tsan/lit_tests/thread_leak3.c index a39c93c5a5f..3577164cad4 100644 --- a/compiler-rt/lib/tsan/lit_tests/thread_leak3.c +++ b/compiler-rt/lib/tsan/lit_tests/thread_leak3.c @@ -1,5 +1,6 @@ // RUN: %clang_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s #include <pthread.h> +#include <unistd.h> void *Thread(void *x) { return 0; @@ -8,6 +9,7 @@ void *Thread(void *x) { int main() { pthread_t t; pthread_create(&t, 0, Thread, 0); + sleep(1); return 0; } diff --git a/compiler-rt/lib/tsan/lit_tests/thread_leak4.c b/compiler-rt/lib/tsan/lit_tests/thread_leak4.c new file mode 100644 index 00000000000..3909c0a8d4a --- /dev/null +++ b/compiler-rt/lib/tsan/lit_tests/thread_leak4.c @@ -0,0 +1,16 @@ +// RUN: %clang_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s +#include <pthread.h> +#include <unistd.h> + +void *Thread(void *x) { + sleep(10); + return 0; +} + +int main() { + pthread_t t; + pthread_create(&t, 0, Thread, 0); + return 0; +} + +// CHECK-NOT: WARNING: ThreadSanitizer: thread leak diff --git a/compiler-rt/lib/tsan/lit_tests/thread_leak5.c b/compiler-rt/lib/tsan/lit_tests/thread_leak5.c new file mode 100644 index 00000000000..fc72b149ec2 --- /dev/null +++ b/compiler-rt/lib/tsan/lit_tests/thread_leak5.c @@ -0,0 +1,19 @@ +// RUN: %clang_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s +#include <pthread.h> +#include <unistd.h> + +void *Thread(void *x) { + return 0; +} + +int main() { + for (int i = 0; i < 5; i++) { + pthread_t t; + pthread_create(&t, 0, Thread, 0); + } + sleep(1); + return 0; +} + +// CHECK: WARNING: ThreadSanitizer: thread leak +// CHECK: And 4 more similar thread leaks |