[compiler-rt] r265300 - [asan, tsan] Make Darwin-specific tests more stable (use ignore_interceptors_accesses=1 for GCD tests and printf instead of NSLog).

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 07:54:06 PDT 2016


Author: kuba.brecka
Date: Mon Apr  4 09:54:05 2016
New Revision: 265300

URL: http://llvm.org/viewvc/llvm-project?rev=265300&view=rev
Log:
[asan,tsan] Make Darwin-specific tests more stable (use ignore_interceptors_accesses=1 for GCD tests and printf instead of NSLog).


Modified:
    compiler-rt/trunk/test/asan/TestCases/Darwin/objc-odr.mm
    compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-darwin.cc
    compiler-rt/trunk/test/tsan/Darwin/dispatch_main.mm
    compiler-rt/trunk/test/tsan/Darwin/gcd-async-norace.mm
    compiler-rt/trunk/test/tsan/Darwin/gcd-async-race.mm
    compiler-rt/trunk/test/tsan/Darwin/gcd-groups-norace.mm
    compiler-rt/trunk/test/tsan/Darwin/gcd-groups-stress.mm
    compiler-rt/trunk/test/tsan/Darwin/gcd-once.mm
    compiler-rt/trunk/test/tsan/Darwin/gcd-semaphore-norace.mm
    compiler-rt/trunk/test/tsan/Darwin/gcd-serial-queue-norace.mm
    compiler-rt/trunk/test/tsan/Darwin/gcd-sync-norace.mm
    compiler-rt/trunk/test/tsan/Darwin/gcd-sync-race.mm
    compiler-rt/trunk/test/tsan/Darwin/ignored-interceptors.mm

Modified: compiler-rt/trunk/test/asan/TestCases/Darwin/objc-odr.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Darwin/objc-odr.mm?rev=265300&r1=265299&r2=265300&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Darwin/objc-odr.mm (original)
+++ compiler-rt/trunk/test/asan/TestCases/Darwin/objc-odr.mm Mon Apr  4 09:54:05 2016
@@ -16,7 +16,7 @@ void f() {
 }
 
 int main() {
-  NSLog(@"Hello world");
+  fprintf(stderr,"Hello world");
 }
 
 // CHECK-NOT: AddressSanitizer: odr-violation

Modified: compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-darwin.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-darwin.cc?rev=265300&r1=265299&r2=265300&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-darwin.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-darwin.cc Mon Apr  4 09:54:05 2016
@@ -4,6 +4,7 @@
 
 // Check that suppressing the interceptor by name works.
 // RUN: echo "interceptor_name:memmove" > %t.supp
+// RUN: echo "interceptor_name:memcpy" >> %t.supp
 // RUN: %env_asan_opts=suppressions='"%t.supp"' %run %t 2>&1 | FileCheck --check-prefix=CHECK-IGNORE %s
 
 // Check that suppressing by interceptor name works even without the symbolizer

Modified: compiler-rt/trunk/test/tsan/Darwin/dispatch_main.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/dispatch_main.mm?rev=265300&r1=265299&r2=265300&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/dispatch_main.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/dispatch_main.mm Mon Apr  4 09:54:05 2016
@@ -7,23 +7,23 @@
 #import <Foundation/Foundation.h>
 
 int main() {
-  NSLog(@"Hello world");
+  fprintf(stderr,"Hello world");
 
   dispatch_queue_t q = dispatch_queue_create("my.queue", DISPATCH_QUEUE_SERIAL);
 
   dispatch_async(q, ^{
-    NSLog(@"1");
+    fprintf(stderr,"1");
   });
 
   dispatch_async(q, ^{
-    NSLog(@"2");
+    fprintf(stderr,"2");
   });
 
   dispatch_async(q, ^{
-    NSLog(@"3");
+    fprintf(stderr,"3");
 
     dispatch_async(dispatch_get_main_queue(), ^{
-      NSLog(@"Done.");
+      fprintf(stderr,"Done.");
       sleep(1);
       exit(0);
     });

Modified: compiler-rt/trunk/test/tsan/Darwin/gcd-async-norace.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/gcd-async-norace.mm?rev=265300&r1=265299&r2=265300&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/gcd-async-norace.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/gcd-async-norace.mm Mon Apr  4 09:54:05 2016
@@ -1,5 +1,5 @@
 // RUN: %clang_tsan %s -o %t -framework Foundation
-// RUN: %run %t 2>&1
+// RUN: %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1
 
 #import <Foundation/Foundation.h>
 

Modified: compiler-rt/trunk/test/tsan/Darwin/gcd-async-race.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/gcd-async-race.mm?rev=265300&r1=265299&r2=265300&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/gcd-async-race.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/gcd-async-race.mm Mon Apr  4 09:54:05 2016
@@ -1,5 +1,5 @@
 // RUN: %clang_tsan %s -o %t -framework Foundation
-// RUN: %deflake %run %t 2>&1
+// RUN: %env_tsan_opts=ignore_interceptors_accesses=1 %deflake %run %t 2>&1
 
 #import <Foundation/Foundation.h>
 

Modified: compiler-rt/trunk/test/tsan/Darwin/gcd-groups-norace.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/gcd-groups-norace.mm?rev=265300&r1=265299&r2=265300&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/gcd-groups-norace.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/gcd-groups-norace.mm Mon Apr  4 09:54:05 2016
@@ -1,5 +1,5 @@
 // RUN: %clang_tsan %s -o %t -framework Foundation
-// RUN: %run %t 2>&1
+// RUN: %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1
 
 #import <Foundation/Foundation.h>
 

Modified: compiler-rt/trunk/test/tsan/Darwin/gcd-groups-stress.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/gcd-groups-stress.mm?rev=265300&r1=265299&r2=265300&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/gcd-groups-stress.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/gcd-groups-stress.mm Mon Apr  4 09:54:05 2016
@@ -1,5 +1,5 @@
 // RUN: %clang_tsan %s -o %t -framework Foundation
-// RUN: %run %t 2>&1
+// RUN: %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1
 
 #import <Foundation/Foundation.h>
 

Modified: compiler-rt/trunk/test/tsan/Darwin/gcd-once.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/gcd-once.mm?rev=265300&r1=265299&r2=265300&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/gcd-once.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/gcd-once.mm Mon Apr  4 09:54:05 2016
@@ -1,5 +1,5 @@
 // RUN: %clang_tsan %s -o %t -framework Foundation
-// RUN: %run %t 2>&1
+// RUN: %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1
 
 #import <Foundation/Foundation.h>
 

Modified: compiler-rt/trunk/test/tsan/Darwin/gcd-semaphore-norace.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/gcd-semaphore-norace.mm?rev=265300&r1=265299&r2=265300&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/gcd-semaphore-norace.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/gcd-semaphore-norace.mm Mon Apr  4 09:54:05 2016
@@ -1,5 +1,5 @@
 // RUN: %clang_tsan %s -o %t -framework Foundation
-// RUN: %run %t 2>&1
+// RUN: %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1
 
 #import <Foundation/Foundation.h>
 

Modified: compiler-rt/trunk/test/tsan/Darwin/gcd-serial-queue-norace.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/gcd-serial-queue-norace.mm?rev=265300&r1=265299&r2=265300&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/gcd-serial-queue-norace.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/gcd-serial-queue-norace.mm Mon Apr  4 09:54:05 2016
@@ -1,5 +1,5 @@
 // RUN: %clang_tsan %s -o %t -framework Foundation
-// RUN: %run %t 2>&1
+// RUN: %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1
 
 #import <Foundation/Foundation.h>
 

Modified: compiler-rt/trunk/test/tsan/Darwin/gcd-sync-norace.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/gcd-sync-norace.mm?rev=265300&r1=265299&r2=265300&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/gcd-sync-norace.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/gcd-sync-norace.mm Mon Apr  4 09:54:05 2016
@@ -1,5 +1,5 @@
 // RUN: %clang_tsan %s -o %t -framework Foundation
-// RUN: %run %t 2>&1
+// RUN: %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1
 
 #import <Foundation/Foundation.h>
 

Modified: compiler-rt/trunk/test/tsan/Darwin/gcd-sync-race.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/gcd-sync-race.mm?rev=265300&r1=265299&r2=265300&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/gcd-sync-race.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/gcd-sync-race.mm Mon Apr  4 09:54:05 2016
@@ -1,5 +1,5 @@
 // RUN: %clang_tsan %s -o %t -framework Foundation
-// RUN: %deflake %run %t 2>&1
+// RUN: %env_tsan_opts=ignore_interceptors_accesses=1 %deflake %run %t 2>&1
 
 #import <Foundation/Foundation.h>
 

Modified: compiler-rt/trunk/test/tsan/Darwin/ignored-interceptors.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/ignored-interceptors.mm?rev=265300&r1=265299&r2=265300&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/ignored-interceptors.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/ignored-interceptors.mm Mon Apr  4 09:54:05 2016
@@ -33,11 +33,10 @@ void *Thread2(void *x) {
 }
 
 int main(int argc, char *argv[]) {
-  NSLog(@"Hello world.");
+  fprintf(stderr, "Hello world.\n");
   
   // NSUserDefaults uses XPC which triggers the false positive.
   NSDictionary *d = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
-  NSLog(@"d = %@", d);
 
   if (argc > 1 && strcmp(argv[1], "race") == 0) {
     barrier_init(&barrier, 2);
@@ -48,7 +47,7 @@ int main(int argc, char *argv[]) {
     pthread_join(t[1], NULL);
   }
 
-  NSLog(@"Done.");
+  fprintf(stderr, "Done.\n");
 }
 
 // CHECK: Hello world.




More information about the llvm-commits mailing list