From 7eb70730d1fb632e1c01dd1382e6022ff1b1c253 Mon Sep 17 00:00:00 2001 From: Songqian Li Date: Tue, 9 Jul 2024 22:10:09 +0800 Subject: [PATCH] test_infra: panic when killing with SIGKILL Killing process with SIGKILL will miss the information since CLH process needs to end normally to export code coverage information. Signed-off-by: Songqian Li --- test_infra/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test_infra/src/lib.rs b/test_infra/src/lib.rs index 46b6b2372..d4a511faf 100644 --- a/test_infra/src/lib.rs +++ b/test_infra/src/lib.rs @@ -809,8 +809,12 @@ pub fn kill_child(child: &mut Child) { } // The timeout period elapsed without the child exiting - if child.wait_timeout(Duration::new(5, 0)).unwrap().is_none() { + if child.wait_timeout(Duration::new(10, 0)).unwrap().is_none() { let _ = child.kill(); + let rust_flags = env::var("RUSTFLAGS").unwrap_or_default(); + if rust_flags.contains("-Cinstrument-coverage") { + panic!("Wait child timeout, please check the reason.") + } } }