mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-05 15:37:47 +00:00
Merge pull request #4256 from Joining7943/tests-util-fix-test-executable-resolution
tests/util: Fix path resolution of test executable
This commit is contained in:
commit
e8af2a1e67
1 changed files with 1 additions and 12 deletions
|
@ -36,11 +36,6 @@ use std::{env, hint, thread};
|
|||
use tempfile::{Builder, TempDir};
|
||||
use uucore::Args;
|
||||
|
||||
#[cfg(windows)]
|
||||
static PROGNAME: &str = concat!(env!("CARGO_PKG_NAME"), ".exe");
|
||||
#[cfg(not(windows))]
|
||||
static PROGNAME: &str = env!("CARGO_PKG_NAME");
|
||||
|
||||
static TESTS_DIR: &str = "tests";
|
||||
static FIXTURES_DIR: &str = "fixtures";
|
||||
|
||||
|
@ -1101,13 +1096,7 @@ impl TestScenario {
|
|||
pub fn new(util_name: &str) -> Self {
|
||||
let tmpd = Rc::new(TempDir::new().unwrap());
|
||||
let ts = Self {
|
||||
bin_path: {
|
||||
// Instead of hard coding the path relative to the current
|
||||
// directory, use Cargo's OUT_DIR to find path to executable.
|
||||
// This allows tests to be run using profiles other than debug.
|
||||
let target_dir = path_concat!(env!("OUT_DIR"), "..", "..", "..", PROGNAME);
|
||||
PathBuf::from(AtPath::new(Path::new(&target_dir)).root_dir_resolved())
|
||||
},
|
||||
bin_path: PathBuf::from(env!("CARGO_BIN_EXE_coreutils")),
|
||||
util_name: String::from(util_name),
|
||||
fixtures: AtPath::new(tmpd.as_ref().path()),
|
||||
tmpd,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue