about summary refs log tree commit diff
path: root/tests/ui/command
diff options
context:
space:
mode:
authorAskar Safin <safinaskar@gmail.com>2024-01-24 15:32:06 +0300
committerAskar Safin <safinaskar@gmail.com>2024-01-24 17:23:42 +0300
commit1ee773e2421e23a249cb007dade8286c16eb5cd8 (patch)
treea535898b15ce9d995d9f3c0c09f0703537a145f0 /tests/ui/command
parent57f9d1f01a6b249c6673e6da253c3504ce8ce4c4 (diff)
downloadrust-1ee773e2421e23a249cb007dade8286c16eb5cd8.tar.gz
rust-1ee773e2421e23a249cb007dade8286c16eb5cd8.zip
This commit is part of clone3 clean up. Merge tests from tests/ui/command/command-create-pidfd.rs
to library/std/src/sys/pal/unix/process/process_unix/tests.rs to remove code
duplication
Diffstat (limited to 'tests/ui/command')
-rw-r--r--tests/ui/command/command-create-pidfd.rs46
1 files changed, 0 insertions, 46 deletions
diff --git a/tests/ui/command/command-create-pidfd.rs b/tests/ui/command/command-create-pidfd.rs
deleted file mode 100644
index 9f9e5dd0e01..00000000000
--- a/tests/ui/command/command-create-pidfd.rs
+++ /dev/null
@@ -1,46 +0,0 @@
-// run-pass
-// only-linux - pidfds are a linux-specific concept
-
-#![feature(linux_pidfd)]
-#![feature(rustc_private)]
-
-extern crate libc;
-
-use std::io::Error;
-use std::os::linux::process::{ChildExt, CommandExt};
-use std::process::Command;
-
-fn has_clone3() -> bool {
-    let res = unsafe { libc::syscall(libc::SYS_clone3, 0, 0) };
-    let err = (res == -1)
-        .then(|| Error::last_os_error())
-        .expect("probe syscall should not succeed");
-
-    err.raw_os_error() != Some(libc::ENOSYS) && err.raw_os_error() != Some(libc::EPERM)
-}
-
-fn main() {
-    // pidfds require the clone3 syscall
-    if !has_clone3() {
-        return;
-    }
-
-    // We don't assert the precise value, since the standard library
-    // might have opened other file descriptors before our code runs.
-    let _ = Command::new("echo")
-        .create_pidfd(true)
-        .spawn()
-        .unwrap()
-        .pidfd().expect("failed to obtain pidfd");
-
-    let _ = Command::new("echo")
-        .create_pidfd(false)
-        .spawn()
-        .unwrap()
-        .pidfd().expect_err("pidfd should not have been created when create_pid(false) is set");
-
-    let _ = Command::new("echo")
-        .spawn()
-        .unwrap()
-        .pidfd().expect_err("pidfd should not have been created");
-}