run_make_support/external_deps/
cargo.rs

1use crate::command::Command;
2use crate::util::set_host_compiler_dylib_path;
3
4/// Returns a command that can be used to invoke in-tree cargo. The cargo is provided by compiletest
5/// through the `CARGO` env var, and is **only** available for the `run-make-cargo` test suite.
6pub fn cargo() -> Command {
7    let cargo_path = std::env::var("CARGO").unwrap_or_else(|e| {
8        panic!(
9            "in-tree `cargo` should be available for `run-make-cargo` test suite, but not \
10            `run-make` test suite: {e}"
11        )
12    });
13
14    let mut cmd = Command::new(cargo_path);
15    set_host_compiler_dylib_path(&mut cmd);
16    cmd
17}