Repository navigation
Report the failure exit code under --quiet - #4771
Conversation
`--quiet`'s help text promises "no output, just an exit code and requested artifacts", but `print_final_summary` returned early under `--quiet` before reaching the `exit(1)` that reports failures, so a failing verification run exited 0. Nothing else set the failure exit code. Suppress only the summary output under `--quiet`: compute the failure counts unconditionally and keep the exit code and error returns identical to a non-quiet run. `print_autoharness_summary` takes a `quiet` flag so it still reports its failure count without printing the summary; this also fixes the same bug for `autoharness --quiet`, whose failure count previously never reached the exit code. Add a regression test that runs a failing harness under `--quiet` and asserts exit 1, plus a passing-run control asserting exit 0 -- the existing check-quiet test only ran passing harnesses and never inspected the exit code. Resolves model-checking#4745
0d20f68 to
7644203
Compare
|
earlier CI red was kani-fmt --check wanting a println! collapsed |
celinval
left a comment
There was a problem hiding this comment.
That's a good catch. Thanks for taking the time.
Address review: separate the compute (partition into successes/failing, now behind an autoharness_result() that folds in the autoharness_compiler_flags.is_some() check) from the print (print_autoharness_summary, now a pure void function with no quiet param and no returned count). print_final_summary computes the autoharness result unconditionally and gates only the print on !quiet, then derives the exit code from failing + the computed failing count, unchanged from before. Also drops the now-superfluous comment block above print_final_summary.
acf1c4e to
0b39b0b
Compare
Split the exit-code decision out of print_final_summary into a new conclude step that always runs, and skip the summary print at the call site when --quiet is set (review feedback).
…quiet Address review nits: conclude counts non-successful results directly, so the autoharness_result/AutoharnessResult split is no longer needed and print_autoharness_summary goes back to taking the automatic results, returning nothing. print_final_summary keeps upstream's zero-match arm, so output without --quiet is unchanged; conclude repeats that check for the --quiet path. The check-quiet success line now matches the exact exit code the test requires, and the output check counts bytes so that newline-only output also fails. Also trim the comments this PR added.
Head branch was pushed to by a user without write access
|
@tautschnig updated all. ps found checking the zero match path, not sure if known issue. made no sense to fix it as part of this pr, but if needed can do a separate pr if needed... kani autoharness -Z autoharness repro.rs verifies both and exits 0. The compiler's filtered list includes the automatic harness for add, but the debug-build re-check (find_proof_harnesses) skips automatic harnesses, so the two lists can't match. |
@ivmat nice, this isn't known! I reproduced it on main: the compiler adds automatic harnesses after applying |
9751181
…del-checking#4923) Pass `--harness-timeout 5m` to `script-based-pre/cargo_autoharness_fmt_impls`, as the other autoharness tests (`bounded`, `bounds`, `byte_str`, `c_str`, `formatter`, `wtf8`) already do. **Why.** On the macOS x86_64 runners (`regression (macos-15-intel)`), the `LowerExp`, `UpperExp` and `Pointer` harnesses of this test take 40–60 s, right at `kani autoharness`'s default `--harness-timeout` of 60 s. When one of them times out, CBMC reports `CBMC timed out` instead of the expected failure, the test's `Failed Checks: "lower exp"` / `"upper exp"` / `"pointer"` line is missing, and the test fails. The same harnesses take about 10 s on Linux. **Evidence.** I went through the logs of the `regression (macos-15-intel)` jobs between 2026-09-28 and 2026-09-30. 33 of them failed. This test failed in all 33, with 1–3 of those three harnesses timing out each time, and in 32 of them it was the only failing test. The one exception, model-checking#4903's merge-queue push run, also had `cargo_autoharness_wtf8`'s `len` harness time out, at 5 m. On main pushes alone, the job failed 7 times out of 12 on 2026-09-30. The failures are independent of the changes under test: - Today's automated toolchain upgrade, model-checking#4917: [run 36663872235](https://github.com/model-checking/kani/actions/runs/36663872235/job/109726991201) (`LowExp`, `UpExp`, `Ptr` timed out; every other regression job passed) - `main` pushes: [36654469481](https://github.com/model-checking/kani/actions/runs/36654469481/job/109695682794), [36656240395](https://github.com/model-checking/kani/actions/runs/36656240395/job/109701095388), [36657849257](https://github.com/model-checking/kani/actions/runs/36657849257/job/109705923680), [36659060566](https://github.com/model-checking/kani/actions/runs/36659060566/job/109709545862), [36670355214](https://github.com/model-checking/kani/actions/runs/36670355214/job/109743820142), [36674524840](https://github.com/model-checking/kani/actions/runs/36674524840/job/109756493668) - Merge queue: model-checking#4895 [36650793954](https://github.com/model-checking/kani/actions/runs/36650793954/job/109684194253), model-checking#4896 [36650908721](https://github.com/model-checking/kani/actions/runs/36650908721/job/109684568489), model-checking#4809 [36654883143](https://github.com/model-checking/kani/actions/runs/36654883143/job/109696960300), model-checking#4848 [36663305755](https://github.com/model-checking/kani/actions/runs/36663305755/job/109722546228), model-checking#4903 [36667236036](https://github.com/model-checking/kani/actions/runs/36667236036/job/109734401431), model-checking#4856 [36670723600](https://github.com/model-checking/kani/actions/runs/36670723600/job/109744937944), model-checking#4881 [36596324505](https://github.com/model-checking/kani/actions/runs/36596324505/job/109502054372), model-checking#4882 [36612997613](https://github.com/model-checking/kani/actions/runs/36612997613/job/109558873539) - Pull requests: model-checking#4875 [36427316996](https://github.com/model-checking/kani/actions/runs/36427316996/job/109072277288), model-checking#4895 [36443349794](https://github.com/model-checking/kani/actions/runs/36443349794/job/108999214513), model-checking#4771 [36620184925](https://github.com/model-checking/kani/actions/runs/36620184925/job/109677883533) The runner image version (`20260819.586`) was the same in passing and failing runs. **Manual testing.** Locally the three harnesses take about 10 s each. Running the test with `--harness-timeout 3s` reproduces the CI failure exactly: the same three harnesses time out, their `Failed Checks` lines are missing, and the summary still reports 9 failures. With this change, `cargo run -p compiletest -- --suite script-based-pre --mode exec cargo_autoharness_fmt_impls` passes. If the macOS Intel runner gets much slower, a longer timeout alone may not be enough; making these three harnesses cheaper would be the next step. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses. Co-authored-by: Kiro <[email protected]>
Resolves #4745.
--quiet's help text promises "Produces no output, just an exit code and requested artifacts", butprint_final_summaryreturned early under--quiet, before theexit(1)that reports failures, so afailing verification run exited 0.
This separates printing from the exit decision:
verify_projectskipsprint_final_summaryunder--quiet;print_final_summaryonly prints.concludestep always runs and exits with code 1 if any harness, manual or automatic, failed.Under
--quietit also raises the zero-match--harnesserror thatprint_final_summaryraises otherwise.print_autoharness_summaryonly prints; it no longer returns a failure count.Without
--quiet, output and exit codes are unchanged.Behavior under
--quiet, before → afterautoharnessrun: exit 0 → exit 1 (same root cause).kani autoharness --harness <name matching no manual harness>: exit 0 with no output → the no-matcherror on stdout and a non-zero exit, as the zero-match error from
determine_targetsalready does under--quiet.Test
Extends
tests/script-based-pre/check-quiet: a passing harness must produce no output and exit 0, and afailing harness must produce no output and exit 1. It counts the bytes of stdout and stderr together, so
any output fails the test. The
autoharnesscases above follow from the sameconcludecode path and arenot tested separately.