-
Notifications
You must be signed in to change notification settings - Fork 101
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 and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Coverage] Support Branch Coverage #2056
Conversation
@@ -47,32 +58,77 @@ void goto_coveraget::replace_assert_to_guard( | |||
it->location.user_provided(true); | |||
} | |||
|
|||
void goto_coveraget::add_false_asserts() | |||
/* | |||
Branch coverage applies to any control structure that can alter the flow of execution, including: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarifications:
How do we handle `try-catch' here?
What would be the difference between branch coverage and statement coverage?
Should our branch coverage also consider conditional expressions in control structures, ensuring all possible outcomes are tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I tried supporting 'try-catch' today. The difficulty is that, during the goto conversion, esbmc may add some auxiliary if-goto inside the try-catch body, thereby affecting the counting of the branches. No solution so far.
- Branch Coverage = Decision Coverage: Measures whether each possible branch (decision) in the code has been executed. Statement Coverage: check if every line of code is executed at least once
- In C, they all converted to if-goto, including if, else if, while, do-while, for, switch-case
What do you mean by incomplete? |
The goto program is simplified, so the count of the total instrumentation is incomplete. E.g.
Has been simplified to
in kind/incr. The unwind looks fine. |
I think you mean the assertions were simplified to skips, not the other way around, right? |
Yes |
Update: temporarily fix the kind/incr issues by using static member |
9e0ab9d
to
b15d6b3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChenfengWei0: please consider addressing Rafael's suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChenfengWei0: please consider addressing Rafael's suggestion.
2d90261
to
f8c4808
Compare
a246b3d
to
e97fa88
Compare
Thanks for submitting this PR, @ChenfengWei0. |
Strategy
We follow the strategy as CBMC. That is, we not only count the entry of branches, but also count the entry of functions.
e.g.
ESBMC Output
>CBMC Output
>I am not sure if this is the "Branch Coverage" expected by Testcomp, as the typical branch coverage seems to only count the entry of branches
Known Issue
Currently cannot use this with
k-induction
orincremental-bmc
. It seems in kind/incr, the goto_functions used during the BMC is simplified and incompletegoto functions in unwind mode
>goto functions in kind mode
>Would anyone happen to know how to disable this simplification feature