run-make-support: handle unavailable in-tree cargo under run-make test suite

This commit is contained in:
Jieyou Xu 2025-09-05 16:10:36 +08:00
parent f220710ace
commit aebcbe0a4b
No known key found for this signature in database
GPG key ID: 045B995028EA6AFC
2 changed files with 13 additions and 6 deletions

View file

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

View file

@ -1,7 +1,8 @@
//! `run-make-support` is a support library for run-make tests. It provides command wrappers and
//! convenience utility functions to help test writers reduce duplication. The support library
//! notably is built via cargo: this means that if your test wants some non-trivial utility, such
//! as `object` or `wasmparser`, they can be re-exported and be made available through this library.
//! notably is built via bootstrap cargo: this means that if your test wants some non-trivial
//! utility, such as `object` or `wasmparser`, they can be re-exported and be made available through
//! this library.
#![warn(unreachable_pub)]