[PATCH] D18409: [tsan] Fix fork() and fork-based tests for OS X

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 24 04:59:43 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL264261: [tsan] Fix fork() and fork-based tests for OS X (authored by kuba.brecka).

Changed prior to commit:
  http://reviews.llvm.org/D18409?vs=51450&id=51539#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18409

Files:
  compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
  compiler-rt/trunk/test/tsan/fork_atexit.cc
  compiler-rt/trunk/test/tsan/fork_deadlock.cc
  compiler-rt/trunk/test/tsan/fork_multithreaded.cc
  compiler-rt/trunk/test/tsan/fork_multithreaded3.cc
  compiler-rt/trunk/test/tsan/vfork.cc

Index: compiler-rt/trunk/test/tsan/fork_deadlock.cc
===================================================================
--- compiler-rt/trunk/test/tsan/fork_deadlock.cc
+++ compiler-rt/trunk/test/tsan/fork_deadlock.cc
@@ -1,5 +1,4 @@
 // RUN: %clangxx_tsan -O1 %s -o %t && %env_tsan_opts=atexit_sleep_ms=50 %run %t 2>&1 | FileCheck %s
-// UNSUPPORTED: darwin
 #include "test.h"
 #include <errno.h>
 #include <sys/types.h>
Index: compiler-rt/trunk/test/tsan/fork_multithreaded.cc
===================================================================
--- compiler-rt/trunk/test/tsan/fork_multithreaded.cc
+++ compiler-rt/trunk/test/tsan/fork_multithreaded.cc
@@ -1,6 +1,5 @@
 // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s -check-prefix=CHECK-DIE
 // RUN: %clangxx_tsan -O1 %s -o %t && %env_tsan_opts=die_after_fork=0 %run %t 2>&1 | FileCheck %s -check-prefix=CHECK-NODIE
-// UNSUPPORTED: darwin
 #include "test.h"
 #include <errno.h>
 #include <sys/types.h>
Index: compiler-rt/trunk/test/tsan/fork_multithreaded3.cc
===================================================================
--- compiler-rt/trunk/test/tsan/fork_multithreaded3.cc
+++ compiler-rt/trunk/test/tsan/fork_multithreaded3.cc
@@ -1,5 +1,4 @@
 // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
-// UNSUPPORTED: darwin
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
Index: compiler-rt/trunk/test/tsan/fork_atexit.cc
===================================================================
--- compiler-rt/trunk/test/tsan/fork_atexit.cc
+++ compiler-rt/trunk/test/tsan/fork_atexit.cc
@@ -1,5 +1,4 @@
 // RUN: %clangxx_tsan -O1 %s -o %t && %env_tsan_opts=atexit_sleep_ms=50 %run %t 2>&1 | FileCheck %s
-// UNSUPPORTED: darwin
 #include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
Index: compiler-rt/trunk/test/tsan/vfork.cc
===================================================================
--- compiler-rt/trunk/test/tsan/vfork.cc
+++ compiler-rt/trunk/test/tsan/vfork.cc
@@ -1,5 +1,4 @@
 // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
-// UNSUPPORTED: darwin
 #include <pthread.h>
 #include <stdio.h>
 #include <stdlib.h>
Index: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
===================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
@@ -2168,7 +2168,13 @@
     return REAL(fork)(fake);
   SCOPED_INTERCEPTOR_RAW(fork, fake);
   ForkBefore(thr, pc);
-  int pid = REAL(fork)(fake);
+  int pid;
+  {
+    // On OS X, REAL(fork) can call intercepted functions (OSSpinLockLock), and
+    // we'll assert in CheckNoLocks() unless we ignore interceptors.
+    ScopedIgnoreInterceptors ignore;
+    pid = REAL(fork)(fake);
+  }
   if (pid == 0) {
     // child
     ForkChildAfter(thr, pc);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18409.51539.patch
Type: text/x-patch
Size: 2847 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160324/3abc7fd3/attachment.bin>


More information about the llvm-commits mailing list