Skip to content

Commit

Permalink
Fix test compilation with restricted feature sets.
Browse files Browse the repository at this point in the history
Add `cfg`s to fix build errors.
  • Loading branch information
sunfishcode committed Dec 8, 2024
1 parent 52f1af8 commit bed5c48
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/event/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ fn test_select_with_pipes() {
}

#[cfg(feature = "pipe")]
#[cfg(feature = "process")]
#[cfg(not(windows))]
#[test]
#[serial] // for `setrlimit` usage
Expand Down Expand Up @@ -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`
Expand Down
1 change: 1 addition & 0 deletions tests/fs/special.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[cfg(feature = "process")]
#[cfg(not(target_os = "wasi"))]
#[test]
fn test_special_fds() {
Expand Down
2 changes: 2 additions & 0 deletions tests/io_uring/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<FD>(
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit bed5c48

Please sign in to comment.