[PATCH] llvm-cov: add test for function & file association in the reports.
Justin Bogner
mail at justinbogner.com
Thu Sep 25 12:58:02 PDT 2014
Alex Lorenz <arphaman at gmail.com> writes:
> Hi bogner, bob.wilson,
>
> The attached patch contains a test which checks that the functions
> defined in header files will get associated with header files rather
> than source files for the reports.
> This is a standalone test patch without any functionality change,
> because I've originally intended to create a patch which changes the
> association (so that the header defined functions will be associated
> with the non-header files), but now I think that the default approach
> is better.
Sure. LGTM.
> http://reviews.llvm.org/D5489
>
> Files:
> test/tools/llvm-cov/Inputs/reportFunctionPlacement.covmapping
> test/tools/llvm-cov/Inputs/reportFunctionPlacement.h
> test/tools/llvm-cov/Inputs/reportFunctionPlacement.profdata
> test/tools/llvm-cov/reportFunctionPlacement.cpp
>
> Index: test/tools/llvm-cov/Inputs/reportFunctionPlacement.h
> ===================================================================
> --- /dev/null
> +++ test/tools/llvm-cov/Inputs/reportFunctionPlacement.h
> @@ -0,0 +1,8 @@
> +
> +void foo(int x) {
> + int y = x + 1;
> +}
> +
> +void bar() {
> +
> +}
> Index: test/tools/llvm-cov/reportFunctionPlacement.cpp
> ===================================================================
> --- /dev/null
> +++ 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
More information about the llvm-commits
mailing list