-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate goto-synthesizer into Kani
- Loading branch information
Showing
6 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright Kani Contributors | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
use crate::util::warning; | ||
use anyhow::Result; | ||
use std::ffi::OsString; | ||
use std::path::Path; | ||
use std::process::Command; | ||
|
||
use crate::session::KaniSession; | ||
|
||
impl KaniSession { | ||
/// Synthesize loop contracts for a goto binary `input` and produce a new goto binary `output` | ||
/// The synthesizer we use is `goto-synthesizer` built in CBMC codebase, which is an enumerative | ||
/// loop-contracts synthesizer. `goto-synthesizer` enumerates and checks if a candidate can be | ||
/// used to prove some assertions, and return found invariants when all checks pass. | ||
pub fn synthesize_loop_contracts(&self, input: &Path, output: &Path) -> Result<()> { | ||
if !self.args.quiet { | ||
warning("Start to synthesize loop contracts for all loops."); | ||
warning("WARNING: this process may not terminate."); | ||
} | ||
|
||
let args: Vec<OsString> = vec![ | ||
"--loop-contracts-no-unwind".into(), | ||
input.to_owned().into_os_string(), // input | ||
output.to_owned().into_os_string(), // output | ||
]; | ||
|
||
let mut cmd = Command::new("goto-synthesizer"); | ||
cmd.args(args); | ||
|
||
self.run_suppress(cmd)?; | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VERIFICATION:- SUCCESSFUL |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
VERIFICATION:- SUCCESSFUL |