Skip to content

Parse log file of multi-threaded Kani run (terse output) into JSON #324

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
4 changes: 3 additions & 1 deletion .github/workflows/kani-metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:
python-version: '3.x'

- name: Compute Kani Metrics
run: ./scripts/run-kani.sh --run metrics --with-autoharness --path ${{github.workspace}}
run: |
./scripts/run-kani.sh --run metrics --with-autoharness --path ${{github.workspace}}
rm kani-list.json

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
Expand Down
118 changes: 116 additions & 2 deletions .github/workflows/kani.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Run Kani Verification
run: head/scripts/run-kani.sh --path ${{github.workspace}}/head

kani-autoharness:
kani_autoharness:
name: Verify std library using autoharness
runs-on: ${{ matrix.os }}
strategy:
Expand Down Expand Up @@ -124,7 +124,121 @@ jobs:
--exclude-pattern ::precondition_check \
--harness-timeout 5m \
--default-unwind 1000 \
--jobs=3 --output-format=terse
--jobs=3 --output-format=terse | tee autoharness-verification.log
gzip autoharness-verification.log

- name: Upload Autoharness Verification Log
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-autoharness-verification.log.gz
path: autoharness-verification.log.gz
if-no-files-found: error
# Aggressively short retention: we don't really need these
retention-days: 3

run_kani_metrics:
name: Kani Metrics
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
base: ubuntu
- os: macos-latest
base: macos
fail-fast: true

steps:
# Step 1: Check out the repository
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: true

# The Kani metrics collection uses a Python script (kani_std_analysis.py), so make sure Python is installed
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

# Step 2: Run list on the std library
- name: Run Kani Metrics
run: |
scripts/run-kani.sh --run metrics --with-autoharness
pushd /tmp/std_lib_analysis
tar czf results.tar.gz results
popd

- name: Upload kani-list.json
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-kani-list.json
path: kani-list.json
if-no-files-found: error
# Aggressively short retention: we don't really need these
retention-days: 3

- name: Upload scanner results
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-results.tar.gz
path: /tmp/std_lib_analysis/results.tar.gz
if-no-files-found: error
# Aggressively short retention: we don't really need these
retention-days: 3

run-log-analysis:
name: Build JSON from logs
needs: [run_kani_metrics, kani_autoharness]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
base: ubuntu
- os: macos-latest
base: macos
fail-fast: false

steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: false

- name: Download log
uses: actions/download-artifact@v4
with:
name: ${{ matrix.os }}-autoharness-verification.log.gz

- name: Download kani-list.json
uses: actions/download-artifact@v4
with:
name: ${{ matrix.os }}-kani-list.json

- name: Download scanner results
uses: actions/download-artifact@v4
with:
name: ${{ matrix.os }}-results.tar.gz

- name: Run log parser
run: |
gunzip autoharness-verification.log.gz
tar xzf results.tar.gz
python3 scripts/kani-std-analysis/log_parser.py \
--kani-list-file kani-list.json \
--analysis-results-dir results/ \
autoharness-verification.log \
-o results.json

- name: Upload JSON
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-results.json
path: results.json
if-no-files-found: error

run-kani-list:
name: Kani List
Expand Down
Loading
Loading