Skip to content

Commit af09954

Browse files
authored
uucore: do not use Linux specific fn at tests (#12128)
1 parent 9de73ef commit af09954

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/uucore/src/lib/features/buf_copy.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ mod tests {
5050
}
5151

5252
#[test]
53-
#[cfg(unix)]
53+
#[cfg(target_os = "linux")]
5454
fn test_copy_stream() {
5555
let mut dest_file = new_temp_file();
5656

@@ -72,8 +72,8 @@ mod tests {
7272
}
7373

7474
#[test]
75-
#[cfg(not(unix))]
76-
// Test for non-unix platforms. We use regular files instead.
75+
#[cfg(not(target_os = "linux"))]
76+
// Test for non-linux platforms. We use regular files instead.
7777
fn test_copy_stream() {
7878
let temp_dir = tempdir().unwrap();
7979
let src_path = temp_dir.path().join("src.txt");

src/uucore/src/lib/features/pipes.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
#[cfg(any(target_os = "linux", target_os = "android"))]
99
use rustix::pipe::{SpliceFlags, fcntl_setpipe_size};
10-
#[cfg(any(target_os = "linux", target_os = "android", test))]
10+
#[cfg(any(target_os = "linux", target_os = "android"))]
1111
use std::fs::File;
1212
#[cfg(any(target_os = "linux", target_os = "android"))]
1313
use std::{io::Read, os::fd::AsFd, sync::OnceLock};
@@ -22,11 +22,10 @@ const KERNEL_DEFAULT_PIPE_SIZE: usize = 64 * 1024;
2222
/// from the first.
2323
/// used for resolving the limitation for splice: one of a input or output should be pipe
2424
#[inline]
25-
#[cfg(any(target_os = "linux", target_os = "android", test))]
25+
#[cfg(any(target_os = "linux", target_os = "android"))]
2626
pub fn pipe() -> std::io::Result<(File, File)> {
2727
let (read, write) = rustix::pipe::pipe()?;
2828
// improve performance for splice
29-
#[cfg(any(target_os = "linux", target_os = "android"))]
3029
let _ = fcntl_setpipe_size(&read, MAX_ROOTLESS_PIPE_SIZE);
3130

3231
Ok((File::from(read), File::from(write)))

0 commit comments

Comments
 (0)