Repository navigation
test: write fake executables from a child so parallel tests cannot make them busy - #189
Merged
Merged
Conversation
…ke them busy
Five lib fixtures wrote a script in-process and then exec'd it. A sibling
test thread that forks during the write inherits the write descriptor until
it execs, so the exec fails with ETXTBSY ("Text file busy"). Main 6409674
went red on two of them.
test_exec::write_executable writes through a short-lived sh child, so this
process never holds the descriptor and no fork can inherit it.
Before: 12/200 full-lib runs failed at --test-threads=8 (four tests; the
seeds one confirmed as Text file busy). After: 0/500.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BzgSY2LpdGhBhb7D1nHbiF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A test-only helper,
test_exec::write_executable, now writes every lib fixture that is written as a script and then exec'd. Five fixtures use it.Why
mainwent red onadapter::quipu_alias_layout_testswithText file busy (os error 26), on a docs-only commit. This is the parallel-test fork race:O_CLOEXECdoes not close the window between fork and exec.The helper writes through a short-lived
sh -c 'cat > "$1"'child. This process never holds the write descriptor, so no fork can inherit it, and the file has no writer once the child exits. That removes the race instead of retrying around it. A retry would have to go at each call site, because every exec here happens inside the code under test (read_version,identify,owner_with, dpapply/verify).The population was wider than the two failing tests
Reproduced on unmodified
mainover 200 full-lib runs at--test-threads=8: 12 runs failed, across four tests:seeds_identity_accepts_both_editions_and_refuses_foreign_sd: 8;owned_layout_with_qp_beside_quipu_still_passes: 2;package_managed_layout_passes_with_qp_beside_the_resolved_quipu: 1;dp_alias::tests::keeps_a_different_local_target: 1.The seeds test hides its error behind
.is_ok(). With the error printed temporarily, all 6 sampled failures wereText file busy. After the first fix pass, a 300-run control surfaced one more,apt_owned(same pattern; its error is swallowed by.ok()?), so that fixture and the rollback ones are converted too.Evidence
--test-threads=8.--test-threads=8.cargo test --all-features: 0 failed.cargo clippy --all-targets --all-features -- -D warningsandcargo fmt --checkare clean.Not in this PR
Integration tests under
tests/have their own write-then-exec fixtures, in separate binaries, and cannot use acfg(test)lib helper. None failed in CI or locally. They are noted on the item rather than changed here.Rollback
Revert. Test code only; no runtime change.
🤖 Generated with Claude Code
https://claude.ai/code/session_01BzgSY2LpdGhBhb7D1nHbiF