Skip to content

Add autoharness-analyzer CI job #344

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

Merged
merged 10 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
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
18 changes: 18 additions & 0 deletions .github/workflows/kani.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,21 @@ jobs:
.addHeading('Kani List Output', 2)
.addRaw(kaniOutput, false)
.write();

run-autoharness-analyzer:
name: Kani Autoharness Analyzer
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: true

# Step 2: Run autoharness analyzer on the std library
- name: Run Autoharness Analyzer
run: scripts/run-kani.sh --run autoharness-analyzer

# Step 3: Add output to job summary
- name: Add Autoharness Analyzer output to job summary
run: cat autoharness_analyzer/autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
26 changes: 24 additions & 2 deletions scripts/run-kani.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ usage() {
echo "Options:"
echo " -h, --help Show this help message"
echo " -p, --path <path> Optional: Specify a path to a copy of the std library. For example, if you want to run the script from an outside directory."
echo " --run <verify-std|list|metrics> Optional: Specify whether to run the 'kani verify-std' command, 'kani list' command, or collect Kani-specific metrics. Defaults to 'verify-std' if not specified."
echo " --run <verify-std|list|metrics|autoharness-analyzer> Optional: Specify whether to run the 'kani verify-std' command, 'kani list' command, collect Kani-specific metrics, or summarize autoharness failure reasons. Defaults to 'verify-std' if not specified."
echo " --kani-args <command arguments to kani> Optional: Arguments to pass to the command. Simply pass them in the same way you would to the Kani binary. This should be the last argument."
exit 1
}
Expand All @@ -34,7 +34,7 @@ while [[ $# -gt 0 ]]; do
fi
;;
--run)
if [[ -n $2 && ($2 == "verify-std" || $2 == "list" || $2 == "metrics") ]]; then
if [[ -n $2 && ($2 == "verify-std" || $2 == "list" || $2 == "metrics" || $2 == "autoharness-analyzer") ]]; then
run_command=$2
shift 2
else
Expand Down Expand Up @@ -317,6 +317,28 @@ main() {
--metrics-file metrics-data-std.json
popd
rm kani-list.json
elif [[ "$run_command" == "autoharness-analyzer" ]]; then
echo "Running Kani autoharness codegen command..."
"$kani_path" autoharness -Z autoharness -Z unstable-options --std ./library \
--only-codegen -j --output-format=terse \
$unstable_args \
--no-assert-contracts \
$command_args \
--enable-unstable \
--cbmc-args --object-bits 12
# remove metadata file for Kani-generated "dummy" crate that we won't
# get scanner data for
rm target/kani_verify_std/target/x86_64-unknown-linux-gnu/debug/deps/dummy-*
echo "Running Kani's std-analysis command..."
pushd scripts/kani-std-analysis
./std-analysis.sh $build_dir
popd
echo "Running autoharness-analyzer command..."
git clone https://github.com/carolynzech/autoharness_analyzer
cd autoharness_analyzer
cargo run \
../target/kani_verify_std/target/x86_64-unknown-linux-gnu/debug/deps/ \
/tmp/std_lib_analysis/results/
fi
}

Expand Down
Loading