Commit Graph

21 Commits

Author SHA1 Message Date
zhuyunxing
6e3e19f714 coverage. Adapt to mcdc mapping formats introduced by llvm 19 2024-10-08 11:15:24 +08:00
Josh Stone
6fd8a50680 Update the minimum external LLVM to 18 2024-09-18 13:53:31 -07:00
Michael Goulet
ffd72b1700 Fix remaining cases 2024-06-21 19:00:18 -04:00
Zalathar
abc2c702af coverage: Add debugging flag -Zcoverage-options=no-mir-spans
When set, this flag skips the code that normally extracts coverage spans from
MIR statements and terminators. That sometimes makes it easier to debug branch
coverage and MC/DC coverage, because the coverage output is less noisy.

For internal debugging only. If other code changes would make it hard to keep
supporting this flag, remove it.
2024-06-17 21:16:15 +10:00
Zalathar
5330ccdb34 Use -Zno-profiler-runtime instead of //@ needs-profiler-support
For PGO/coverage tests that don't need to build or run an actual artifact, we
can use `-Zno-profiler-runtime` to run the test even when the profiler runtime
is not available.
2024-06-14 13:31:46 +10:00
Matthias Krüger
7667a91778
Rollup merge of #125756 - Zalathar:branch-on-bool, r=oli-obk
coverage: Optionally instrument the RHS of lazy logical operators

(This is an updated version of #124644 and #124402. Fixes #124120.)

When `||` or `&&` is used outside of a branching context (such as the condition of an `if`), the rightmost value does not directly influence any branching decision, so branch coverage instrumentation does not treat it as its own true-or-false branch.

That is a correct and useful interpretation of “branch coverage”, but might be undesirable in some contexts, as described at #124120. This PR therefore adds a new coverage level `-Zcoverage-options=condition` that behaves like branch coverage, but also adds additional branch instrumentation to the right-hand-side of lazy boolean operators.

---

As discussed at https://github.com/rust-lang/rust/issues/124120#issuecomment-2092394586, this is mainly intended as an intermediate step towards fully-featured MC/DC instrumentation. It's likely that we'll eventually want to remove this coverage level (rather than stabilize it), either because it has been incorporated into MC/DC instrumentation, or because it's getting in the way of future MC/DC work. The main appeal of landing it now is so that work on tracking conditions can proceed concurrently with other MC/DC-related work.

````@rustbot```` label +A-code-coverage
2024-05-31 17:05:24 +02:00
Dorian Péron
fa563c1384 coverage: Add CLI support for -Zcoverage-options=condition 2024-05-30 15:38:46 +10:00
Zalathar
c671eaaaff coverage: Rename MC/DC conditions_num to num_conditions
This value represents a quantity of conditions, not an ID, so the new spelling
is more appropriate.
2024-05-30 13:16:07 +10:00
Zalathar
34a1828fea coverage: Add tests for the MC/DC condition limit 2024-05-29 20:12:20 +10:00
Zalathar
14d56e8338 Fix test problems discovered by the revision check
Most of these changes either add revision names that were apparently missing,
or explicitly mark a revision name as currently unused.
2024-05-09 14:47:09 +10:00
Urgau
ed81578820 tests/ui: prepare some tests for --check-cfg by default 2024-05-04 11:30:38 +02:00
Zalathar
f9263374fb coverage: Replace boolean options with a CoverageLevel enum 2024-04-29 20:04:22 +10:00
zhuyunxing
68f86381ee coverage. Add coverage-options=mcdc as gate for MC/DC instrument 2024-04-19 10:43:53 +08:00
Urgau
47ff773632 Rename invalid false cfg to valid _false cfg
While `false` is accepted by `--cfg` it isn't by `#[cfg(false)]`
since in that context `false` is the boolean not a ident.
2024-04-07 01:16:46 +02:00
Zalathar
3407fcc12e coverage: Add -Zcoverage-options for fine control of coverage
This new nightly-only flag can be used to toggle fine-grained flags that
control the details of coverage instrumentation.

Currently the only supported flag value is `branch` (or `no-branch`), which is
a placeholder for upcoming support for branch coverage. Other flag values can
be added in the future, to prototype proposed new behaviour, or to enable
special non-default behaviour.
2024-03-13 11:14:10 +11:00
Zalathar
1f544ce305 coverage: Remove all unstable values of -Cinstrument-coverage 2024-03-13 11:14:09 +11:00
Zalathar
9f287dd7b3 Change the documented implicit value of -C instrument-coverage to =yes 2024-03-06 17:50:13 +11:00
许杰友 Jieyou Xu (Joe)
ec2cc761bc
[AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
Zalathar
bc18509719 coverage: UI test for unstable value -C instrument-coverage=branch 2023-10-25 11:36:45 +11:00
Arpad Borsos
2b36547e9c
Introduce -C instrument-coverage=branch to gate branch coverage
This flag has to be used in combination with `-Zunstable-options`,
and is added in advance of adding branch coverage instrumentation.
2023-10-24 09:51:26 +02:00
Zalathar
f83f7966f5 coverage: Add UI tests for values accepted by -Cinstrument-coverage 2023-10-23 17:41:40 +11:00