Add live streaming JSON output from CBMC to prevent Kani output hang#1278
Add live streaming JSON output from CBMC to prevent Kani output hang#1278jaisnan wants to merge 22 commits intomodel-checking:mainfrom
Conversation
adpaco-aws
left a comment
There was a problem hiding this comment.
You should be able to define expected tests for this, no?
scripts/cbmc_json_parser.py
Outdated
| usage_error(f"Unable to complete parsing CBMC Output\n") | ||
| else: | ||
| usage_error(f"CBMC Output not piped to post-processing\n") | ||
| return_code = 0 |
There was a problem hiding this comment.
I would use an error code here.
There was a problem hiding this comment.
I've added a custom exit string and an error code of 1 with -
print(f"Unable to complete parsing CBMC Output\n")
sys.exit(1)
Would this work?
There was a problem hiding this comment.
Sorry, my comment here was not very clear.
If I'm not mistaken, this will print all lines from CBMC's output and return 0. If we change this to 1, do the regression tests still pass?
There was a problem hiding this comment.
I should have expanded more in the comments. The return code is 1 if the stream of output is interrupted , either by a broken line or broken pipe or user interrupt (Ex - keyboard interrupt). If it completes printing all the lines from CBMC, then it returns 0. I shall add this clarification to the comments on the code.
I hope this is an acceptable usage of the error code?
There was a problem hiding this comment.
A return code with value 0 basically means that verification is always successful.
…to Add-Piped-Output
…to Add-Piped-Output
I was able to add in a few tests and refactored the code as suggested. Let me know if they're as expected! |
|
|
||
| let now = Instant::now(); | ||
| let _cbmc_result = self.run_redirect(cmd, &output_filename)?; | ||
| let elapsed = now.elapsed().as_secs_f32(); |
There was a problem hiding this comment.
This call is right after the call to Instant::now(), so it's not measuring verification time anymore.
scripts/cbmc_json_parser.py
Outdated
| usage_error(f"Unable to complete parsing CBMC Output\n") | ||
| else: | ||
| usage_error(f"CBMC Output not piped to post-processing\n") | ||
| return_code = 0 |
There was a problem hiding this comment.
A return code with value 0 basically means that verification is always successful.
|
Closed in favor of #1433 |
Description of changes:
CBMC currently reads the input from CBMC , waits for termination and writes the output to a file which goes to the parsing script. This runs into an issue when CBMC does not seemingly terminate, which makes Kani appear to be hung.
This PR changes that to show the JSON output live from CBMC which will later be consumed by the parsing to show the post processed Kani output.
For example, for the rust file -
Before -
After -
As we can , there is a long unwinding loop that's not being displayed to the user which can cause some confusion.
With this change, the user can be informed about the status of the verification live.
Resolved issues:
Related #493
Call-outs:
--use-piped-outputfor now.Testing:
How is this change tested?
Hidden behind a flag to be as non-invasive as possible.
Is this a refactor change?
Yes
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.