Skip to content

Commit f1aaa87

Browse files
authored
Add autoharness-analyzer CI job (model-checking#344)
Run https://github.com/carolynzech/autoharness_analyzer and push its results to the job summary. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
1 parent 29f7a35 commit f1aaa87

File tree

2 files changed

+54
-2
lines changed

2 files changed

+54
-2
lines changed

.github/workflows/kani.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,30 @@ jobs:
7979
.addHeading('Kani List Output', 2)
8080
.addRaw(kaniOutput, false)
8181
.write();
82+
83+
run-autoharness-analyzer:
84+
name: Kani Autoharness Analyzer
85+
runs-on: ubuntu-latest
86+
steps:
87+
# Step 1: Check out the repository
88+
- name: Checkout Repository
89+
uses: actions/checkout@v4
90+
with:
91+
submodules: true
92+
93+
# Step 2: Run autoharness analyzer on the std library
94+
- name: Run Autoharness Analyzer
95+
run: scripts/run-kani.sh --run autoharness-analyzer
96+
97+
# Step 3: Add output to job summary
98+
- name: Add Autoharness Analyzer output to job summary
99+
run: |
100+
echo "# Autoharness Failure Summary" >> "$GITHUB_STEP_SUMMARY"
101+
echo "## Crate core, all functions" >> "$GITHUB_STEP_SUMMARY"
102+
cat autoharness_analyzer/core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
103+
echo "## Crate core, unsafe functions" >> "$GITHUB_STEP_SUMMARY"
104+
cat autoharness_analyzer/core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
105+
echo "## Crate std, all functions" >> "$GITHUB_STEP_SUMMARY"
106+
cat autoharness_analyzer/std_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
107+
echo "## Crate std, unsafe functions" >> "$GITHUB_STEP_SUMMARY"
108+
cat autoharness_analyzer/std_unsafe_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"

scripts/run-kani.sh

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ usage() {
77
echo "Options:"
88
echo " -h, --help Show this help message"
99
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."
10-
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."
10+
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."
1111
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."
1212
exit 1
1313
}
@@ -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-analyzer") ]]; then
3838
run_command=$2
3939
shift 2
4040
else
@@ -317,6 +317,31 @@ main() {
317317
--metrics-file metrics-data-std.json
318318
popd
319319
rm kani-list.json
320+
elif [[ "$run_command" == "autoharness-analyzer" ]]; then
321+
echo "Running Kani autoharness codegen command..."
322+
"$kani_path" autoharness -Z autoharness -Z unstable-options --std ./library \
323+
--only-codegen -j --output-format=terse \
324+
$unstable_args \
325+
--no-assert-contracts \
326+
$command_args \
327+
--enable-unstable \
328+
--cbmc-args --object-bits 12
329+
# remove metadata file for Kani-generated "dummy" crate that we won't
330+
# get scanner data for
331+
rm target/kani_verify_std/target/x86_64-unknown-linux-gnu/debug/deps/dummy-*
332+
echo "Running Kani's std-analysis command..."
333+
pushd scripts/kani-std-analysis
334+
./std-analysis.sh $build_dir
335+
popd
336+
echo "Running autoharness-analyzer command..."
337+
git clone --depth 1 https://github.com/carolynzech/autoharness_analyzer
338+
cd autoharness_analyzer
339+
cargo run -- --per-crate \
340+
../target/kani_verify_std/target/x86_64-unknown-linux-gnu/debug/deps/ \
341+
/tmp/std_lib_analysis/results/
342+
cargo run -- --per-crate --unsafe-fns-only \
343+
../target/kani_verify_std/target/x86_64-unknown-linux-gnu/debug/deps/ \
344+
/tmp/std_lib_analysis/results/
320345
fi
321346
}
322347

0 commit comments

Comments
 (0)