Repository navigation
Include Kissat in the Kani bundle #2087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d135ff7
6f69847
c4c8cd2
e0e65cd
54808d8
92ea9df
8f64c4f
0bd5d6a
1186952
75a2b29
f02b6de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ In general, the following dependencies are required to build Kani from source. | |
| 1. Cargo installed via [rustup](https://rustup.rs/) | ||
| 2. [CBMC](https://github.com/diffblue/cbmc) (latest release) | ||
| 3. [CBMC Viewer](https://github.com/awslabs/aws-viewer-for-cbmc) (latest release) | ||
| 4. [Kissat](https://github.com/arminbiere/kissat) (Release 3.0.0) | ||
|
|
||
| Kani has been tested in [Ubuntu](#install-dependencies-on-ubuntu) and [macOS](##install-dependencies-on-macos) platforms. | ||
|
|
||
|
|
@@ -30,6 +31,7 @@ git submodule update --init | |
| ./scripts/setup/ubuntu/install_deps.sh | ||
| ./scripts/setup/ubuntu/install_cbmc.sh | ||
| ./scripts/setup/ubuntu/install_viewer.sh | ||
| ./scripts/setup/install_kissat.sh | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we make the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll do this in a follow-up PR. |
||
| # If you haven't already (or from https://rustup.rs/): | ||
| ./scripts/setup/install_rustup.sh | ||
| source $HOME/.cargo/env | ||
|
|
@@ -47,6 +49,7 @@ git submodule update --init | |
| ./scripts/setup/macos/install_deps.sh | ||
| ./scripts/setup/macos/install_cbmc.sh | ||
| ./scripts/setup/macos/install_viewer.sh | ||
| ./scripts/setup/install_kissat.sh | ||
| # If you haven't already (or from https://rustup.rs/): | ||
| ./scripts/setup/install_rustup.sh | ||
| source $HOME/.cargo/env | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| CBMC_VERSION="5.75.0" | ||
| # If you update this version number, remember to bump it in `src/setup.rs` too | ||
| CBMC_VIEWER_VERSION="3.8" | ||
| KISSAT_VERSION="3.0.0" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #!/usr/bin/env bash | ||
| # Copyright Kani Contributors | ||
| # SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
|
||
| # Check if kissat has the minimum required version specified in the | ||
| # `kani_dependencies` file under kani's root folder | ||
|
|
||
| SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
| KANI_DIR=$SCRIPT_DIR/.. | ||
| source "${KANI_DIR}/kani-dependencies" | ||
|
|
||
| if [ -z "${KISSAT_VERSION:-}" ]; then | ||
| echo "$0: ERROR: KISSAT_VERSION is not set" | ||
| return 1 | ||
| fi | ||
| cmd="kissat --version" | ||
| if kissat_version=$($cmd); then | ||
| # Perform a lexicographic comparison of the version | ||
| if [[ $kissat_version < $KISSAT_VERSION ]]; then | ||
| echo "ERROR: Kissat version is $kissat_version. Expected at least $KISSAT_VERSION." | ||
| return 1 | ||
| fi | ||
| else | ||
| echo "ERROR: Couldn't run command '$cmd'" | ||
| return 1 | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #!/bin/bash | ||
| # Copyright Kani Contributors | ||
| # SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
|
||
| set -eu | ||
|
|
||
| # Source kani-dependencies to get KISSAT_VERSION | ||
| source kani-dependencies | ||
|
|
||
| if [ -z "${KISSAT_VERSION:-}" ]; then | ||
| echo "$0: Error: KISSAT_VERSION is not specified" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Check if the correct Kissat version is already installed | ||
| if command -v kissat > /dev/null; then | ||
| if kissat_version=$(kissat --version); then | ||
| if [[ $kissat_version == $KISSAT_VERSION ]]; then | ||
| # Already installed | ||
| exit 0 | ||
| else | ||
| echo "Warning: Overriding Kissat version ${kissat_version} with ${KISSAT_VERSION}" | ||
| fi | ||
| fi | ||
| fi | ||
|
|
||
| # Kissat release | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we check if the version is already installed first?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea. Done. |
||
| FILE="rel-${KISSAT_VERSION}.tar.gz" | ||
| URL="https://github.com/arminbiere/kissat/archive/refs/tags/$FILE" | ||
|
|
||
| set -x | ||
|
|
||
| wget -O "$FILE" "$URL" | ||
| tar -xvzf $FILE | ||
| DIR_NAME="kissat-rel-${KISSAT_VERSION}" | ||
| cd $DIR_NAME | ||
| ./configure && make kissat && sudo install build/kissat /usr/local/bin | ||
| cd - | ||
|
|
||
| # Clean up on success | ||
| rm $FILE | ||
| rm -rf $DIR_NAME | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Copyright Kani Contributors | ||
| # SPDX-License-Identifier: Apache-2.0 OR MIT | ||
| [package] | ||
| name = "simple-kissat" | ||
| version = "0.1.0" | ||
| edition = "2021" | ||
| description = "Tests that Kani can be invoked with Kissat" | ||
|
|
||
| # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
|
||
| [dependencies] | ||
|
|
||
| [kani.flags] | ||
| enable-unstable = true | ||
| cbmc-args = ["--external-sat-solver", "kissat" ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Solving with External SAT solver | ||
| VERIFICATION:- SUCCESSFUL |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // Copyright Kani Contributors | ||
| // SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
|
||
| //! This test checks that concatenating two nondet arrays into a vector | ||
| //! preserves the values | ||
|
|
||
| #[kani::proof] | ||
| fn check_concat() { | ||
| let arr1: [i32; 2] = kani::any(); | ||
| let arr2: [i32; 3] = kani::any(); | ||
| let mut v = Vec::new(); | ||
| v.extend_from_slice(&arr1); | ||
| v.extend_from_slice(&arr2); | ||
| assert_eq!(v[0], arr1[0]); | ||
| assert_eq!(v[1], arr1[1]); | ||
| assert_eq!(v[2], arr2[0]); | ||
| assert_eq!(v[3], arr2[1]); | ||
| assert_eq!(v[4], arr2[2]); | ||
| } | ||
|
|
||
| fn main() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should also be a separate script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do this one as well in a follow-up PR.