mirror of
https://github.com/uutils/coreutils.git
synced 2026-05-06 07:26:38 -04:00
uucore: do not use Linux specific fn at tests (#12128)
This commit is contained in:
@@ -50,7 +50,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn test_copy_stream() {
|
||||
let mut dest_file = new_temp_file();
|
||||
|
||||
@@ -72,8 +72,8 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(unix))]
|
||||
// Test for non-unix platforms. We use regular files instead.
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
// Test for non-linux platforms. We use regular files instead.
|
||||
fn test_copy_stream() {
|
||||
let temp_dir = tempdir().unwrap();
|
||||
let src_path = temp_dir.path().join("src.txt");
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
use rustix::pipe::{SpliceFlags, fcntl_setpipe_size};
|
||||
#[cfg(any(target_os = "linux", target_os = "android", test))]
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
use std::fs::File;
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
use std::{io::Read, os::fd::AsFd, sync::OnceLock};
|
||||
@@ -22,11 +22,10 @@ const KERNEL_DEFAULT_PIPE_SIZE: usize = 64 * 1024;
|
||||
/// from the first.
|
||||
/// used for resolving the limitation for splice: one of a input or output should be pipe
|
||||
#[inline]
|
||||
#[cfg(any(target_os = "linux", target_os = "android", test))]
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
pub fn pipe() -> std::io::Result<(File, File)> {
|
||||
let (read, write) = rustix::pipe::pipe()?;
|
||||
// improve performance for splice
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
let _ = fcntl_setpipe_size(&read, MAX_ROOTLESS_PIPE_SIZE);
|
||||
|
||||
Ok((File::from(read), File::from(write)))
|
||||
|
||||
Reference in New Issue
Block a user