-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include Kissat in the Kani bundle (#2087)
- Loading branch information
1 parent
c90f447
commit 326b35e
Showing
11 changed files
with
128 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
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 |
---|---|---|
@@ -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" |
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,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 |
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,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 | ||
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 |
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,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" ] |
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,2 @@ | ||
Solving with External SAT solver | ||
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,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() {} |
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