Skip to content

[bpf-ci-bot] VM crash (exit code 2) silently skips all test result reporting #521

Description

@kernel-patches-review-bot

Summary

When vmtest exits non-zero (VM crash, kernel panic, timeout), the ERR trap in
run.sh fires immediately, skipping all post-processing: exitstatus collection,
kernel splat checks, JSON summaries, and the final results table. Developers see
only "Process completed with exit code 2" with zero diagnostic information.

Failure Details

Root Cause Analysis

run.sh line 4 sets trap 'exit 2' ERR, which causes immediate script
termination on any unhandled command failure. At line 115, vmtest is called
without the && true guard that is already used elsewhere in the same file
(line 72 for bpftool checks) and in run-bpf-selftests.sh (line 54 for
individual test execution).

When vmtest returns non-zero (because the VM crashed, the kernel panicked, or
the guest timed out), the ERR trap fires at line 115 and the script exits with
code 2 immediately. Lines 120-166 — which handle kernel splat reporting,
exitstatus file parsing, JSON summary generation, and the human-readable results
table — are never reached.

This means:

  1. The exitstatus file is never read, so per-test pass/fail is lost
  2. kernel_splats.log is never checked, so splat annotations are never emitted
  3. test_*.json summaries are never printed to GITHUB_STEP_SUMMARY
  4. The final "Test Results" table is never printed
  5. The exit code is always 2 (ERR trap), not the actual test exit status

The && true pattern is the established idiom in this codebase for preventing
the ERR trap from firing while preserving the exit code in $?. The bpftool
check block (lines 68-79) demonstrates the exact same pattern with an
explanatory comment.

Proposed Fix

Add the && true guard to the vmtest invocation and capture its exit code.
If vmtest failed, emit a GitHub Actions warning annotation and write the failure
to the exitstatus file so the existing awk-based status collection correctly
reports the failure.

See: output/0001-ci-run-vmtest-preserve-test-results-on-VM-crash.patch

The fix is 6 lines of added code and follows existing patterns in the file
exactly. No behavioral change occurs when vmtest succeeds (exit code 0).

Impact

Without this fix, any VM crash, kernel panic, or guest timeout produces a
completely opaque "exit code 2" failure. Developers must manually re-run the
job or dig through raw logs to find what happened. With the fix, the existing
post-processing pipeline runs normally: per-test results are reported, kernel
splats are checked, and the JSON summary is written — even when the VM itself
had problems.

References

  • ci/run-vmtest/run.sh:4 — ERR trap definition
  • ci/run-vmtest/run.sh:72 — existing && true pattern (bpftool checks)
  • ci/run-vmtest/run-bpf-selftests.sh:54 — existing && true pattern (test execution)
  • ci/run-vmtest/run.sh:115 — bare vmtest call (the bug)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions