From c174931a77ec757f9af83dc5f0ed45078c735bdf Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Tue, 30 Sep 2014 12:52:31 +0000 Subject: [PATCH] llvm-cov: add test for report's function & file association. 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 --- .../Inputs/reportFunctionPlacement.covmapping | Bin 0 -> 352 bytes .../llvm-cov/Inputs/reportFunctionPlacement.h | 8 ++++++ .../Inputs/reportFunctionPlacement.profdata | Bin 0 -> 792 bytes .../llvm-cov/reportFunctionPlacement.cpp | 24 ++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 test/tools/llvm-cov/Inputs/reportFunctionPlacement.covmapping create mode 100644 test/tools/llvm-cov/Inputs/reportFunctionPlacement.h create mode 100644 test/tools/llvm-cov/Inputs/reportFunctionPlacement.profdata create mode 100644 test/tools/llvm-cov/reportFunctionPlacement.cpp diff --git a/test/tools/llvm-cov/Inputs/reportFunctionPlacement.covmapping b/test/tools/llvm-cov/Inputs/reportFunctionPlacement.covmapping new file mode 100644 index 0000000000000000000000000000000000000000..51a5ba2c3d53d9de0f92c1267347a1b31dc635ff GIT binary patch literal 352 zcmd1FDa%dHFUu`SEiOq(EJ>8waj>C5AU?`CEk8dKNF^l}mBmMyq?P6+m*pmA=CLp^ zFmwR11rUS44h04VMj*`&!~#GJ1N#-QiywoEa{v``!W0APb5L=R`N-l-4*H?RsYS*5 zi8-ki`Z++?>VurBUy`4nQw-+o0-dj4lvFSePK50|2xzO&b6J literal 0 HcmV?d00001 diff --git a/test/tools/llvm-cov/Inputs/reportFunctionPlacement.h b/test/tools/llvm-cov/Inputs/reportFunctionPlacement.h new file mode 100644 index 00000000000..9280e039bdc --- /dev/null +++ b/test/tools/llvm-cov/Inputs/reportFunctionPlacement.h @@ -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 index 0000000000000000000000000000000000000000..eec54935a142ef05737b9ab199849931442554b2 GIT binary patch literal 792 zcmeyLQ&5zjmf6U}00E3p8b)zI1(+C8oMvy8yOt5p0hN+~((zFyX{C9|WiTBu6JT_T z(=$d5A_Bo&&^V%-ey6w lF*h+Y50@?ns02(8Ox-ArJp?qc3*!`>iBpC?5|>D{1^|3HA5j1R literal 0 HcmV?d00001 diff --git a/test/tools/llvm-cov/reportFunctionPlacement.cpp b/test/tools/llvm-cov/reportFunctionPlacement.cpp new file mode 100644 index 00000000000..fef945d257e --- /dev/null +++ b/test/tools/llvm-cov/reportFunctionPlacement.cpp @@ -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 -- 2.34.1