From d4f3bc30534edf655f75e960974e2884f6a6df8f Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Sun, 8 Dec 2024 10:20:11 -0800 Subject: [PATCH] Fix test compilation with restricted feature sets. Add `cfg`s to fix build errors. --- tests/event/select.rs | 2 ++ tests/fs/special.rs | 1 + tests/io_uring/register.rs | 2 ++ 3 files changed, 5 insertions(+) diff --git a/tests/event/select.rs b/tests/event/select.rs index 66919824c..9da7d0e84 100644 --- a/tests/event/select.rs +++ b/tests/event/select.rs @@ -82,6 +82,7 @@ fn test_select_with_pipes() { } #[cfg(feature = "pipe")] +#[cfg(feature = "process")] #[cfg(not(windows))] #[test] #[serial] // for `setrlimit` usage @@ -271,6 +272,7 @@ fn test_select_with_sockets() { // Like `test_select_with_sockets` but test with the maximum permitted // fd value. #[cfg(feature = "net")] +#[cfg(feature = "process")] #[cfg(not(windows))] // for `dup2` usage #[test] #[serial] // for `setrlimit` usage, and `crate::init` diff --git a/tests/fs/special.rs b/tests/fs/special.rs index 31c4cd2f0..b6205111e 100644 --- a/tests/fs/special.rs +++ b/tests/fs/special.rs @@ -1,3 +1,4 @@ +#[cfg(feature = "process")] #[cfg(not(target_os = "wasi"))] #[test] fn test_special_fds() { diff --git a/tests/io_uring/register.rs b/tests/io_uring/register.rs index 3f5b7a734..b188e1d48 100644 --- a/tests/io_uring/register.rs +++ b/tests/io_uring/register.rs @@ -8,6 +8,7 @@ use rustix::io_uring::{ io_uring_rsrc_update, io_uring_setup, IoringFeatureFlags, IoringRegisterFlags, IoringRegisterOp, }; +#[cfg(feature = "mm")] use rustix::mm::{MapFlags, ProtFlags}; fn do_register( @@ -122,6 +123,7 @@ fn test_io_uring_register_with() { register_result.unwrap(); } +#[cfg(feature = "mm")] #[test] fn io_uring_buf_ring_can_be_registered() { const ENTRIES: usize = 8;