Skip to content

Commit 26c078e

Browse files
zhassan-awsjaisnan
andauthored
Remove CBMC viewer and visualize option (#3699)
This builds upon @jaisnan's changes in #3302. The PR removes the `--visualize` option and the CBMC viewer from the Kani installation and CI. There is still some room for clean-up, specifically with the python dependency. This can be handled in a separate PR. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. --------- Co-authored-by: Jaisurya Nanduri <jaisnan@amazon.com>
1 parent 8400296 commit 26c078e

File tree

28 files changed

+21
-381
lines changed

28 files changed

+21
-381
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ jobs:
272272
- name: Run tests
273273
# TODO: Customize compiletest to run custom kani. For now, just run a few cargo kani tests.
274274
run: |
275-
for dir in simple-lib simple-visualize build-rs-works simple-kissat; do
275+
for dir in simple-lib build-rs-works simple-kissat; do
276276
>&2 echo "Running test $dir"
277277
pushd tests/cargo-kani/$dir
278278
cargo kani
@@ -312,7 +312,7 @@ jobs:
312312
313313
- name: Run installed tests
314314
run: |
315-
for dir in simple-lib simple-visualize build-rs-works simple-kissat; do
315+
for dir in simple-lib build-rs-works simple-kissat; do
316316
>&2 echo "Running test $dir"
317317
docker run -v /var/run/docker.sock:/var/run/docker.sock \
318318
-w /tmp/kani/tests/cargo-kani/$dir kani-18-04 cargo kani

docs/src/build-from-source.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ In general, the following dependencies are required to build Kani from source.
1212
1313
1. Cargo installed via [rustup](https://rustup.rs/)
1414
2. [CBMC](https://github.com/diffblue/cbmc) (latest release)
15-
3. [CBMC Viewer](https://github.com/awslabs/aws-viewer-for-cbmc) (latest release)
16-
4. [Kissat](https://github.com/arminbiere/kissat) (Release 3.1.1)
15+
3. [Kissat](https://github.com/arminbiere/kissat) (Release 3.1.1)
1716

1817
Kani has been tested in [Ubuntu](#install-dependencies-on-ubuntu) and [macOS](##install-dependencies-on-macos) platforms.
1918

docs/src/install-guide.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ The following must already be installed:
1616

1717
* **Python version 3.7 or newer** and the package installer `pip`.
1818
* Rust 1.58 or newer installed via `rustup`.
19-
* `ctags` is required for Kani's `--visualize` option to work correctly. [Universal ctags](https://ctags.io/) is recommended.
2019

2120
## Installing the latest version
2221

docs/src/usage.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ Common to both `kani` and `cargo kani` are many command-line flags:
2828
If used with `print`, Kani will only print the unit test to stdout.
2929
If used with `inplace`, Kani will automatically add the unit test to the user's source code, next to the proof harness. For more detailed instructions, see the [concrete playback](./experimental/concrete-playback.md) section.
3030

31-
* `--visualize`: _Experimental_, `--enable-unstable` feature that generates an HTML report providing traces (i.e., counterexamples) for each failure found by Kani.
32-
3331
* `--tests`: Build in "[test mode](https://doc.rust-lang.org/rustc/tests/index.html)", i.e. with `cfg(test)` set and `dev-dependencies` available (when using `cargo kani`).
3432

3533
* `--harness <name>`: By default, Kani checks all proof harnesses it finds.

kani-dependencies

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,4 @@ CBMC_MAJOR="6"
22
CBMC_MINOR="4"
33
CBMC_VERSION="6.4.0"
44

5-
# If you update this version number, remember to bump it in `src/setup.rs` too
6-
CBMC_VIEWER_MAJOR="3"
7-
CBMC_VIEWER_MINOR="10"
8-
CBMC_VIEWER_VERSION="3.10"
9-
105
KISSAT_VERSION="3.1.1"

kani-driver/src/args/mod.rs

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -184,19 +184,11 @@ pub struct VerificationArgs {
184184
#[arg(long, hide = true, requires("enable_unstable"))]
185185
pub assess: bool,
186186

187-
/// Generate visualizer report to `<target-dir>/report/html/index.html`
188-
#[arg(long)]
189-
pub visualize: bool,
190187
/// Generate concrete playback unit test.
191188
/// If value supplied is 'print', Kani prints the unit test to stdout.
192189
/// If value supplied is 'inplace', Kani automatically adds the unit test to your source code.
193190
/// This option does not work with `--output-format old`.
194-
#[arg(
195-
long,
196-
conflicts_with_all(&["visualize"]),
197-
ignore_case = true,
198-
value_enum
199-
)]
191+
#[arg(long, ignore_case = true, value_enum)]
200192
pub concrete_playback: Option<ConcretePlaybackMode>,
201193
/// Keep temporary files generated throughout Kani process. This is already the default
202194
/// behavior for `cargo-kani`.
@@ -355,9 +347,9 @@ impl VerificationArgs {
355347
// if we flip the default, this will become: !self.no_restrict_vtable
356348
}
357349

358-
/// Assertion reachability checks should be disabled when running with --visualize
350+
/// Assertion reachability checks should be disabled
359351
pub fn assertion_reach_checks(&self) -> bool {
360-
!self.no_assertion_reach_checks && !self.visualize
352+
!self.no_assertion_reach_checks
361353
}
362354

363355
/// Suppress our default value, if the user has supplied it explicitly in --cbmc-args
@@ -577,18 +569,6 @@ impl ValidateArgs for VerificationArgs {
577569
print_obsolete(&self.common_args, "--write-json-symtab");
578570
}
579571

580-
if self.visualize {
581-
if !self.common_args.enable_unstable {
582-
return Err(Error::raw(
583-
ErrorKind::MissingRequiredArgument,
584-
"Missing argument: --visualize now requires --enable-unstable
585-
due to open issues involving incorrect results.",
586-
));
587-
} else {
588-
print_deprecated(&self.common_args, "--visualize", "--concrete-playback");
589-
}
590-
}
591-
592572
// TODO: these conflicting flags reflect what's necessary to pass current tests unmodified.
593573
// We should consider improving the error messages slightly in a later pull request.
594574
if natives_unwind && extra_unwind {

kani-driver/src/call_cbmc.rs

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use std::collections::btree_map::Entry;
1010
use std::ffi::OsString;
1111
use std::fmt::Write;
1212
use std::path::Path;
13-
use std::process::Command;
1413
use std::sync::OnceLock;
1514
use std::time::{Duration, Instant};
1615
use tokio::process::Command as TokioCommand;
@@ -94,7 +93,8 @@ impl KaniSession {
9493
}
9594
} else {
9695
// Add extra argument to receive the output in JSON format.
97-
// Done here because `--visualize` uses the XML format instead.
96+
// Done here because now removed `--visualize` used the XML format instead.
97+
// TODO: move this now that we don't use --visualize
9898
cmd.arg("--json-ui");
9999

100100
self.runtime.block_on(self.run_cbmc_piped(cmd, harness))?
@@ -167,23 +167,6 @@ impl KaniSession {
167167
Ok(verification_results)
168168
}
169169

170-
/// used by call_cbmc_viewer, invokes different variants of CBMC.
171-
// TODO: this could use some cleanup and refactoring.
172-
pub fn call_cbmc(&self, args: Vec<OsString>, output: &Path) -> Result<()> {
173-
// TODO get cbmc path from self
174-
let mut cmd = Command::new("cbmc");
175-
cmd.args(args);
176-
177-
let result = self.run_redirect(cmd, output)?;
178-
179-
if !result.success() {
180-
bail!("cbmc exited with status {}", result);
181-
}
182-
// TODO: We 'bail' above, but then ignore it in 'call_cbmc_viewer' ...
183-
184-
Ok(())
185-
}
186-
187170
/// "Internal," but also used by call_cbmc_viewer
188171
pub fn cbmc_flags(
189172
&self,
@@ -209,10 +192,7 @@ impl KaniSession {
209192
args.push("--validate-ssa-equation".into());
210193
}
211194

212-
if !self.args.visualize
213-
&& self.args.concrete_playback.is_none()
214-
&& !self.args.no_slice_formula
215-
{
195+
if self.args.concrete_playback.is_none() && !self.args.no_slice_formula {
216196
args.push("--slice-formula".into());
217197
}
218198

kani-driver/src/call_cbmc_viewer.rs

Lines changed: 0 additions & 97 deletions
This file was deleted.

kani-driver/src/harness_runner.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ impl<'pr> HarnessRunner<'_, 'pr> {
5656
sorted_harnesses
5757
.par_iter()
5858
.map(|harness| -> Result<HarnessResult<'pr>> {
59-
let harness_filename = harness.pretty_name.replace("::", "-");
60-
let report_dir = self.project.outdir.join(format!("report-{harness_filename}"));
6159
let goto_file =
6260
self.project.get_harness_artifact(&harness, ArtifactType::Goto).unwrap();
6361

@@ -67,7 +65,7 @@ impl<'pr> HarnessRunner<'_, 'pr> {
6765
self.sess.synthesize_loop_contracts(goto_file, &goto_file, &harness)?;
6866
}
6967

70-
let result = self.sess.check_harness(goto_file, &report_dir, harness)?;
68+
let result = self.sess.check_harness(goto_file, harness)?;
7169
Ok(HarnessResult { harness, result })
7270
})
7371
.collect::<Result<Vec<_>>>()
@@ -148,24 +146,17 @@ impl KaniSession {
148146
pub(crate) fn check_harness(
149147
&self,
150148
binary: &Path,
151-
report_dir: &Path,
152149
harness: &HarnessMetadata,
153150
) -> Result<VerificationResult> {
154151
if !self.args.common_args.quiet {
155152
println!("Checking harness {}...", harness.pretty_name);
156153
}
157154

158-
if self.args.visualize {
159-
self.run_visualize(binary, report_dir, harness)?;
160-
// Strictly speaking, we're faking success here. This is more "no error"
161-
Ok(VerificationResult::mock_success())
162-
} else {
163-
let mut result = self.with_timer(|| self.run_cbmc(binary, harness), "run_cbmc")?;
155+
let mut result = self.with_timer(|| self.run_cbmc(binary, harness), "run_cbmc")?;
164156

165-
self.process_output(&result, harness);
166-
self.gen_and_add_concrete_playback(harness, &mut result)?;
167-
Ok(result)
168-
}
157+
self.process_output(&result, harness);
158+
self.gen_and_add_concrete_playback(harness, &mut result)?;
159+
Ok(result)
169160
}
170161

171162
/// Concludes a session by printing a summary report and exiting the process with an
@@ -191,7 +182,7 @@ impl KaniSession {
191182
}
192183

193184
// We currently omit a summary if there was just 1 harness
194-
if !self.args.common_args.quiet && !self.args.visualize {
185+
if !self.args.common_args.quiet {
195186
if failing > 0 {
196187
println!("Summary:");
197188
}

kani-driver/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ mod args_toml;
2424
mod assess;
2525
mod call_cargo;
2626
mod call_cbmc;
27-
mod call_cbmc_viewer;
2827
mod call_goto_cc;
2928
mod call_goto_instrument;
3029
mod call_goto_synthesizer;

0 commit comments

Comments
 (0)