Repository navigation
test(services): run bash -c directly in process tests to avoid ETXTBSY (#1351) - #1357
avantikonde wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 4deb9e6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Confidence Score: 5/5
[Low impact] The PR appears safe to merge.
|
|
Thank you for this — you diagnosed the race from the failure alone and shipped a fix faster than the issue had been open. @cameri has chosen to keep the atomic-write approach instead: #1358 stages the shim in a temp file and renames it into place, keeping the helper rather than replacing it with Closing this as superseded rather than leaving it to rot. If the race ever comes back through the narrow fork/exec window, the |
Description
Replaces the temporary executable script shims in
crates/nostream-services/src/process.rs(a_slow_child_times_outandrun_answers_the_child_exit_code_and_capture_answers_its_output) with direct/bin/bash -cinvocations, eliminating the parallelfork()/O_WRONLYETXTBSYrace without adding retries or serializing tests.Related Issue
Closes #1351
Motivation and Context
Under parallel test execution (
--test-threads=8), another test'sCommand::spawn(fork()) could inherit the writable file descriptor opened byshim()'sstd::fs::writebeforeclose()completed and holdi_writecount > 0on that inode until the other childexecve'd, causingETXTBSY("Text file busy") whenrun_answers_the_child_exit_code_and_capture_answers_its_outputspawnedenv-check. (Becausestd::fs::renamepreserves the inode on the same filesystem, staging via a temp file + rename would still leave that samefork()window open on the inode.)Invoking
/bin/bash -cdirectly (usingexec sleep 30ina_slow_child_times_outsokill_on_dropkillssleepdirectly) tests the exact samerun/captureenv, argument, exit-code, stdout, and timeout behavior while never opening any executed binary for writing.How Has This Been Tested?
for i in $(seq 1 20); do cargo test -q -p nostream-services --lib -- --test-threads=8; done(20/20 passed)nostream-servicestest suite (cargo test -p nostream-services): 117 passed, 0 failed across all 14 targets.cargo fmt --all --checkcargo clippy -p nostream-services --all-targets --all-features -- -D warnings-D clippy::unwrap_used -D clippy::expect_used -D clippy::todo -D clippy::unimplemented -D clippy::panicTypes of changes
Checklist: