From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/rustix/tests/process/wait.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 vendor/rustix/tests/process/wait.rs (limited to 'vendor/rustix/tests/process/wait.rs') diff --git a/vendor/rustix/tests/process/wait.rs b/vendor/rustix/tests/process/wait.rs new file mode 100644 index 000000000..a1f25a631 --- /dev/null +++ b/vendor/rustix/tests/process/wait.rs @@ -0,0 +1,25 @@ +use libc::{kill, SIGSTOP}; +use rustix::process; +use serial_test::serial; +use std::process::{Command, Stdio}; + +// These tests must execute serially to prevent race condition, where +// `test_wait` waits for the child process spawned in `test_waitpid`, causing +// the tests to get stuck. + +#[test] +#[serial] +fn test_waitpid() { + let child = Command::new("yes") + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .spawn() + .expect("failed to execute child"); + unsafe { kill(child.id() as _, SIGSTOP) }; + + let pid = unsafe { process::Pid::from_raw(child.id() as _) }; + let status = process::waitpid(pid, process::WaitOptions::UNTRACED) + .expect("failed to wait") + .unwrap(); + assert!(status.stopped()); +} -- cgit v1.2.3