From 411634ad40cda60f18d3d154712cddbac2b89513 Mon Sep 17 00:00:00 2001 From: Everett Date: Wed, 18 Nov 2026 11:53:23 -0800 Subject: [PATCH] Linux tests: wait for a busy executable instead of failing The archive job of the linux-v0.1.4 tag failed once with ETXTBSY: a test ran the program it had just copied while a child of another test still held the copy open for writing. The run started by hand on the same commit passed. Co-Authored-By: Claude Fable 5.2 --- Linux/crates/sw-cli/tests/cli.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Linux/crates/sw-cli/tests/cli.rs b/Linux/crates/sw-cli/tests/cli.rs index 6b490718..e2131c8a 100644 --- a/Linux/crates/sw-cli/tests/cli.rs +++ b/Linux/crates/sw-cli/tests/cli.rs @@ -116,7 +116,19 @@ impl Sandbox { } fn finish(command: &mut Command) -> Outcome { - let output = command.output().expect("the program starts"); + // A test that has just copied the program can find it "busy": while the copy + // was being written another test started a child, and that child still holds + // the file open for writing for a moment. Wait for it instead of failing. + let mut tries = 0; + let output = loop { + match command.output() { + Err(error) if error.kind() == std::io::ErrorKind::ExecutableFileBusy && tries < 200 => { + tries += 1; + std::thread::sleep(std::time::Duration::from_millis(10)); + } + result => break result.expect("the program starts"), + } + }; Outcome { code: output.status.code().expect("the program exits by itself"), stdout: String::from_utf8(output.stdout).expect("UTF-8 output"), stderr: String::from_utf8(output.stderr).expect("UTF-8 errors") } }