Skip to content

Commit 445a381

Browse files
committed
Add autoharness to run-kani script and use in CI
For now, do not run any actual harnesses.
1 parent 3b80a4c commit 445a381

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

.github/workflows/kani.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,36 @@ jobs:
5353
- name: Run Kani Verification
5454
run: head/scripts/run-kani.sh --path ${{github.workspace}}/head
5555

56+
kani-autoharness:
57+
name: Verify std library using autoharness
58+
runs-on: ${{ matrix.os }}
59+
strategy:
60+
matrix:
61+
os: [ubuntu-latest, macos-latest]
62+
include:
63+
- os: ubuntu-latest
64+
base: ubuntu
65+
- os: macos-latest
66+
base: macos
67+
fail-fast: false
68+
69+
steps:
70+
# Step 1: Check out the repository
71+
- name: Checkout Repository
72+
uses: actions/checkout@v4
73+
with:
74+
submodules: true
75+
76+
# Step 2: Run Kani autoharness on the std library for selected functions.
77+
# Uses "--include-pattern no::such::function" to make sure we do not try
78+
# to run across all possible functions as that may take a lot longer than
79+
# expected
80+
- name: Run Kani Verification
81+
run: |
82+
scripts/run-kani.sh --run autoharness --kani-args \
83+
--include-pattern no:such::function:: \
84+
--jobs=3 --output-format=terse
85+
5686
run-kani-list:
5787
name: Kani List
5888
runs-on: ubuntu-latest

scripts/run-kani.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ while [[ $# -gt 0 ]]; do
3434
fi
3535
;;
3636
--run)
37-
if [[ -n $2 && ($2 == "verify-std" || $2 == "list" || $2 == "metrics") ]]; then
37+
if [[ -n $2 && ($2 == "verify-std" || $2 == "list" || $2 == "metrics" || $2 == "autoharness") ]]; then
3838
run_command=$2
3939
shift 2
4040
else
@@ -297,13 +297,23 @@ main() {
297297
--enable-unstable \
298298
--cbmc-args --object-bits 12
299299
fi
300+
elif [[ "$run_command" == "autoharness" ]]; then
301+
# Run verification for a subset of automatically generated harnesses
302+
# (not in parallel)
303+
echo "Running Kani autoharness command..."
304+
"$kani_path" autoharness -Z autoharness -Z unstable-options --std ./library \
305+
$unstable_args \
306+
--no-assert-contracts \
307+
$command_args \
308+
--enable-unstable \
309+
--cbmc-args --object-bits 12
300310
elif [[ "$run_command" == "list" ]]; then
301311
echo "Running Kani list command..."
302-
"$kani_path" list -Z list $unstable_args ./library --std --format markdown
312+
"$kani_path" autoharness -Z autoharness --list -Z list $unstable_args --std ./library --format markdown
303313
elif [[ "$run_command" == "metrics" ]]; then
304314
local current_dir=$(pwd)
305315
echo "Running Kani list command..."
306-
"$kani_path" list -Z list $unstable_args ./library --std --format json
316+
"$kani_path" autoharness -Z autoharness --list -Z list $unstable_args --std ./library --format json
307317
pushd scripts/kani-std-analysis
308318
echo "Running Kani's std-analysis command..."
309319
./std-analysis.sh $build_dir

0 commit comments

Comments
 (0)