test: readiness signals replace sleep-based timing (N4)

- signal tests use a marker-file readiness signal: the child's command
  is 'echo ready > <marker>; exec sleep 60', the test polls
  wait_for_file(marker, 5s) — marker exists = the shell exec'd, so the
  signal lands on the real target regardless of machine load. Applied
  in tests/pty.rs (both signal tests), tests/pipe.rs (SIGTERM), and
  the src/local unit tests; wait_for_file lives in tests/common.
- cancel-cleanup post-action sleeps became bounded polls for the
  child's death (kill(pid,0) -> ESRCH, 5s deadline) — faster and
  flake-proof in both directions.
- resize/cat-stdin tests need no readiness signal at all: the adapter's
  input pump processes chunks in order — the sleeps there were pure
  latency (integration suites now ~40ms, was 200-270ms).
This commit is contained in:
2026-09-05 07:21:30 +00:00
parent a73484203e
commit cdd6893046
6 changed files with 241 additions and 61 deletions
+27 -3
View File
@@ -535,7 +535,7 @@ Highlights:
| L1 | channels `input` ignored | decide drop-vs-pass-through | small | low | ✅ resolved (2026-09-05) |
| L3 | `open_via_channels` 0% covered | end-to-end channels consumer test | medium | low | ✅ resolved (2026-09-05) |
| L6 | pty bridge error paths untested | targeted error-path tests | medium | low | ✅ resolved (2026-09-05) |
| N4 | sleep-based timing | readiness signals | small | low | open |
| N4 | sleep-based timing | readiness signals | small | low | ✅ resolved (2026-09-05) |
| N6 | MSRV unverified | CI MSRV job or bump | small | none | open |
### Resolution (2026-08-17, commit `9944153`)
@@ -652,14 +652,38 @@ warn + return, with no panic. `local/pty.rs` line coverage
documented-unreachable arms plus `StdinSink`'s in-flight-parking path
(a single write cannot fill the 64-slot channel).
### Resolution (2026-09-05, N4 — readiness signals replace fixed sleeps)
The signal tests now use a **marker-file readiness signal** (the
pattern the cancel-cleanup tests already used): the child's command is
`echo ready > <marker>; exec sleep 60`, and the test polls
`wait_for_file(marker, 5s)` — the marker existing means the shell
exec'd, so the signal lands on the real target regardless of machine
load. Applied in `tests/pty.rs` (both signal tests), `tests/pipe.rs`
(SIGTERM test), and the `src/local/` unit tests (`signal_int_kills_child`,
`signal_reaches_process_group_child`, `unknown_signal_*`,
`signal_term_kills_child`). `wait_for_file` lives in
`tests/common/mod.rs`; `src/local/` copies are private test helpers
(separate compilation units).
The fixed **post-action** sleeps in the cancel-cleanup tests (wait
after drop, then probe once) became **bounded polls** for the child's
death (`kill(pid, 0)` → ESRCH) with a 5 s deadline — faster and
flake-proof in both directions.
The resize/cat-stdin tests needed no readiness signal at all: the
adapter's input pump processes chunks in order and `resize` is safe
whenever the control handle exists — the sleeps there were pure
latency. Integration suites now finish in ~40 ms (was 200-270 ms
each).
### Remaining (open)
- **N4** — sleep-based timing in signal/cancel tests.
- **N6** — MSRV unverified.
### Recommended Order (remaining)
1. **N4 + N6** — test hardening and MSRV; defer until CI exists.
1. **N6** — MSRV; defer until CI exists.
---