-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm-cov] Allow multiple remaps in --path-equivalence
Previously the --path-equivalence parameter would allow to specify a single remap pair (coverage data path - local source file path). This patch changes this allowing to pass as many remaps as needed. Reviewed By: keith Differential Revision: https://reviews.llvm.org/D154223
- Loading branch information
Showing
6 changed files
with
95 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+412 Bytes
llvm/test/tools/llvm-cov/Inputs/multiple-path_equivalence.covmapping
Binary file not shown.
19 changes: 19 additions & 0 deletions
19
llvm/test/tools/llvm-cov/Inputs/multiple-path_equivalence.proftext
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
f1 | ||
0x0 | ||
1 | ||
1 | ||
|
||
f2 | ||
0x0 | ||
1 | ||
1 | ||
|
||
f3 | ||
0x0 | ||
1 | ||
1 | ||
|
||
f4 | ||
0x0 | ||
1 | ||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# multiple-path_equivalence.covmapping contains references to 4 files: | ||
# /tmp/coverage/main.c | ||
# /tmp/coverage/f1.c | ||
# /tmp/coverage/a/f2.c | ||
# /tmp/coverage/b/f3.c | ||
# /tmp/coverage/b/c/f4.c | ||
|
||
# Setup | ||
// RUN: touch %/T/main.c; touch %/T/f1.c; touch %/T/f2.c; touch %/T/f3.c; touch %/T/f4.c | ||
// RUN: llvm-profdata merge %S/Inputs/multiple-path_equivalence.proftext -o %t.profdata | ||
|
||
# Make sure that remapping follows the specified order with the first matching entry being used first (f4 comes before f3) | ||
// RUN: llvm-cov show %S/Inputs/multiple-path_equivalence.covmapping -instr-profile=%t.profdata -path-equivalence=/tmp/coverage/a,%/T -path-equivalence=/tmp/coverage/b/c,%/T -path-equivalence=/tmp/coverage/b,%/T -path-equivalence=/tmp/coverage,%/T 2>&1 | FileCheck %s | ||
|
||
// CHECK-DAG: {{/|\\}}tmp{{/|\\}}coverage{{/|\\}}main.c: | ||
// CHECK-DAG: {{/|\\}}tmp{{/|\\}}coverage{{/|\\}}f1.c: | ||
// CHECK-DAG: {{/|\\}}tmp{{/|\\}}coverage{{/|\\}}a{{/|\\}}f2.c: | ||
// CHECK-DAG: {{/|\\}}tmp{{/|\\}}coverage{{/|\\}}b{{/|\\}}f3.c: | ||
// CHECK-DAG: {{/|\\}}tmp{{/|\\}}coverage{{/|\\}}b{{/|\\}}c{{/|\\}}f4.c: | ||
// CHECK-NOT: isn't covered. | ||
|
||
# Make sure remapping follows the specified order by proving paths in an overriding order (f4 comes after f3) | ||
// RUN: llvm-cov show %S/Inputs/multiple-path_equivalence.covmapping -instr-profile=%t.profdata -path-equivalence=/tmp/coverage/a,%/T -path-equivalence=/tmp/coverage/b,%/T -path-equivalence=/tmp/coverage/b/c,%/T -path-equivalence=/tmp/coverage,%/T 2>&1 | FileCheck %s -check-prefix=OVERRIDING_ORDER | ||
|
||
// OVERRIDING_ORDER-DAG: {{/|\\}}tmp{{/|\\}}coverage{{/|\\}}main.c: | ||
// OVERRIDING_ORDER-DAG: {{/|\\}}tmp{{/|\\}}coverage{{/|\\}}f1.c: | ||
// OVERRIDING_ORDER-DAG: {{/|\\}}tmp{{/|\\}}coverage{{/|\\}}a{{/|\\}}f2.c: | ||
// OVERRIDING_ORDER-DAG: {{/|\\}}tmp{{/|\\}}coverage{{/|\\}}b{{/|\\}}f3.c: | ||
// OVERRIDING_ORDER-DAG: warning: The file '{{/|\\}}tmp{{/|\\}}coverage{{/|\\}}b{{/|\\}}c{{/|\\}}f4.c' isn't covered. | ||
|
||
// RUN: not llvm-cov show %S/Inputs/multiple-path_equivalence.covmapping -instr-profile=%t.profdata -path-equivalence=/tmp/coverage/a,%/T -path-equivalence=/tmp/coverage/b, -path-equivalence=/tmp/coverage/b/c,%/T -path-equivalence=/tmp/coverage,%/T 2>&1 | FileCheck %s -check-prefix=EMPTY_PATH | ||
// EMPTY_PATH: must be in format 'from,to' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters