-
Notifications
You must be signed in to change notification settings - Fork 41
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
Goto-transcoder action #236
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# This workflow executes the supported contracts in goto-transcoder | ||
|
||
name: Run GOTO Transcoder (ESBMC) | ||
on: | ||
workflow_dispatch: | ||
merge_group: | ||
pull_request: | ||
branches: [ main ] | ||
push: | ||
paths: | ||
- 'library/**' | ||
- '.github/workflows/goto-transcoder.yml' | ||
- 'scripts/run-kani.sh' | ||
- 'scripts/run-goto-transcoder.sh' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
verify-rust-std: | ||
name: Verify contracts with goto-transcoder | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Step 1: Check out the repository | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
# Step 2: Generate contracts programs | ||
- name: Generate contracts | ||
run: ./scripts/run-kani.sh --kani-args --keep-temps --only-codegen | ||
|
||
# Step 3: Run goto-transcoder | ||
- name: Run goto-transcoder | ||
run: ./scripts/run-goto-transcoder.sh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
############## | ||
# PARAMETERS # | ||
############## | ||
contract_folder=target/kani_verify_std/target/x86_64-unknown-linux-gnu/debug/deps | ||
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. nit... can you pass this as an argument to Kani script and the goto-transcoder script instead of relying here on the location where Kani stores their temporary files? |
||
supported_regex=checked_unchecked.*.out | ||
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 you also make this an argument so users can easily try out their new harnesses. |
||
unsupported_regex=neg | ||
|
||
goto_transcoder_git=https://github.com/rafaelsamenezes/goto-transcoder | ||
esbmc_url=https://github.com/esbmc/esbmc/releases/download/nightly-7867f5e5595b9e181cd36eb9155d1905f87ad241/esbmc-linux.zip | ||
|
||
########## | ||
# SCRIPT # | ||
########## | ||
|
||
echo "Checking contracts with goto-transcoder" | ||
|
||
if [ ! -d "goto-transcoder" ]; then | ||
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 you please add this folder to the git ignore file? |
||
echo "goto-transcoder not found. Downloading..." | ||
git clone $goto_transcoder_git | ||
cd goto-transcoder | ||
wget $esbmc_url | ||
unzip esbmc-linux.zip | ||
chmod +x ./linux-release/bin/esbmc | ||
cd .. | ||
fi | ||
|
||
ls $contract_folder | grep "$supported_regex" | grep -v .symtab.out > ./goto-transcoder/_contracts.txt | ||
|
||
cd goto-transcoder | ||
while IFS= read -r line; do | ||
contract=`echo "$line" | awk '{match($0, /(_RNv.*).out/, arr); print arr[1]}'` | ||
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 you document what this is doing please? |
||
echo "Processing: $contract" | ||
if [[ -z "$contract" ]]; then | ||
continue | ||
fi | ||
if echo "$contract" | grep -q "$unsupported_regex"; then | ||
continue | ||
fi | ||
echo "Running: goto-transcoder $contract $contract_folder/$line $contract.esbmc.goto" | ||
cargo run cbmc2esbmc $contract ../$contract_folder/$line $contract.esbmc.goto | ||
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. does your |
||
./linux-release/bin/esbmc --binary $contract.esbmc.goto | ||
done < "_contracts.txt" | ||
|
||
rm "_contracts.txt" | ||
cd .. |
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.
We need to include a section in our book about the new tool. See Kani example https://model-checking.github.io/verify-rust-std/tools.html