Skip to content

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

Merged
merged 10 commits into from
Feb 1, 2019

Conversation

peterschrammel
Copy link
Member

@peterschrammel peterschrammel commented Jan 27, 2019

Replaces bmc_covert

Based on #3796, only review last 10 commits

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

Copy link
Contributor

@allredj allredj left a 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);
Copy link
Collaborator

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 &&);
Copy link
Collaborator

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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?

Copy link
Member Author

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$
Copy link
Collaborator

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.

Copy link
Member Author

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

if(step.io_args.size() == 1)
out << from_expr(ns, "", step.io_args.front());
}
}
Copy link
Collaborator

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.


if(print_trace)
{
// currently ignored
Copy link
Collaborator

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!

{
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);
Copy link
Collaborator

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.

@peterschrammel peterschrammel changed the title Add cover goals verifier [depends: 3796] Add cover goals verifier [depends: 3796, blocks: 3969] Jan 28, 2019
@peterschrammel peterschrammel force-pushed the cover-verifier branch 3 times, most recently from e26526d to 29e1def Compare January 31, 2019 23:35
@tautschnig tautschnig changed the title Add cover goals verifier [depends: 3796, blocks: 3969] Add cover goals verifier [blocks: 3969] Feb 1, 2019
This is useful for retrieving all coverage goals covered
by a trace.
@peterschrammel peterschrammel force-pushed the cover-verifier branch 3 times, most recently from 138cc67 to 07b1e7b Compare February 1, 2019 11:11
Copy link
Contributor

@allredj allredj left a 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())
Copy link
Contributor

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?

Copy link
Member Author

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
Copy link
Contributor

@allredj allredj left a 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

@peterschrammel peterschrammel merged commit c74d257 into diffblue:develop Feb 1, 2019
@peterschrammel peterschrammel deleted the cover-verifier branch February 1, 2019 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants