[PATCH] D14610: [tsan] Add a Darwin-specific lit test directory

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 04:36:28 PST 2015


kubabrecka created this revision.
kubabrecka added reviewers: dvyukov, kcc, glider, samsonov.
kubabrecka added subscribers: llvm-commits, zaks.anna, ismailp.

To test Darwin-specific changes and bugs, this patch creates a test/Darwin/ directory, allows '.mm' file extension for tests and adds a simple test that verifies that an Obj-C program can run and quit successfully.


http://reviews.llvm.org/D14610

Files:
  test/tsan/Darwin/lit.local.cfg
  test/tsan/Darwin/objc_bootstrap.mm
  test/tsan/lit.cfg

Index: test/tsan/lit.cfg
===================================================================
--- test/tsan/lit.cfg
+++ test/tsan/lit.cfg
@@ -64,7 +64,7 @@
 config.substitutions.append( ("%deflake ", os.path.join(os.path.dirname(__file__), "deflake.bash")) )
 
 # Default test suffixes.
-config.suffixes = ['.c', '.cc', '.cpp']
+config.suffixes = ['.c', '.cc', '.cpp', '.mm']
 
 # ThreadSanitizer tests are currently supported on FreeBSD, Linux and Darwin.
 if config.host_os not in ['FreeBSD', 'Linux', 'Darwin']:
Index: test/tsan/Darwin/objc_bootstrap.mm
===================================================================
--- test/tsan/Darwin/objc_bootstrap.mm
+++ test/tsan/Darwin/objc_bootstrap.mm
@@ -0,0 +1,13 @@
+// Test that a simple Obj-C program runs and exits without any warnings.
+
+// RUN: %clang_tsan %s -o %t -framework Foundation
+// RUN: %run %t 2>&1
+
+#import <Foundation/Foundation.h>
+
+int main() {
+  NSLog(@"Hello world");
+}
+
+// CHECK: Hello world
+// CHECK-NOT: WARNING: ThreadSanitizer
Index: test/tsan/Darwin/lit.local.cfg
===================================================================
--- test/tsan/Darwin/lit.local.cfg
+++ test/tsan/Darwin/lit.local.cfg
@@ -0,0 +1,9 @@
+def getRoot(config):
+  if not config.parent:
+    return config
+  return getRoot(config.parent)
+
+root = getRoot(config)
+
+if root.host_os not in ['Darwin']:
+  config.unsupported = True


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14610.40030.patch
Type: text/x-patch
Size: 1400 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151112/e28bf7a9/attachment.bin>


More information about the llvm-commits mailing list