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 <sionli@tencent.com>
This commit is contained in:
Songqian Li 2024-07-09 22:10:09 +08:00 committed by Rob Bradford
parent 0a3ad6153a
commit 7eb70730d1

View File

@ -809,8 +809,12 @@ pub fn kill_child(child: &mut Child) {
} }
// The timeout period elapsed without the child exiting // 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 _ = 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.")
}
} }
} }