From 42e11e4c1f9c315869092ee8c6b7334bf47783c9 Mon Sep 17 00:00:00 2001 From: Fengzdadi <453788063@qq.com> Date: Sun, 15 Nov 2026 23:45:59 -0500 Subject: [PATCH] test(gateway): find the child's listen marker after libtest's test-name prefix With one test thread, libtest prints "test ... " without a newline before the test body runs, so the child's "LISTEN " line arrives as "test shutdown::tests::stalled_process_child ... LISTEN ". The parent matched the marker as a line prefix, never saw it, and timed out after 5 s. GitHub-hosted runners have several CPUs and passed; the self-hosted runner used for master pushes and the nightly runs one test thread, so both default-watchdog tests failed there on every run since #2538. Pin the child to --test-threads=1 so every host produces the same output, and match the marker anywhere in the line. --- gateway/crates/pc-gateway-app/src/shutdown.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gateway/crates/pc-gateway-app/src/shutdown.rs b/gateway/crates/pc-gateway-app/src/shutdown.rs index f7f668cf34..36daef4d6a 100644 --- a/gateway/crates/pc-gateway-app/src/shutdown.rs +++ b/gateway/crates/pc-gateway-app/src/shutdown.rs @@ -316,12 +316,17 @@ mod tests { let _ = self.0.wait(); } } + // With one test thread (one available CPU or RUST_TEST_THREADS=1), + // libtest prints `test ... ` without a newline before the test + // body runs, so the first marker shares that line. Pin it so every + // host produces the same output. let mut child = Child( Command::new(std::env::current_exe().unwrap()) .args([ "--exact", "shutdown::tests::stalled_process_child", "--nocapture", + "--test-threads=1", ]) .env("PC_TEST_SHUTDOWN_CHILD", kind) .stdout(Stdio::piped()) @@ -340,7 +345,7 @@ mod tests { }); let address = loop { let line = output.recv_timeout(Duration::from_secs(5)).unwrap(); - if let Some(address) = line.strip_prefix("LISTEN ") { + if let Some((_, address)) = line.split_once("LISTEN ") { break address.to_owned(); } };