Combine helper file into main test file with ifdefs
authorReid Kleckner <rnk@google.com>
Wed, 12 Aug 2015 23:24:41 +0000 (23:24 +0000)
committerReid Kleckner <rnk@google.com>
Wed, 12 Aug 2015 23:24:41 +0000 (23:24 +0000)
Keeping tests isolated to a single file is nice, and it was suggested in
post-commit review for r244827.

llvm-svn: 244833

compiler-rt/test/asan/TestCases/Helpers/init-order-pthread-create-extra.cc [deleted file]
compiler-rt/test/asan/TestCases/Posix/init-order-pthread-create.cc

diff --git a/compiler-rt/test/asan/TestCases/Helpers/init-order-pthread-create-extra.cc b/compiler-rt/test/asan/TestCases/Helpers/init-order-pthread-create-extra.cc
deleted file mode 100644 (file)
index 54f26f1..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-void *bar(void *input, bool sleep_before_init);
-void *glob2 = bar((void*)0x2345, true);
index d8c8344..1850432 100644 (file)
@@ -1,9 +1,13 @@
 // Check that init-order checking is properly disabled if pthread_create is
 // called.
 
-// RUN: %clangxx_asan %s %p/../Helpers/init-order-pthread-create-extra.cc -pthread -o %t
+// RUN: %clangxx_asan -c -DCONFIG1 %s -o %t1.o
+// RUN: %clangxx_asan -c           %s -o %t2.o
+// RUN: %clangxx_asan -pthread %t1.o %t2.o -o %t
 // RUN: env ASAN_OPTIONS=$ASAN_OPTIONS:strict_init_order=true %run %t
 
+#ifdef CONFIG1
+
 #include <stdio.h>
 #include <pthread.h>
 #include <unistd.h>
@@ -41,3 +45,10 @@ int main() {
   printf("%p %p\n", glob, glob2);
   return 0;
 }
+
+#else // CONFIG1
+
+void *bar(void *input, bool sleep_before_init);
+void *glob2 = bar((void*)0x2345, true);
+
+#endif