llvm-project/llvm/test/tools/llvm-cov/branch-logical-mixed.test
NAKAMURA Takumi 1c25a3bfa5
Introduce SingleByteCoverage tests (w/yaml2obj) (#113114)
Restructure some tests to split into `%.test` and Inputs/%.c*`.

Add test actions with `yaml2obj` for single byte coverage. `FileCheck`
lines are:
- Relax to accept both counter values and single values `1`. A few line
counting are greater than `1` due to `llvm-profdata merge`. They will be
fixed by #110972.
- Suppress matching with `--check-prefixes=CHECK,BRCOV`, since the
current implementation of single byte doesn't emit any branch coverages.
They will be integrated to `CHECK` finally.
- Some tests are not unified but use dedicated `CHECK` lines for single
byte, since old format is different (esp. "partial fold"). They will be
unified when `Inputs` will be regenerated.

Introduce llvm/test/tools/llvm-cov/Inputs/yaml.makefile for convenience.
`%-single.yaml` and `%-single.proftext` are generated by it. It could be
used to regenerate other files.


https://discourse.llvm.org/t/rfc-integrating-singlebytecoverage-with-branch-coverage/82492
2024-12-24 06:40:44 +09:00

18 lines
1.5 KiB
Plaintext

// RUN: llvm-profdata merge %S/Inputs/branch-logical-mixed.proftext -o %t.profdata
// RUN: llvm-cov show --show-branches=count %S/Inputs/branch-logical-mixed.o32l -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs | FileCheck %S/Inputs/branch-logical-mixed.cpp -D#C=999
// RUN: llvm-cov report --show-branch-summary %S/Inputs/branch-logical-mixed.o32l -instr-profile %t.profdata -show-functions -path-equivalence=/tmp,%S/Inputs %S/Inputs/branch-logical-mixed.cpp
| FileCheck %s -check-prefix=REPORT
// RUN: yaml2obj %S/Inputs/branch-logical-mixed-single.yaml -o %t.o
// RUN: llvm-profdata merge %S/Inputs/branch-logical-mixed-single.proftext -o %t.profdata
// RUN: llvm-cov show --show-branches=count %t.o -instr-profile %t.profdata -path-equivalence=.,%S/Inputs | FileCheck %S/Inputs/branch-logical-mixed.cpp -D#C=1
// RUN: llvm-cov report --show-branch-summary %t.o -instr-profile %t.profdata -show-functions -path-equivalence=.,%S/Inputs %S/Inputs/branch-logical-mixed.cpp
| FileCheck %s -check-prefix=REPORT
// REPORT: Name Regions Miss Cover Lines Miss Cover Branches Miss Cover
// REPORT-NEXT: ---
// REPORT-NEXT: _Z4funcii 77 15 80.52% 60 2 96.67% 80 30 62.50%
// REPORT-NEXT: main 1 0 100.00% 5 0 100.00% 0 0 0.00%
// REPORT-NEXT: ---
// REPORT-NEXT: TOTAL 78 15 80.77% 65 2 96.92% 80 30 62.50%