summaryrefslogtreecommitdiff
path: root/test/tsan/suppressions_mutex.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/tsan/suppressions_mutex.cc')
-rw-r--r--test/tsan/suppressions_mutex.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/tsan/suppressions_mutex.cc b/test/tsan/suppressions_mutex.cc
new file mode 100644
index 000000000000..5d3a5d05289f
--- /dev/null
+++ b/test/tsan/suppressions_mutex.cc
@@ -0,0 +1,19 @@
+// RUN: %clang_tsan -O1 %s -o %t && %env_tsan_opts=suppressions='%s.supp' %run %t 2>&1 | FileCheck %s
+#include "test.h"
+
+void __attribute__((noinline)) suppress_this(pthread_mutex_t *mu) {
+ pthread_mutex_destroy(mu);
+}
+
+int main() {
+ pthread_mutex_t mu;
+ pthread_mutex_init(&mu, 0);
+ pthread_mutex_lock(&mu);
+ suppress_this(&mu);
+ fprintf(stderr, "DONE\n");
+ return 0;
+}
+
+// CHECK-NOT: failed to open suppressions file
+// CHECK-NOT: WARNING: ThreadSanitizer:
+// CHECK: DONE