llvm-cov: add test for report's function & file association.
authorAlex Lorenz <arphaman@gmail.com>
Tue, 30 Sep 2014 12:52:31 +0000 (12:52 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Tue, 30 Sep 2014 12:52:31 +0000 (12:52 +0000)
This commit adds a test which checks that the functions defined in header files will get associated with the header files rather than the source files in the reports.

Differential Revision: http://reviews.llvm.org/D5489

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218673 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-cov/Inputs/reportFunctionPlacement.covmapping [new file with mode: 0644]
test/tools/llvm-cov/Inputs/reportFunctionPlacement.h [new file with mode: 0644]
test/tools/llvm-cov/Inputs/reportFunctionPlacement.profdata [new file with mode: 0644]
test/tools/llvm-cov/reportFunctionPlacement.cpp [new file with mode: 0644]

diff --git a/test/tools/llvm-cov/Inputs/reportFunctionPlacement.covmapping b/test/tools/llvm-cov/Inputs/reportFunctionPlacement.covmapping
new file mode 100644 (file)
index 0000000..51a5ba2
Binary files /dev/null and b/test/tools/llvm-cov/Inputs/reportFunctionPlacement.covmapping differ
diff --git a/test/tools/llvm-cov/Inputs/reportFunctionPlacement.h b/test/tools/llvm-cov/Inputs/reportFunctionPlacement.h
new file mode 100644 (file)
index 0000000..9280e03
--- /dev/null
@@ -0,0 +1,8 @@
+
+void foo(int x) {
+  int y = x + 1;
+}
+
+void bar() {
+
+}
diff --git a/test/tools/llvm-cov/Inputs/reportFunctionPlacement.profdata b/test/tools/llvm-cov/Inputs/reportFunctionPlacement.profdata
new file mode 100644 (file)
index 0000000..eec5493
Binary files /dev/null and b/test/tools/llvm-cov/Inputs/reportFunctionPlacement.profdata differ
diff --git a/test/tools/llvm-cov/reportFunctionPlacement.cpp b/test/tools/llvm-cov/reportFunctionPlacement.cpp
new file mode 100644 (file)
index 0000000..fef945d
--- /dev/null
@@ -0,0 +1,24 @@
+// RUN: llvm-cov report %S/Inputs/reportFunctionPlacement.covmapping -instr-profile %S/Inputs/reportFunctionPlacement.profdata -no-colors 2>&1 | FileCheck %s
+// This test checks that the functions defined in header files will get
+// associated with header files rather than source files for the reports.
+
+#include "Inputs/reportFunctionPlacement.h"
+
+// CHECK: Filename                    Regions    Miss   Cover Functions  Executed
+// CHECK: ---
+// CHECK: ...ortFunctionPlacement.h         2       1  50.00%         2    50.00%
+// CHECK: ...tFunctionPlacement.cpp         2       0 100.00%         2   100.00%
+// CHECK: ---
+// CHECK: TOTAL                             4       1  75.00%         4    75.00%
+
+void func() {
+}
+
+int main() {
+  foo(10);
+  func();
+  return 0;
+}
+
+// llvm-cov doesn't work on big endian yet
+// XFAIL: powerpc64-, s390x, mips-, mips64-, sparc