summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-01-21 00:57:42 +0000
committerXinliang David Li <davidxl@google.com>2016-01-21 00:57:42 +0000
commitbc05e4e4c01b8a05e750b9aa9cad7df729b57938 (patch)
tree3b4670ef634e4c942de952ce914d56471448490b
parent1e056ebe3c9280c29762368c2941777bbd1fed84 (diff)
downloadbcm5719-llvm-bc05e4e4c01b8a05e750b9aa9cad7df729b57938.tar.gz
bcm5719-llvm-bc05e4e4c01b8a05e750b9aa9cad7df729b57938.zip
[Coverage] Add a test case for comdat
The binary contains two (merged) covmap sections which have duplicate CovMapRecords from comdat (template instantation). This test makes sure the reader reads it properly. It also tests that the coverage data from different instantiations of the same template function are properly merged in show output. llvm-svn: 258376
-rwxr-xr-xllvm/test/tools/llvm-cov/Inputs/elf_binary_comdatbin0 -> 2125247 bytes
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/elf_binary_comdat.profdatabin0 -> 1040 bytes
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/instrprof-comdat.h19
-rw-r--r--llvm/test/tools/llvm-cov/cov-comdat.test10
4 files changed, 29 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-cov/Inputs/elf_binary_comdat b/llvm/test/tools/llvm-cov/Inputs/elf_binary_comdat
new file mode 100755
index 00000000000..b5ce4b5a35f
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/elf_binary_comdat
Binary files differ
diff --git a/llvm/test/tools/llvm-cov/Inputs/elf_binary_comdat.profdata b/llvm/test/tools/llvm-cov/Inputs/elf_binary_comdat.profdata
new file mode 100644
index 00000000000..85667041e2c
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/elf_binary_comdat.profdata
Binary files differ
diff --git a/llvm/test/tools/llvm-cov/Inputs/instrprof-comdat.h b/llvm/test/tools/llvm-cov/Inputs/instrprof-comdat.h
new file mode 100644
index 00000000000..e1227167cd4
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/instrprof-comdat.h
@@ -0,0 +1,19 @@
+template <class T> class FOO {
+public:
+ FOO() : t(0) {}
+
+ T DoIt(T ti);
+
+private:
+ T t;
+};
+
+template <class T> T FOO<T>::DoIt(T ti) { // HEADER: 2| [[@LINE]]|template
+ for (T I = 0; I < ti; I++) { // HEADER: 22| [[@LINE]]| for (T
+ t += I; // HEADER: 20| [[@LINE]]| t += I;
+ if (I > ti / 2) // HEADER: 20| [[@LINE]]| if (I > ti
+ t -= 1; // HEADER: 8| [[@LINE]]| t -= 1;
+ } // HEADER: 10| [[@LINE]]| }
+ // HEADER: 1| [[@LINE]]|
+ return t; // HEADER: 1| [[@LINE]]| return t;
+}
diff --git a/llvm/test/tools/llvm-cov/cov-comdat.test b/llvm/test/tools/llvm-cov/cov-comdat.test
new file mode 100644
index 00000000000..f44434c0c22
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/cov-comdat.test
@@ -0,0 +1,10 @@
+REQUIRES: shell
+
+# The binary contains two (merged) covmap sections which
+# have duplicate CovMapRecords from comdat (template instantation).
+# This test makes sure the reader reads it properly. It also
+# tests that the coverage data from different instantiations
+# of the same template function are properly merged in show
+# output.
+
+// RUN: llvm-cov show %S/Inputs/elf_binary_comdat -instr-profile %S/Inputs/elf_binary_comdat.profdata -filename-equivalence %S/Inputs/instrprof-comdat.h | FileCheck --check-prefix=HEADER %S/Inputs/instrprof-comdat.h
OpenPOWER on IntegriCloud