Skip to content

Commit f220710

Browse files
committed
compiletest: implement {run-make,run-make-cargo} test suite split
- `run-make` test suite will now no longer receive a `cargo`. - NOTE: the user could technically still write `Command::new("cargo")` which might find *a* cargo from the environment, but that is not a supported case. - `run-make-cargo` will receive a built in-tree `cargo`.
1 parent 0f76784 commit f220710

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/tools/compiletest/src/common.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ string_enum! {
6767
MirOpt => "mir-opt",
6868
Pretty => "pretty",
6969
RunMake => "run-make",
70+
RunMakeCargo => "run-make-cargo",
7071
Rustdoc => "rustdoc",
7172
RustdocGui => "rustdoc-gui",
7273
RustdocJs => "rustdoc-js",
@@ -269,9 +270,6 @@ pub struct Config {
269270
/// between e.g. beta `cargo` vs in-tree `cargo`.
270271
///
271272
/// FIXME: maybe rename this to reflect that this is a *staged* host cargo.
272-
///
273-
/// FIXME(#134109): split `run-make` into two test suites, a test suite *with* staged cargo, and
274-
/// another test suite *without*.
275273
pub cargo_path: Option<Utf8PathBuf>,
276274

277275
/// Path to the stage 0 `rustc` used to build `run-make` recipes. This must not be confused with

src/tools/compiletest/src/directives.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ impl Config {
10121012
if let Some(raw) = self.parse_name_value_directive(line, "revisions", testfile, line_number)
10131013
{
10141014
if self.mode == TestMode::RunMake {
1015-
panic!("`run-make` tests do not support revisions: {}", testfile);
1015+
panic!("`run-make` mode tests do not support revisions: {}", testfile);
10161016
}
10171017

10181018
let mut duplicates: HashSet<_> = existing.iter().cloned().collect();

src/tools/compiletest/src/runtest/run_make.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ use build_helper::fs::{ignore_not_found, recursive_remove};
55
use camino::{Utf8Path, Utf8PathBuf};
66

77
use super::{ProcRes, TestCx, disable_error_reporting};
8+
use crate::common::TestSuite;
89
use crate::util::{copy_dir_all, dylib_env_var};
910

1011
impl TestCx<'_> {
1112
pub(super) fn run_rmake_test(&self) {
12-
// For `run-make` V2, we need to perform 2 steps to build and run a `run-make` V2 recipe
13+
// For `run-make`, we need to perform 2 steps to build and run a `run-make` recipe
1314
// (`rmake.rs`) to run the actual tests. The support library is already built as a tool rust
1415
// library and is available under
1516
// `build/$HOST/bootstrap-tools/$TARGET/release/librun_make_support.rlib`.
@@ -189,8 +190,12 @@ impl TestCx<'_> {
189190
// through a specific CI runner).
190191
.env("LLVM_COMPONENTS", &self.config.llvm_components);
191192

192-
if let Some(ref cargo) = self.config.cargo_path {
193-
cmd.env("CARGO", cargo);
193+
// Only `run-make-cargo` test suite gets an in-tree `cargo`, not `run-make`.
194+
if self.config.suite == TestSuite::RunMakeCargo {
195+
cmd.env(
196+
"CARGO",
197+
self.config.cargo_path.as_ref().expect("cargo must be built and made available"),
198+
);
194199
}
195200

196201
if let Some(ref rustdoc) = self.config.rustdoc_path {

0 commit comments

Comments
 (0)