Skip to content
Merged
Changes from 1 commit
Commits
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
15 changes: 14 additions & 1 deletion scripts/std-lib-regression.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fi

# Get Kani root
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
KANI_DIR=$SCRIPT_DIR/..
KANI_DIR=$(dirname "$SCRIPT_DIR")

echo
echo "Starting Kani codegen for the Rust standard library..."
Expand All @@ -39,6 +39,19 @@ fi
cargo new std_lib_test --lib
cd std_lib_test

# Add some content to the rust file including an std function that is non-generic.
echo '
#[kani::proof]
fn check_format() {
assert!("2021".parse::<u32>().unwrap() == 2021);
}
' > src/lib.rs

# Until we add support to this via our bundle, rebuild the kani library too.
echo "
kani = {path=\"${KANI_DIR}/library/kani\"}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a bit fragile since it depends on adding kani under the [dependencies] section. Perhaps in a future PR, we can rely on https://github.com/killercup/cargo-edit instead?

Copy link
Copy Markdown
Contributor Author

@celinval celinval Jul 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this is rather fragile. TBH, I'm really hoping this script will be temporary. We need a better story for std distribution ASAP. Once we do have that, this script should go away and we will likely build (and distribute) the std.

" >> Cargo.toml

# Use same nightly toolchain used to build Kani
cp ${KANI_DIR}/rust-toolchain.toml .

Expand Down