1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
llvm-mirror/test/tools/llvm-cov/multiple-objects.test
Max Moroz 7c66521de5 [Coverage] Take filenames into account when loading function records.
Summary:
Don't skip functions with the same name but from different files.

That change makes it possible to generate code coverage reports from
different binaries compiled from different sources even if there are functions
with non-unique names. Without that change, code coverage for such functions is
missing except of the first function processed.

Reviewers: vsk, morehouse

Reviewed By: vsk

Subscribers: llvm-commits, kcc

Differential Revision: https://reviews.llvm.org/D46478

llvm-svn: 331801
2018-05-08 19:26:51 +00:00

23 lines
1.1 KiB
Plaintext

RUN: llvm-cov report -instr-profile %S/Inputs/multiple_objects/merged.profdata \
RUN: %S/Inputs/multiple_objects/use_2.covmapping \
RUN: -object %S/Inputs/multiple_objects/use_1.covmapping | FileCheck -check-prefix=REPORT %s
REPORT: Filename{{ +}}Regions{{ +}}Missed Regions{{ +}}Cover
REPORT-NEXT: ---
REPORT-NEXT: header.h{{ +}}25{{ +}}14{{ +}}44.00%
# Make sure that both use_1.cc and use_2.cc have coverage reported.
# Before https://reviews.llvm.org/D46478, only one of them used to be reported.
REPORT-NEXT: use_1.cc{{ +}}1{{ +}}0{{ +}}100.00%
REPORT-NEXT: use_2.cc{{ +}}2{{ +}}0{{ +}}100.00%
Instructions for regenerating the test:
clang -std=c++11 -mllvm -enable-name-compression=false -fprofile-instr-generate -fcoverage-mapping use_1.cc -o use_1
clang -std=c++11 -mllvm -enable-name-compression=false -fprofile-instr-generate -fcoverage-mapping use_2.cc -o use_2
LLVM_PROFILE_FILE="use_1.raw" ./use_1
LLVM_PROFILE_FILE="use_2.raw" ./use_2
llvm-profdata merge use_{1,2}.raw -o merged.profdata
llvm-cov convert-for-testing ./use_1 -o ./use_1.covmapping
llvm-cov convert-for-testing ./use_2 -o ./use_2.covmapping