From b2d65743c634b9ee686c8f3843880548d4f29bad Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Sun, 15 Nov 2026 21:53:45 +0000 Subject: [PATCH] Enable mknodat tests for Apple platforms --- tests/fs/main.rs | 1 + tests/fs/mknodat.rs | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/fs/main.rs b/tests/fs/main.rs index a0bfc3343..1c30cb6d0 100644 --- a/tests/fs/main.rs +++ b/tests/fs/main.rs @@ -40,6 +40,7 @@ mod long_paths; #[cfg(not(any(target_os = "haiku", target_os = "wasi")))] mod makedev; mod mkdirat; +#[cfg(not(target_os = "wasi"))] mod mknodat; mod negative_timestamp; #[cfg(linux_kernel)] diff --git a/tests/fs/mknodat.rs b/tests/fs/mknodat.rs index 8ba53cee0..6ced43486 100644 --- a/tests/fs/mknodat.rs +++ b/tests/fs/mknodat.rs @@ -1,4 +1,4 @@ -#[cfg(not(any(apple, target_os = "wasi")))] +#[cfg(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita")))] #[test] fn test_mknodat() { use rustix::fs::{ @@ -8,9 +8,9 @@ fn test_mknodat() { let tmp = tempfile::tempdir().unwrap(); let dir = openat(CWD, tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap(); - // Create a regular file. Not supported on FreeBSD, OpenBSD, illumos, - // or NetBSD. - #[cfg(not(any(solarish, netbsdlike, target_os = "freebsd")))] + // Create a regular file. Not supported on Apple, FreeBSD, OpenBSD, + // illumos, or NetBSD. + #[cfg(not(any(apple, solarish, netbsdlike, target_os = "freebsd")))] { mknodat(&dir, "file", FileType::RegularFile, Mode::empty(), 0).unwrap(); let stat = statat(&dir, "file", AtFlags::empty()).unwrap(); @@ -18,7 +18,14 @@ fn test_mknodat() { unlinkat(&dir, "file", AtFlags::empty()).unwrap(); } - mknodat(&dir, "file", FileType::Fifo, Mode::empty(), 0).unwrap(); + match mknodat(&dir, "file", FileType::Fifo, Mode::empty(), 0) { + Ok(()) => (), + #[cfg(apple)] + // Apple platforms before macOS 13.0, iOS 16.0, tvOS 16.0, and + // watchOS 9.0 lack `mknodat`. + Err(rustix::io::Errno::NOSYS) => return, + Err(err) => panic!("{:?}", err), + } let stat = statat(&dir, "file", AtFlags::empty()).unwrap(); assert_eq!(FileType::from_raw_mode(stat.st_mode), FileType::Fifo); accessat(&dir, "file", Access::EXISTS, AtFlags::empty()).unwrap();