Skip to content

Commit

Permalink
tests: send SIGTERM to kill GuestCommand
Browse files Browse the repository at this point in the history
Killing CLH by SIGKILL will cause inaccurate code coverage
 information. This patch changes the signal to SIGTERM.

Fixes: #6507

Signed-off-by: Songqian Li <sionli@tencent.com>
  • Loading branch information
Songqian Li committed Jun 11, 2024
1 parent d82846c commit b020ed7
Show file tree
Hide file tree
Showing 2 changed files with 174 additions and 164 deletions.
11 changes: 11 additions & 0 deletions test_infra/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,17 @@ pub fn check_matched_lines_count(input: &str, keywords: Vec<&str>, line_count: u
}
}

pub fn kill_child(child: &Child) {
let result = unsafe { libc::kill(child.id() as i32, libc::SIGTERM) };
if result != 0 {
eprintln!(
"Failed to kill child with SIGKILL: {:?}",
io::Error::last_os_error()
);
let _ = unsafe { libc::kill(child.id() as i32, libc::SIGKILL) };
}
}

pub const PIPE_SIZE: i32 = 32 << 20;

static NEXT_VM_ID: Lazy<Mutex<u8>> = Lazy::new(|| Mutex::new(1));
Expand Down
Loading

0 comments on commit b020ed7

Please sign in to comment.