Skip to content

Print nextest-style cancellation banner on Ctrl+C#764

Open
MatthewMckee4 wants to merge 7 commits into
mainfrom
nextest-style-cancellation
Open

Print nextest-style cancellation banner on Ctrl+C#764
MatthewMckee4 wants to merge 7 commits into
mainfrom
nextest-style-cancellation

Conversation

@MatthewMckee4
Copy link
Copy Markdown
Owner

Summary

Pressing Ctrl+C during a test run used to terminate karva with no
indication of what was cut short. The orchestrator now mirrors nextest:
when a SIGINT is received it prints Cancelling due to interrupt: N tests still running and, before killing each remaining worker, emits a
SIGINT [duration] worker N (M tests) line in the same column layout as
the PASS/FAIL lines. The cancellation banner is only emitted on
genuine interrupts; fail-fast shutdowns continue to be silent at the
orchestrator level. The Ctrl+C handler is now installed at the top of
run_parallel_tests rather than after worker spawn so an early SIGINT
during collection or partitioning no longer slips through to the default
disposition.

Sample output:

    Starting 13 tests across 3 workers
  Cancelling due to interrupt: 13 tests still running
      SIGINT [   2.970s] worker 0 (5 tests)
      SIGINT [   2.970s] worker 1 (4 tests)
      SIGINT [   2.969s] worker 2 (4 tests)

The reported test count is per-worker (each worker's assigned partition
size). Workers only flush results to the cache on exit, so the
orchestrator can't see which individual tests have already completed
inside a still-running worker; the count is therefore an upper bound on
tests still in flight.

Test Plan

New unix-only integration test in crates/karva/tests/it/cancel.rs
spawns karva on a 60s-sleeping test, sends SIGINT via kill -s INT,
and asserts both the cancellation banner and a SIGINT line appear in
stdout. just test and uvx prek run -a pass.

@MatthewMckee4 MatthewMckee4 added diagnostics Related to diagnostics and output of Karva parallelism Related to test parallelism, partitioning, and concurrency labels May 5, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 5, 2026

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 1 untouched benchmark


Comparing nextest-style-cancellation (69cd108) with main (eb3c800)

Open in CodSpeed

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

Labels

diagnostics Related to diagnostics and output of Karva parallelism Related to test parallelism, partitioning, and concurrency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant