Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c8e1cb8
Main changes to `kani-drive` (`call_cbmc`) to enable piped output
adpaco-aws Aug 1, 2022
525bdd7
Remove `call_display_results` from `kani-driver`
adpaco-aws Aug 1, 2022
3ea8c4b
Adds main file for CBMC output parser, and dependencies
adpaco-aws Aug 1, 2022
50168ec
Remove remaining declaration of `call_display_results`
adpaco-aws Aug 1, 2022
1e73a16
Remove `cbmc_json_parser.py` and references in session & tests
adpaco-aws Aug 1, 2022
ae96ee8
Remove `colorama` dependency from install scripts and bundler
adpaco-aws Aug 1, 2022
b8c3e2e
Add issue URLs
adpaco-aws Aug 1, 2022
4253bb5
Fix `clippy` warnings
adpaco-aws Aug 1, 2022
5ebae08
Fix `clippy` warnings (2)
adpaco-aws Aug 1, 2022
9c73c83
Remove debug prints and update variable names
adpaco-aws Aug 1, 2022
a3bcadf
Address 1st round comments
adpaco-aws Aug 3, 2022
edd4839
Document `process_cbmc_output`
adpaco-aws Aug 3, 2022
ff6a4ed
Remove line after rebase
adpaco-aws Aug 3, 2022
d5c2ee3
Fix more `clippy` warnings...
adpaco-aws Aug 3, 2022
7591905
Add colored output
adpaco-aws Aug 3, 2022
29ba95f
Use `console` instead of `colored` for colored output
adpaco-aws Aug 3, 2022
8f8aef8
Use `write!` in fmt for source locations
adpaco-aws Aug 8, 2022
52959d9
Remove unnecessary `as_str()` calls
adpaco-aws Aug 8, 2022
0527ff0
Format change
adpaco-aws Aug 8, 2022
e611c9e
Use `as_str()` in a couple of places (because of clippy)
adpaco-aws Aug 8, 2022
69538ee
Use `once_cell` instead of `lazy_static`
adpaco-aws Aug 9, 2022
e2a2168
Move `--json-ui` cmd to where it was
adpaco-aws Aug 9, 2022
804fa53
Add tracking issue for string formatting work
adpaco-aws Aug 9, 2022
592cb39
Address comments from Zyad
adpaco-aws Aug 9, 2022
3e5610d
Remove TODO item (colors)
adpaco-aws Aug 9, 2022
77627d7
Remove `OutputFormat` import
adpaco-aws Aug 9, 2022
bed23fd
Fix `clippy` warnings
adpaco-aws Aug 9, 2022
9fa3eb7
Merge branch 'main' into replace-cbmc-output-parser
adpaco-aws Aug 9, 2022
68769e7
Merge branch 'main' into replace-cbmc-output-parser
adpaco-aws Aug 9, 2022
899c29d
Add comment on `triggers_action` function
adpaco-aws Aug 9, 2022
20a8f4d
Merge branch 'main' into replace-cbmc-output-parser
zhassan-aws Aug 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,20 @@ dependencies = [
"walkdir",
]

[[package]]
name = "console"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89eab4d20ce20cea182308bca13088fecea9c05f6776cf287205d41a0ed3c847"
dependencies = [
"encode_unicode",
"libc",
"once_cell",
"terminal_size",
"unicode-width",
"winapi",
]

[[package]]
name = "cprover_bindings"
version = "0.7.0"
Expand Down Expand Up @@ -185,6 +199,12 @@ version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be"

[[package]]
name = "encode_unicode"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"

[[package]]
name = "getopts"
version = "0.2.21"
Expand Down Expand Up @@ -318,8 +338,12 @@ dependencies = [
"anyhow",
"cargo_metadata",
"clap",
"console",
"glob",
"kani_metadata",
"once_cell",
"pathdiff",
"regex",
"serde",
"serde_json",
"structopt",
Expand Down Expand Up @@ -549,6 +573,12 @@ dependencies = [
"windows-sys",
]

[[package]]
name = "pathdiff"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"

[[package]]
name = "pin-project-lite"
version = "0.2.9"
Expand Down Expand Up @@ -831,6 +861,16 @@ dependencies = [
"unicode-ident",
]

[[package]]
name = "terminal_size"
version = "0.1.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df"
dependencies = [
"libc",
"winapi",
]

[[package]]
name = "textwrap"
version = "0.11.0"
Expand Down
4 changes: 4 additions & 0 deletions kani-driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ publish = false
kani_metadata = { path = "../kani_metadata" }
cargo_metadata = "0.15.0"
anyhow = "1"
console = "0.15.1"
once_cell = "1.13.0"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
structopt = "0.3"
clap = "2.34"
glob = "0.3"
toml = "0.5"
regex = "1.6"
pathdiff = "0.2.1"

# A good set of suggested dependencies can be found in rustup:
# https://github.com/rust-lang/rustup/blob/master/Cargo.toml
Expand Down
46 changes: 28 additions & 18 deletions kani-driver/src/call_cbmc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::process::Command;
use std::time::Instant;

use crate::args::KaniArgs;
use crate::cbmc_output_parser::process_cbmc_output;
use crate::session::KaniSession;

#[derive(PartialEq, Eq)]
Expand All @@ -24,7 +25,7 @@ impl KaniSession {

{
let mut temps = self.temporaries.borrow_mut();
temps.push(output_filename.clone());
temps.push(output_filename);
}

let args: Vec<OsString> = self.cbmc_flags(file, harness)?;
Expand All @@ -33,32 +34,41 @@ impl KaniSession {
let mut cmd = Command::new("cbmc");
cmd.args(args);

if self.args.output_format == crate::args::OutputFormat::Old {
let now = Instant::now();

let verification_result = if self.args.output_format == crate::args::OutputFormat::Old {
if self.run_terminal(cmd).is_err() {
return Ok(VerificationStatus::Failure);
Ok(VerificationStatus::Failure)
} else {
Ok(VerificationStatus::Success)
}
} else {
// extra argument
// Add extra argument to receive the output in JSON format.
// Done here because `--visualize` uses the XML format instead.
cmd.arg("--json-ui");

let now = Instant::now();
let _cbmc_result = self.run_redirect(cmd, &output_filename)?;
let elapsed = now.elapsed().as_secs_f32();
let format_result = self.format_cbmc_output(&output_filename);

if format_result.is_err() {
// Because of things like --assertion-reach-checks and other future features,
// we now decide if we fail or not based solely on the output of the formatter.
return Ok(VerificationStatus::Failure);
// todo: this is imperfect, since we don't know why failure happened.
// the best possible fix is port to rust instead of using python, or getting more
// feedback than just exit status (or using a particular magic exit code?)
// Spawn the CBMC process and process its output below
let cbmc_process_opt = self.run_piped(cmd)?;
if let Some(cbmc_process) = cbmc_process_opt {
// The introduction of reachability checks forces us to decide
// the verification result based on the postprocessing of CBMC results.
let processed_result = process_cbmc_output(
cbmc_process,
self.args.extra_pointer_checks,
&self.args.output_format,
);
Ok(processed_result)
} else {
Ok(VerificationStatus::Failure)
}
// TODO: We should print this even the verification fails but not if it crashes.
};
// TODO: We should print this even the verification fails but not if it crashes.
if !self.args.dry_run {
let elapsed = now.elapsed().as_secs_f32();
println!("Verification Time: {}s", elapsed);
}

Ok(VerificationStatus::Success)
verification_result
}

/// used by call_cbmc_viewer, invokes different variants of CBMC.
Expand Down
31 changes: 0 additions & 31 deletions kani-driver/src/call_display_results.rs

This file was deleted.

Loading