aboutsummaryrefslogtreecommitdiff
path: root/lib/lsan/lit_tests/TestCases/cleanup_in_tsd_destructor.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lsan/lit_tests/TestCases/cleanup_in_tsd_destructor.cc')
-rw-r--r--lib/lsan/lit_tests/TestCases/cleanup_in_tsd_destructor.cc45
1 files changed, 0 insertions, 45 deletions
diff --git a/lib/lsan/lit_tests/TestCases/cleanup_in_tsd_destructor.cc b/lib/lsan/lit_tests/TestCases/cleanup_in_tsd_destructor.cc
deleted file mode 100644
index ab368245317c..000000000000
--- a/lib/lsan/lit_tests/TestCases/cleanup_in_tsd_destructor.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-// Regression test for thread lifetime tracking. Thread data should be
-// considered live during the thread's termination, at least until the
-// user-installed TSD destructors have finished running (since they may contain
-// additional cleanup tasks). LSan doesn't actually meet that goal 100%, but it
-// makes its best effort.
-// RUN: LSAN_BASE="report_objects=1:use_registers=0:use_stacks=0:use_globals=0"
-// RUN: %clangxx_lsan %s -o %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:use_tls=1 %t
-// RUN: LSAN_OPTIONS=$LSAN_BASE:use_tls=0 not %t 2>&1 | FileCheck %s
-
-#include <assert.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "sanitizer/lsan_interface.h"
-
-pthread_key_t key;
-__thread void *p;
-
-void key_destructor(void *arg) {
- // Generally this may happen on a different thread.
- __lsan_do_leak_check();
-}
-
-void *thread_func(void *arg) {
- p = malloc(1337);
- fprintf(stderr, "Test alloc: %p.\n", p);
- int res = pthread_setspecific(key, (void*)1);
- assert(res == 0);
- return 0;
-}
-
-int main() {
- int res = pthread_key_create(&key, &key_destructor);
- assert(res == 0);
- pthread_t thread_id;
- res = pthread_create(&thread_id, 0, thread_func, 0);
- assert(res == 0);
- res = pthread_join(thread_id, 0);
- assert(res == 0);
- return 0;
-}
-// CHECK: Test alloc: [[ADDR:.*]].
-// CHECK: leaked 1337 byte object at [[ADDR]]