xref: /llvm-project/llvm/test/tools/llvm-cov/coverage-prefix-map.test (revision 0204fd25b0ca9a7bc7db11df238d8ec9f195e67c)
1b5da3120SKeith Smiley# RUN: llvm-cov report -path-equivalence=.,%S/Inputs/coverage_prefix_map \
2b5da3120SKeith Smiley# RUN:   -instr-profile %S/Inputs/coverage_prefix_map/main.profdata \
3b5da3120SKeith Smiley# RUN:   %S/Inputs/coverage_prefix_map/main.covmapping \
4b5da3120SKeith Smiley# RUN:   %S/Inputs/coverage_prefix_map/bar.h \
5b5da3120SKeith Smiley# RUN:   | FileCheck --check-prefix=REPORT --implicit-check-not=main.c %s
6b5da3120SKeith Smiley
7b5da3120SKeith Smiley# RUN: llvm-cov export -format lcov -path-equivalence=.,%S/Inputs/coverage_prefix_map \
8b5da3120SKeith Smiley# RUN:   -instr-profile %S/Inputs/coverage_prefix_map/main.profdata \
9b5da3120SKeith Smiley# RUN:   %S/Inputs/coverage_prefix_map/main.covmapping \
10b5da3120SKeith Smiley# RUN:   %S/Inputs/coverage_prefix_map/bar.h \
11b5da3120SKeith Smiley# RUN:   | FileCheck --check-prefix=LCOV --implicit-check-not=main.c %s
12b5da3120SKeith Smiley
13b5da3120SKeith Smiley# REPORT: {{^}}bar.h{{.*}}
14b5da3120SKeith Smiley# REPORT: {{^}}TOTAL{{.*}}100.00%
15b5da3120SKeith Smiley
16*0204fd25SPetr Hosek# LCOV: SF:bar.h
17b5da3120SKeith Smiley# LCOV-NOT: SF
18b5da3120SKeith Smiley
19b5da3120SKeith SmileyInstructions for regenerating the test:
20b5da3120SKeith Smiley# cd %S/Inputs/coverage_prefix_map
21b5da3120SKeith Smileycp -r . /tmp/coverage_prefix_map
22b5da3120SKeith Smiley
23b5da3120SKeith Smileyclang -fprofile-instr-generate -mllvm -enable-name-compression=false -fcoverage-mapping -fcoverage-prefix-map=$PWD=. main.cc -o main
24b5da3120SKeith SmileyLLVM_PROFILE_FILE="main.raw" ./main
25b5da3120SKeith Smileyllvm-profdata merge main.raw -o main.profdata
26b5da3120SKeith Smileyllvm-cov convert-for-testing ./main -o ./main.covmapping
27b5da3120SKeith Smileyrm main main.raw
28