Skip to content

Commit

Permalink
Allow cargo-kani to run outside a Cargo project (rust-lang#1192)
Browse files Browse the repository at this point in the history
* Allow cargo-kani to run outside a Cargo project

* Add test in docker
  • Loading branch information
tedinski authored May 11, 2022
1 parent 8c848e2 commit 0805270
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/kani.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ jobs:
- name: Run installed tests
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: |
docker run kani-latest cargo kani --version
docker run -w /tmp/kani/tests/cargo-kani/simple-lib kani-latest cargo kani
docker run -w /tmp/kani/tests/cargo-kani/simple-visualize kani-latest cargo kani
docker run -w /tmp/kani/tests/cargo-kani/build-rs-works kani-latest cargo kani
Expand Down
7 changes: 6 additions & 1 deletion kani-driver/src/args_toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ use toml::Value;
///
/// The arguments passed via command line have precedence over the ones from the Cargo.toml.
pub fn join_args(input_args: Vec<OsString>) -> Result<Vec<OsString>> {
let file = std::fs::read_to_string(cargo_locate_project()?)?;
let toml_path = cargo_locate_project();
if toml_path.is_err() {
// We're not inside a Cargo project. Don't error... yet.
return Ok(input_args);
}
let file = std::fs::read_to_string(toml_path?)?;
let (kani_args, cbmc_args) = toml_to_args(&file)?;
merge_args(input_args, kani_args, cbmc_args)
}
Expand Down

0 comments on commit 0805270

Please sign in to comment.