1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

test_util_name: symlink the xecutable instead of copying

Speculative fix for "text file busy" errors.
This commit is contained in:
Michael Debertol 2021-08-20 00:20:56 +02:00
parent 1eb7193ee8
commit 0062e54b5e

View file

@ -2,6 +2,11 @@ mod common;
use common::util::TestScenario; use common::util::TestScenario;
#[cfg(unix)]
use std::os::unix::fs::symlink as symlink_file;
#[cfg(windows)]
use std::os::windows::fs::symlink_file;
#[test] #[test]
#[cfg(feature = "ls")] #[cfg(feature = "ls")]
fn execution_phrase_double() { fn execution_phrase_double() {
@ -24,7 +29,7 @@ fn execution_phrase_single() {
use std::process::Command; use std::process::Command;
let scenario = TestScenario::new("ls"); let scenario = TestScenario::new("ls");
std::fs::copy(scenario.bin_path, scenario.fixtures.plus("uu-ls")).unwrap(); symlink_file(scenario.bin_path, scenario.fixtures.plus("uu-ls")).unwrap();
let output = Command::new(scenario.fixtures.plus("uu-ls")) let output = Command::new(scenario.fixtures.plus("uu-ls"))
.arg("--some-invalid-arg") .arg("--some-invalid-arg")
.output() .output()
@ -65,7 +70,7 @@ fn util_name_single() {
}; };
let scenario = TestScenario::new("sort"); let scenario = TestScenario::new("sort");
std::fs::copy(scenario.bin_path, scenario.fixtures.plus("uu-sort")).unwrap(); symlink_file(scenario.bin_path, scenario.fixtures.plus("uu-sort")).unwrap();
let mut child = Command::new(scenario.fixtures.plus("uu-sort")) let mut child = Command::new(scenario.fixtures.plus("uu-sort"))
.stdin(Stdio::piped()) .stdin(Stdio::piped())
.stderr(Stdio::piped()) .stderr(Stdio::piped())