From ac454a248524b8b273b17337e3d59a45772f357f Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 21 May 2020 14:24:41 +0200 Subject: [PATCH] cargo-miri: allow overwriting miri command, and make that consistent with compiletest --- cargo-miri/bin.rs | 3 +++ tests/compiletest.rs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cargo-miri/bin.rs b/cargo-miri/bin.rs index 4974ef63f5d..197552a4b12 100644 --- a/cargo-miri/bin.rs +++ b/cargo-miri/bin.rs @@ -94,6 +94,9 @@ fn get_arg_flag_value(name: &str) -> Option { /// Returns the path to the `miri` binary fn find_miri() -> PathBuf { + if let Some(path) = env::var_os("MIRI") { + return path.into(); + } let mut path = std::env::current_exe().expect("current executable path invalid"); path.set_file_name("miri"); path diff --git a/tests/compiletest.rs b/tests/compiletest.rs index 2be0661b93e..a64f0edb946 100644 --- a/tests/compiletest.rs +++ b/tests/compiletest.rs @@ -9,7 +9,7 @@ use colored::*; use compiletest_rs as compiletest; fn miri_path() -> PathBuf { - PathBuf::from(option_env!("MIRI_PATH").unwrap_or(env!("CARGO_BIN_EXE_miri"))) + PathBuf::from(option_env!("MIRI").unwrap_or(env!("CARGO_BIN_EXE_miri"))) } fn run_tests(mode: &str, path: &str, target: &str) {