summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-02-18 21:11:37 +0000
committerXinliang David Li <davidxl@google.com>2016-02-18 21:11:37 +0000
commit0fc35d0a42057ab416737b38a9f836d6c99aac4c (patch)
tree060fac2a9452e819ddcd8e5614d23c0355d7d249
parentcb4525443c45f09e3e7f990cf0418630e4ba80be (diff)
downloadbcm5719-llvm-0fc35d0a42057ab416737b38a9f836d6c99aac4c.tar.gz
bcm5719-llvm-0fc35d0a42057ab416737b38a9f836d6c99aac4c.zip
Add test coverage for default linker
llvm-svn: 261261
-rw-r--r--compiler-rt/test/profile/Linux/coverage_test.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/compiler-rt/test/profile/Linux/coverage_test.cpp b/compiler-rt/test/profile/Linux/coverage_test.cpp
index 1443279419c..09bc82586ae 100644
--- a/compiler-rt/test/profile/Linux/coverage_test.cpp
+++ b/compiler-rt/test/profile/Linux/coverage_test.cpp
@@ -2,7 +2,16 @@
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-cov show %t -instr-profile %t.profdata -filename-equivalence 2>&1 | FileCheck %s
-//
+// BFD linker older than 2.26 has a bug that per-func profile data will be wrongly garbage collected when GC is turned on. We only do end-to-end test here without GC:
+// RUN: %clang_profgen -O2 -fprofile-instr-generate -fcoverage-mapping -o %t.2 %s
+// RUN: env LLVM_PROFILE_FILE=%t.2.profraw %run %t.2
+// RUN: llvm-profdata merge -o %t.2.profdata %t.2.profraw
+// RUN: llvm-cov show %t.2 -instr-profile %t.2.profdata -filename-equivalence 2>&1 | FileCheck %s
+// Check covmap is not garbage collected when GC is turned on with BFD linker. Due to the bug mentioned above, we can only
+// do the check with objdump:
+// RUN: %clang_profgen -O2 -fprofile-instr-generate -fcoverage-mapping -Wl,--gc-sections -o %t.3 %s
+// RUN: llvm-objdump -h %t.3 | FileCheck --check-prefix COVMAP %s
+// Check PIE option
// RUN: %clang_profgen -fuse-ld=gold -O2 -fdata-sections -ffunction-sections -fPIE -pie -fprofile-instr-generate -fcoverage-mapping -Wl,--gc-sections -o %t.pie %s
// RUN: env LLVM_PROFILE_FILE=%t.pie.profraw %run %t.pie
// RUN: llvm-profdata merge -o %t.pie.profdata %t.pie.profraw
@@ -22,7 +31,5 @@ int main() { // CHECK: 1| [[@LINE]]|int main(
return 0; // CHECK: 1| [[@LINE]]| return
} // CHECK: 1| [[@LINE]]|}
-
-
-
+// COVMAP: __llvm_covmap {{.*}}
OpenPOWER on IntegriCloud