Executable trace feature#1409
Merged
sanjit-bhat merged 104 commits intomodel-checking:mainfrom Aug 10, 2022
Merged
Conversation
celinval
reviewed
Jul 25, 2022
Contributor
celinval
left a comment
There was a problem hiding this comment.
First pass. Thanks for doing this! :)
celinval
reviewed
Jul 26, 2022
Contributor
celinval
left a comment
There was a problem hiding this comment.
Sorry, I know this is not ready yet for review, but I just have two comments that hopefully will help you refine this.
- I think you still need to add implementation for some of our library functions, e.g., the
kani::assert()is empty today. - Improve the interface to initialize the test values. See comment below.
sanjit-bhat
commented
Jul 28, 2022
sanjit-bhat
commented
Jul 28, 2022
sanjit-bhat
commented
Jul 28, 2022
This was formed by squashing the following commits: feat: exec-trace POC that gets kani::any assignments feat: init work making exec_trace a Kani command line flag feat: make trace parsing more precise feat: allow for multiple extracted values feat: Move parsing code into the driver refactor: move functions outside KaniSession test: add basic UI test for det val feat: change any_raw to make it easier to parse trace feat: update any_raw to use byte array feat: update parser to take in byte array chore: run rustfmt test: add constant generic bound to func abstraction tests test: fix remaining test issues to pass regression feat: update any_raw_inner to return bytes chore: remove spurious results file feat: update any_raw_inner to read from det_vals file feat: add exec_trace flag to kani-compiler refactor(kani-compiler): rename vars to increase readability feat(kani-compiler): specify different Kani lib paths feat: prototype E2E mechanism for gen det vals & running exec trace fix: add generic const trait bounds to any_vec feat: add print out to get debug command chore: remove det vals from tmp file list for demo
…o a single harness
…ace flag. This is for old exe_trace parser compatibility
Contributor
Author
|
@adpaco-aws can you take a look at the changes to |
celinval
approved these changes
Aug 10, 2022
Contributor
celinval
left a comment
There was a problem hiding this comment.
Awesome! We should create a section in our documentation about this feature and how to try it out. Thanks
adpaco-aws
approved these changes
Aug 10, 2022
Contributor
adpaco-aws
left a comment
There was a problem hiding this comment.
You've kept the changes to the parser to a minimum. Great work!
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes:
This PR adds the executable trace feature for improving users' debugging experience after verification failures. With the
--gen-exe-traceflag, Kani will print out a Rust unit test that contains 1) concrete values for all calls tokani::anyand 2) a call to the failed proof harness. The user can then debug their failing proof harness like they would with any normal Rust unit test. With an optional--add-exe-trace-to-srcflag, Kani will even add the unit test directly to the user's source code.To use this feature on a test crate:
Cargo.toml:cfg(kani)feature flag.Resolved issues:
Implements recommended approach in #1388. Closes #1253. Closes #1317. Closes #1392. Closes #1443. Closes #1444. Closes #1445.
Call-outs:
any_raw_internalwill only be called on primitive types. These show up nicely in the CBMC output trace, removing the need for a complicated parser or changing the lowest level non-determinism to a byte array.--traceflag to CBMC when the user runs with--gen-exe-trace. This flag adds a bit more overhead to CBMC post-processing, which scales with the length of the trace. We have been able to run this feature on fairly large traces (100s of states) without much of a noticeable performance difference.kani::anyassignment, but that variable isn't present in the verification conditions, CBMC doesn't have a concrete value for it in the output trace. To fix this, we would likely need to disable--slice-formulawhen we run CBMC with--trace. See Enable CBMC's equation-level slicer #1252.size_ofa generic type. However, after Deprecate any_raw and Invariant #1415, if we only callany_raw_internalusing macros on primitive types, we could remove this and add the size as a type parameter toany_raw_internal.Testing:
This change has an end-to-end UI test that checks to see if the correct concrete values are parsed and placed into a test case. We also manually tested this feature on a few different test harnesses. In the future, we plan to add the following tests:
--add-exe-trace-to-srcfeature and runs the unit test to verify that assertions actually fail. For now, we manually test this.exe_tracemodule in thekani-driver.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.