MCDC Coverage: instrument last boolean RHS operands from condition coverage by RenjiSann · Pull Request #125766 · rust-lang/rust (original) (raw)

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation25 Commits3 Checks6 Files changed

Conversation

This file contains hidden or 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

[ Show hidden characters]({{ revealButtonHref }})

RenjiSann

Fresh PR from #124652

--

This PR ensures that the top-level boolean expressions that are not part of the control flow are correctly instrumented thanks to condition coverage.

See discussion on #124120.
Depends on @Zalathar 's condition coverage implementation #125756.

@rustbot

r? @fee1-dead

rustbot has assigned @fee1-dead.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

labels

May 30, 2024

@rustbot

Some changes occurred in coverage tests.

cc @Zalathar

Some changes occurred in coverage instrumentation.

cc @Zalathar

@fee1-dead

nnethercote

@nnethercote

I only looked at the last three commit, because the first three are from #125756.

This seems ok to me but I know very little about the coverage code. @Zalathar, could you also review, and if you are happy then I will give r+. Thanks!

@Zalathar

Zalathar

Zalathar

@Zalathar

Other than some tiny nitpicks, the main changes seem reasonable.

When the nits are addressed (fixed or justified), this should be good to go.

@RenjiSann

@RenjiSann

All nitpicks are addressed. This is good to go :)

@ZhuUx ZhuUx mentioned this pull request

Jun 6, 2024

4 tasks

@RenjiSann

Hi, @Zalathar
Can you merge this, if it's OK for you ?

Zalathar

@Zalathar

I'm happy with this, with or without addressing my tiny nitpick.

r+ from me, but I don't actually have permissions to add this to the queue on my own.

@Zalathar

@nnethercote

r=me once the expr_span nit has been addressed.

@bors delegate=RenjiSann

@bors

✌️ @RenjiSann, you can now approve this pull request!

If @nnethercote told you to "r=me" after making some further change, please make that change, then do @bors r=@nnethercote

@RenjiSann

Condition coverage extends branch coverage to treat the specific case of last operands of boolean decisions not involved in control flow. This is ultimately made for MCDC to be exhaustive on all boolean expressions.

This patch adds a call to visit_branch_coverage_operation to track the top-level operand of the said decisions, and changes visit_coverage_standalone_condition so MCDC branch registration is called when enabled on these last RHS cases.

@RenjiSann

@RenjiSann

@bors

📌 Commit e15adef has been approved by nnethercote

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Jun 19, 2024

bors added a commit to rust-lang-ci/rust that referenced this pull request

Jun 19, 2024

@bors

Rollup of 6 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Jun 19, 2024

@rust-timer

Rollup merge of rust-lang#125766 - RenjiSann:fresh-mcdc-branch-on-bool, r=nnethercote

MCDC Coverage: instrument last boolean RHS operands from condition coverage

Fresh PR from rust-lang#124652

--

This PR ensures that the top-level boolean expressions that are not part of the control flow are correctly instrumented thanks to condition coverage.

See discussion on rust-lang#124120. Depends on @Zalathar 's condition coverage implementation rust-lang#125756.

@bors

@fmease

@bors bors added S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

and removed S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

labels

Jun 19, 2024

This was referenced

Jul 2, 2024

bors added a commit to rust-lang-ci/rust that referenced this pull request

Jul 9, 2024

@bors

…thar

[Coverage][MCDC] Group mcdc tests and fix panic when generating mcdc code for inlined expressions.

Changes

  1. Group all mcdc tests to one directory.
  2. Since mcdc instruments different mappings for boolean expressions with normal branch coverage as rust-lang#125766 introduces, it would be better also trace branch coverage results in mcdc tests.
  3. So far rustc does not call CoverageInfoBuilderMethods::init_coverage for inlined functions. As a result, it could panic if it tries to instrument mcdc statements for inlined functions due to uninitialized cond bitmaps. We can reproduce this issue by current nightly rustc and the test with flag --release. This patch fixes it.

Labels

A-code-coverage

Area: Source-based code coverage (-Cinstrument-coverage)

S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.