aboutsummaryrefslogtreecommitdiff
path: root/test/tsan/Darwin
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-07-13 19:25:48 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-07-13 19:25:48 +0000
commit1992b790c2c12b7850bdf86662b67302052ec2fe (patch)
tree623c69b5fbf527bba17ecb9431ae5189871cecd4 /test/tsan/Darwin
parent50aa32eff79f252ab05a0c0a589cf2ca37cd9923 (diff)
downloadsrc-1992b790c2c12b7850bdf86662b67302052ec2fe.tar.gz
src-1992b790c2c12b7850bdf86662b67302052ec2fe.zip
Vendor import of compiler-rt trunk r307894:vendor/compiler-rt/compiler-rt-trunk-r307894
Notes
Notes: svn path=/vendor/compiler-rt/dist/; revision=320961 svn path=/vendor/compiler-rt/compiler-rt-trunk-r307894/; revision=320962; tag=vendor/compiler-rt/compiler-rt-trunk-r307894
Diffstat (limited to 'test/tsan/Darwin')
-rw-r--r--test/tsan/Darwin/dlopen.cc2
-rw-r--r--test/tsan/Darwin/ignore-noninstrumented.mm2
-rw-r--r--test/tsan/Darwin/ignored-interceptors.mm2
-rw-r--r--test/tsan/Darwin/osspinlock-norace.cc6
-rw-r--r--test/tsan/Darwin/signals-blocked.cc75
-rw-r--r--test/tsan/Darwin/xpc-cancel.mm2
-rw-r--r--test/tsan/Darwin/xpc-race.mm2
-rw-r--r--test/tsan/Darwin/xpc.mm2
8 files changed, 87 insertions, 6 deletions
diff --git a/test/tsan/Darwin/dlopen.cc b/test/tsan/Darwin/dlopen.cc
index 7382a6de28c5..3d12b815f9c2 100644
--- a/test/tsan/Darwin/dlopen.cc
+++ b/test/tsan/Darwin/dlopen.cc
@@ -4,6 +4,8 @@
// REQUIRES: osx-autointerception
+// XFAIL: ios
+
// RUN: %clangxx_tsan %s -o %t.so -shared -DSHARED_LIB
// RUN: %clangxx_tsan -fno-sanitize=thread %s -o %t
diff --git a/test/tsan/Darwin/ignore-noninstrumented.mm b/test/tsan/Darwin/ignore-noninstrumented.mm
index 528e07b9a721..668a76a462ce 100644
--- a/test/tsan/Darwin/ignore-noninstrumented.mm
+++ b/test/tsan/Darwin/ignore-noninstrumented.mm
@@ -1,4 +1,4 @@
-// Check that ignore_noninstrumented_modules=1 supresses races from system libraries on OS X.
+// Check that ignore_noninstrumented_modules=1 suppresses races from system libraries on OS X.
// RUN: %clang_tsan %s -o %t -framework Foundation
diff --git a/test/tsan/Darwin/ignored-interceptors.mm b/test/tsan/Darwin/ignored-interceptors.mm
index 1105132a3cb6..b2e40f07d574 100644
--- a/test/tsan/Darwin/ignored-interceptors.mm
+++ b/test/tsan/Darwin/ignored-interceptors.mm
@@ -1,4 +1,4 @@
-// Check that ignore_interceptors_accesses=1 supresses reporting races from
+// Check that ignore_interceptors_accesses=1 suppresses reporting races from
// system libraries on OS X. There are currently false positives coming from
// libxpc, libdispatch, CoreFoundation and others, because these libraries use
// TSan-invisible atomics as synchronization.
diff --git a/test/tsan/Darwin/osspinlock-norace.cc b/test/tsan/Darwin/osspinlock-norace.cc
index 2ac3989c223e..5de02c225f0b 100644
--- a/test/tsan/Darwin/osspinlock-norace.cc
+++ b/test/tsan/Darwin/osspinlock-norace.cc
@@ -1,8 +1,12 @@
// RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
-#include <libkern/OSAtomic.h>
#include <pthread.h>
+#include <stdint.h>
#include <stdio.h>
+typedef int32_t OSSpinLock;
+extern "C" void OSSpinLockLock(OSSpinLock *);
+extern "C" void OSSpinLockUnlock(OSSpinLock *);
+
int Global;
OSSpinLock lock;
diff --git a/test/tsan/Darwin/signals-blocked.cc b/test/tsan/Darwin/signals-blocked.cc
new file mode 100644
index 000000000000..209dc2229ff6
--- /dev/null
+++ b/test/tsan/Darwin/signals-blocked.cc
@@ -0,0 +1,75 @@
+// RUN: %clangxx_tsan %s -o %t && %run %t 2>&1 | FileCheck %s
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <errno.h>
+
+volatile bool signal_delivered;
+
+static void handler(int sig) {
+ if (sig == SIGALRM)
+ signal_delivered = true;
+}
+
+static void* thr(void *p) {
+ sigset_t sigset;
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGALRM);
+ int ret = pthread_sigmask(SIG_UNBLOCK, &sigset, NULL);
+ if (ret) abort();
+
+ struct sigaction act = {};
+ act.sa_handler = &handler;
+ if (sigaction(SIGALRM, &act, 0)) {
+ perror("sigaction");
+ exit(1);
+ }
+
+ itimerval t;
+ t.it_value.tv_sec = 0;
+ t.it_value.tv_usec = 10000;
+ t.it_interval = t.it_value;
+ if (setitimer(ITIMER_REAL, &t, 0)) {
+ perror("setitimer");
+ exit(1);
+ }
+
+ while (!signal_delivered) {
+ usleep(1000);
+ }
+
+ t.it_value.tv_usec = 0;
+ if (setitimer(ITIMER_REAL, &t, 0)) {
+ perror("setitimer");
+ exit(1);
+ }
+
+ fprintf(stderr, "SIGNAL DELIVERED\n");
+
+ return 0;
+}
+
+int main() {
+ sigset_t sigset;
+ sigemptyset(&sigset);
+ sigaddset(&sigset, SIGALRM);
+ int ret = pthread_sigmask(SIG_BLOCK, &sigset, NULL);
+ if (ret) abort();
+
+ pthread_t th;
+ pthread_create(&th, 0, thr, 0);
+ pthread_join(th, 0);
+
+ fprintf(stderr, "DONE\n");
+ return 0;
+}
+
+// CHECK-NOT: WARNING: ThreadSanitizer:
+// CHECK: SIGNAL DELIVERED
+// CHECK: DONE
+// CHECK-NOT: WARNING: ThreadSanitizer:
diff --git a/test/tsan/Darwin/xpc-cancel.mm b/test/tsan/Darwin/xpc-cancel.mm
index 91dafc3eadda..ac7aed08c16c 100644
--- a/test/tsan/Darwin/xpc-cancel.mm
+++ b/test/tsan/Darwin/xpc-cancel.mm
@@ -1,7 +1,7 @@
// RUN: %clang_tsan %s -o %t -framework Foundation
// RUN: %run %t 2>&1 | FileCheck %s
-// XFAIL: ios
+// UNSUPPORTED: ios
#import <Foundation/Foundation.h>
#import <xpc/xpc.h>
diff --git a/test/tsan/Darwin/xpc-race.mm b/test/tsan/Darwin/xpc-race.mm
index 2e965e4a0a1c..a1e214c12b7d 100644
--- a/test/tsan/Darwin/xpc-race.mm
+++ b/test/tsan/Darwin/xpc-race.mm
@@ -1,7 +1,7 @@
// RUN: %clang_tsan %s -o %t -framework Foundation
// RUN: %deflake %run %t 2>&1 | FileCheck %s
-// XFAIL: ios
+// UNSUPPORTED: ios
#import <Foundation/Foundation.h>
#import <xpc/xpc.h>
diff --git a/test/tsan/Darwin/xpc.mm b/test/tsan/Darwin/xpc.mm
index c5e78a5779e0..036841ed7121 100644
--- a/test/tsan/Darwin/xpc.mm
+++ b/test/tsan/Darwin/xpc.mm
@@ -1,7 +1,7 @@
// RUN: %clang_tsan %s -o %t -framework Foundation
// RUN: %run %t 2>&1 | FileCheck %s
-// XFAIL: ios
+// UNSUPPORTED: ios
#import <Foundation/Foundation.h>
#import <xpc/xpc.h>