-
Notifications
You must be signed in to change notification settings - Fork 276
Add cover goals verifier [blocks: 3969] #3968
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
Add cover goals verifier [blocks: 3969] #3968
Conversation
28305eb
to
997f125
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 997f125).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/98754601
@@ -25,6 +25,16 @@ const goto_tracet &goto_trace_storaget::insert(goto_tracet &&trace) | |||
return traces.back(); | |||
} | |||
|
|||
const goto_tracet &goto_trace_storaget::insert_all(goto_tracet &&trace) | |||
{ | |||
traces.push_back(trace); |
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.
Doesn't this require a std::move
to make use of the rvalue reference?
@@ -21,6 +21,7 @@ class goto_trace_storaget | |||
goto_trace_storaget(const goto_trace_storaget &) = delete; | |||
|
|||
const goto_tracet &insert(goto_tracet &&); | |||
const goto_tracet &insert_all(goto_tracet &&); |
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.
Both of these lack documentation, and given they have the same signature it's not clear what the difference might be.
void output_goals( | ||
const propertiest &properties, | ||
unsigned iterations, | ||
ui_message_handlert &ui_message_handler); |
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.
Documentation, please. In particular, it's not clear to me what the iterations
parameter is good for (the other two intuitively make sense).
break; | ||
} | ||
} | ||
output_goals_iterations(properties, iterations, log); |
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.
What is the rationale that this part is not XML/JSON formatted?
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.
This is current behaviour. Improvement suggestion noted #4013
^\[main.coverage.1\] file main.c line 9 function main: SATISFIED$ | ||
^\[main.coverage.2\] file main.c line 13 function main: SATISFIED$ | ||
^\[main.coverage.1\] file main.c line 9 function main assertion: SATISFIED$ | ||
^\[main.coverage.2\] file main.c line 13 function main assertion: SATISFIED$ |
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.
Any idea which commit exactly fixed this? Might be good to merge this change into that other commit.
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.
Squashed and amended commit message
src/cbmc/c_test_input_generator.cpp
Outdated
if(step.io_args.size() == 1) | ||
out << from_expr(ns, "", step.io_args.front()); | ||
} | ||
} |
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.
Nowadays I'd actually use
const auto range = make_range(goto_trace.steps).filter(
[](const goto_tracet::stept &step) { return step.is_input(); }).map(
[](const goto_tracet::stept &step) {
return id2string(step.io_id) + '=' + from_expr(ns, step.function_id, step.io_args.front()); });
join_strings(out, range.begin(), range.end(), ", ");
but maybe that's actually less readable...
Either way, there are two problems here: 1) a weird/incomplete output in case step.io_args.size() != 1
and 2) the use of ""
in from_expr
, which should use step.function_id
instead.
src/cbmc/c_test_input_generator.cpp
Outdated
|
||
if(print_trace) | ||
{ | ||
// currently ignored |
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.
The comment in the header file suggests otherwise!
src/cbmc/c_test_input_generator.cpp
Outdated
{ | ||
json_objectt json_input({{"id", json_stringt(step.io_id)}}); | ||
if(step.io_args.size() == 1) | ||
json_input["value"] = json(step.io_args.front(), ns, ID_unknown); |
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.
Use ns.lookup(step.function_id).mode
instead of ID_unknown
.
e26526d
to
29e1def
Compare
This is useful for retrieving all coverage goals covered by a trace.
std::move was missing.
138cc67
to
07b1e7b
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.
🚫
This PR failed Diffblue compatibility checks (cbmc commit: 07b1e7b).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/99414332
Status will be re-evaluated on next push.
Please contact @peterschrammel, @thk123, or @allredj for support.
Common spurious failures:
- the cbmc commit has disappeared in the mean time (e.g. in a force-push)
- the author is not in the list of contributors (e.g. first-time contributors).
The incompatibility may have been introduced by an earlier PR. In that case merging this
PR should be avoided unless it fixes the current incompatibility.
const goto_tracet &goto_trace_storaget::insert_all(goto_tracet &&trace) | ||
{ | ||
traces.push_back(std::move(trace)); | ||
for(const auto &property_id : traces.back().get_all_property_ids()) |
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.
Do you expect insert_all
to ever be called on a trace hitting no properties? If not, can you add an invariant that traces.back().get_all_property_ids()
is non-empty?
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.
There wouldn't be a trace of no property was hit, but right, this invariant is quite far away from this place. I'll add it.
Coverage traces cover several properties.
The output for --cover is quite different from verification. These functions should be moved into the prospective ccover tool.
Replaces the goal covering and trace generation part of bmc_covert. Does not produce any test output. May be moved into a prospective ccover tool.
Replaces the test input extraction part of bmc_covert, which is entirely independent of producing traces now. To be moved into a prospective ccover tool.
instead of bmc_covert Fixes --cover tests without property descriptions. The unified property handling introduced in a1100e1 used by goto verifier does not allow properties without description.
w.r.t. cover goals verifier
07b1e7b
to
969f5d6
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 969f5d6).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/99438819
Replaces
bmc_covert
Based on #3796, only review last 10 commits