Skip to content

Commit 83df603

Browse files
karthiknadigCopilot
andcommitted
test: cover composed fixture teardown deadline (Refs #529)
Allow the outer test-process guard to cover readiness, both forced-shutdown waits, reader completion, and fallback cleanup without changing the one-second shutdown assertion. Record the verified subprocess testing pitfalls in the existing Rust skill. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 60d8d5c commit 83df603

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎.github/skills/rust-coding-skill/SKILL.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,7 @@ Before every Rust commit, run targeted tests and invoke the `rust-precommit` ski
9898
## Learnings
9999

100100
Do not execute freshly written scripts as concurrent Unix subprocess fixtures: spawning can fail with `ETXTBSY` (Text file busy). Prefer an existing interpreter such as `/bin/sh -c` with an inline script, or the existing test executable. Assert the typed runner outcome before checking an optional parsed result, so a spawn failure cannot masquerade as a successful negative parsing or timeout test.
101+
102+
For real-pipe EOF/EPIPE tests, create the pipe inside an isolated test subprocess when other test threads spawn children. Unix `CLOEXEC` closes descriptors at exec, not fork: a concurrent child can temporarily retain a reader, allowing the only write to succeed before the final reader disappears. A readiness handshake alone does not prevent this race. Keep the operation's measured deadline separate from setup, and make an outer fixture deadline cover readiness, waits both before and after forced termination, reader joins, and fallback `Drop` cleanup.
103+
104+
Use a per-worktree Cargo target directory when validating stacked changes so native fixtures cannot execute another worktree's stale binary. On WSL, run timing-sensitive Linux binaries from the native Linux filesystem rather than a Windows mount, where page faults can stall in filesystem RPC. When launching instrumented PET with `env_clear()`, retain `LLVM_PROFILE_FILE` exactly so child coverage reaches the collector instead of an uncollected default profile.

‎crates/pet/tests/jsonrpc_server_test.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,8 @@ fn closed_output_exits_without_waiting_for_stdin_eof() {
599599
.stderr(Stdio::inherit())
600600
.spawn()
601601
.expect("isolated closed-output fixture must spawn");
602-
let status = jsonrpc_client::shutdown_fixture(&mut child, Duration::from_secs(20)).unwrap();
602+
// Cover readiness, both forced-shutdown waits, reader joining, and Drop cleanup.
603+
let status = jsonrpc_client::shutdown_fixture(&mut child, Duration::from_secs(40)).unwrap();
603604
assert!(
604605
status.success(),
605606
"isolated closed-output fixture failed: {status}"

0 commit comments

Comments
 (0)