summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Bruening <bruening@google.com>2016-05-24 23:03:52 +0000
committerDerek Bruening <bruening@google.com>2016-05-24 23:03:52 +0000
commit515c15c2073c62caa1ff8ea8de072a3cf6db590c (patch)
tree2f7d7574c6461f2e55c423e49b79d8aac7f91938
parent8f7a242c7bec03fe8a530bfb71f266e8122ecdcb (diff)
downloadbcm5719-llvm-515c15c2073c62caa1ff8ea8de072a3cf6db590c.tar.gz
bcm5719-llvm-515c15c2073c62caa1ff8ea8de072a3cf6db590c.zip
[esan|cfrag] Add test struct-simple.cpp
Summary: Adds a new test struct-simple.cpp for testing the cache-fragmentation tool with a multi-compilation-unit application. Patch by Qin Zhao. Reviewers: bruening Subscribers: kubabrecka, kcc, vitalybuka, eugenis, aizatsky, llvm-commits, zhaoqin Differential Revision: http://reviews.llvm.org/D20599 llvm-svn: 270631
-rw-r--r--compiler-rt/test/esan/TestCases/struct-simple.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/compiler-rt/test/esan/TestCases/struct-simple.cpp b/compiler-rt/test/esan/TestCases/struct-simple.cpp
new file mode 100644
index 00000000000..9749d3aa2e8
--- /dev/null
+++ b/compiler-rt/test/esan/TestCases/struct-simple.cpp
@@ -0,0 +1,38 @@
+// RUN: %clang_esan_frag -O0 %s -DPART -c -o %t-part.o 2>&1
+// RUN: %clang_esan_frag -O0 %s -DMAIN -c -o %t-main.o 2>&1
+// RUN: %clang_esan_frag -O0 %t-part.o %t-main.o -o %t 2>&1
+// RUN: %env_esan_opts=verbosity=2 %run %t 2>&1 | FileCheck %s
+
+// We generate two different object files from this file with different
+// macros, and then link them together. We do this to test how we handle
+// separate compilation with multiple compilation units.
+
+#include <stdio.h>
+
+extern "C" {
+ void part();
+}
+
+//===-- compilation unit without main function ----------------------------===//
+
+#ifdef PART
+void part()
+{
+}
+#endif // PART
+
+//===-- compilation unit with main function -------------------------------===//
+
+#ifdef MAIN
+int main(int argc, char **argv) {
+ // CHECK: in esan::initializeLibrary
+ // CHECK: in esan::processCompilationUnitInit
+ // CHECK: in esan::processCompilationUnitInit
+ part();
+ return 0;
+ // CHECK-NEXT: in esan::finalizeLibrary
+ // CHECK-NEXT: {{.*}}EfficiencySanitizer is not finished: nothing yet to report
+ // CHECK: in esan::processCompilationUnitExit
+ // CHECK: in esan::processCompilationUnitExit
+}
+#endif // MAIN
OpenPOWER on IntegriCloud