diff options
| author | The 8472 <git@infinite-source.de> | 2024-06-25 00:17:31 +0200 |
|---|---|---|
| committer | The 8472 <git@infinite-source.de> | 2024-06-25 01:00:28 +0200 |
| commit | ec0c755704bba1b6c4faa0b10aa0d886cdfa309e (patch) | |
| tree | 61d7c0fab1baced0c73ae7a74d7a3803c73d2f3c | |
| parent | 3e4e31b7bf34dafa4dc3fc97e454a046886692da (diff) | |
| download | rust-ec0c755704bba1b6c4faa0b10aa0d886cdfa309e.tar.gz rust-ec0c755704bba1b6c4faa0b10aa0d886cdfa309e.zip | |
Check that we get somewhat sane PIDs when spawning with pidfds
| -rw-r--r-- | library/std/src/sys/pal/unix/linux/pidfd/tests.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/library/std/src/sys/pal/unix/linux/pidfd/tests.rs b/library/std/src/sys/pal/unix/linux/pidfd/tests.rs index 672cb0efed1..fb928c76fbd 100644 --- a/library/std/src/sys/pal/unix/linux/pidfd/tests.rs +++ b/library/std/src/sys/pal/unix/linux/pidfd/tests.rs @@ -21,6 +21,7 @@ fn test_command_pidfd() { let flags = super::cvt(unsafe { libc::fcntl(pidfd.as_raw_fd(), libc::F_GETFD) }).unwrap(); assert!(flags & libc::FD_CLOEXEC != 0); } + assert!(child.id() > 0 && child.id() < -1i32 as u32); let status = child.wait().expect("error waiting on pidfd"); assert_eq!(status.code(), Some(1)); @@ -47,6 +48,8 @@ fn test_command_pidfd() { let mut child = unsafe { Command::new("false").pre_exec(|| Ok(())) }.create_pidfd(true).spawn().unwrap(); + assert!(child.id() > 0 && child.id() < -1i32 as u32); + if pidfd_open_available { assert!(child.pidfd().is_ok()) } |
