diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 4d17d58d21..c50d62efe9 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -3161,3 +3161,31 @@ fn test_install_d_parallel_mkdir_race() { } } } + +#[test] +#[cfg(target_os = "linux")] +fn test_install_target_without_splice_support() { + // Does eCryptfs not support splice on some kernel? + use std::process::Command; + if Command::new("strace") + .args(["-e", "inject=splice:error=EINVAL:when=2", "true"]) + .output() + .is_err() + { + return; // missing strace + } + let coreutils = uutests::util::get_tests_binary(); + Command::new("strace") + .args([ + "-e", + "inject=splice:error=EINVAL:when=2", + coreutils, + "install", + coreutils, + "target_file", + ]) + .output() + .unwrap(); + // properly copied with fallback from splice? + assert!(uucore::fs::are_files_identical(coreutils, "target_file").unwrap()); +}