Skip to content

Commit 0c006e6

Browse files
authored
Remove usage of long-deprecated CARGO_BIN_PATH (#1369)
Remove usage of long-deprecated CARGO_BIN_PATH in favor of CARGO_BIN_EXE_<name>
1 parent cafcb17 commit 0c006e6

2 files changed

Lines changed: 4 additions & 17 deletions

File tree

tests/executable.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use tempfile::TempDir;
1717

1818
#[path = "util/mod.rs"]
1919
mod util;
20-
use crate::util::{cargo_dir, ensure_plain_format};
20+
use crate::util::{ensure_plain_format, tectonic_exe};
2121

2222
lazy_static! {
2323
static ref TEST_ROOT: PathBuf = {
@@ -53,9 +53,7 @@ fn get_plain_format_arg() -> String {
5353
/// tells the Tectonic binary to go into "test mode" and use local test
5454
/// assets, rather than an actual network bundle.
5555
fn prep_tectonic(cwd: &Path, args: &[&str]) -> Command {
56-
let tectonic = cargo_dir()
57-
.join("tectonic")
58-
.with_extension(env::consts::EXE_EXTENSION);
56+
let tectonic = tectonic_exe();
5957

6058
if fs::metadata(&tectonic).is_err() {
6159
panic!("tectonic binary not found at {tectonic:?}. Do you need to run `cargo build`?")

tests/util/mod.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,9 @@ pub fn set_test_root() {
3636
::tectonic::test_util::set_test_root_augmented(env!("CARGO_MANIFEST_DIR"));
3737
}
3838

39-
// Duplicated from Cargo's own testing code:
40-
// https://github.com/rust-lang/cargo/blob/19fdb308/tests/cargotest/support/mod.rs#L305-L318
41-
pub fn cargo_dir() -> PathBuf {
42-
env::var_os("CARGO_BIN_PATH")
39+
pub fn tectonic_exe() -> PathBuf {
40+
env::var_os("CARGO_BIN_EXE_tectonic")
4341
.map(PathBuf::from)
44-
.or_else(|| {
45-
env::current_exe().ok().map(|mut path| {
46-
path.pop();
47-
if path.ends_with("deps") {
48-
path.pop();
49-
}
50-
path
51-
})
52-
})
5342
.unwrap_or_else(|| panic!("CARGO_BIN_PATH wasn't set. Cannot continue running test"))
5443
}
5544

0 commit comments

Comments
 (0)