Skip to content

Commit 50b3583

Browse files
committed
switch all tests to use render_tests
1 parent b14b355 commit 50b3583

File tree

2 files changed

+27
-23
lines changed

2 files changed

+27
-23
lines changed

src/bootstrap/render_tests.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ use yansi_term::Color;
1414

1515
const TERSE_TESTS_PER_LINE: usize = 88;
1616

17+
pub(crate) fn add_flags_and_try_run_tests(builder: &Builder<'_>, cmd: &mut Command) -> bool {
18+
if cmd.get_args().position(|arg| arg == "--").is_none() {
19+
cmd.arg("--");
20+
}
21+
cmd.args(&["-Z", "unstable-options", "--format", "json"]);
22+
23+
try_run_tests(builder, cmd)
24+
}
25+
1726
pub(crate) fn try_run_tests(builder: &Builder<'_>, cmd: &mut Command) -> bool {
1827
if builder.config.dry_run() {
1928
return true;

src/bootstrap/test.rs

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use crate::dist;
2020
use crate::doc::DocumentationFormat;
2121
use crate::flags::Subcommand;
2222
use crate::native;
23+
use crate::render_tests::add_flags_and_try_run_tests;
2324
use crate::tool::{self, SourceType, Tool};
2425
use crate::toolstate::ToolState;
2526
use crate::util::{self, add_link_lib_path, dylib_path, dylib_path_var, output, t};
@@ -123,7 +124,7 @@ impl Step for CrateJsonDocLint {
123124
SourceType::InTree,
124125
&[],
125126
);
126-
try_run(builder, &mut cargo.into());
127+
add_flags_and_try_run_tests(builder, &mut cargo.into());
127128
}
128129
}
129130

@@ -172,7 +173,7 @@ You can skip linkcheck with --exclude src/tools/linkchecker"
172173
SourceType::InTree,
173174
&[],
174175
);
175-
try_run(builder, &mut cargo.into());
176+
add_flags_and_try_run_tests(builder, &mut cargo.into());
176177

177178
// Build all the default documentation.
178179
builder.default_doc(&[]);
@@ -333,7 +334,7 @@ impl Step for Cargo {
333334

334335
cargo.env("PATH", &path_for_cargo(builder, compiler));
335336

336-
try_run(builder, &mut cargo.into());
337+
add_flags_and_try_run_tests(builder, &mut cargo.into());
337338
}
338339
}
339340

@@ -392,7 +393,7 @@ impl Step for RustAnalyzer {
392393
cargo.add_rustc_lib_path(builder, compiler);
393394
cargo.arg("--").args(builder.config.cmd.test_args());
394395

395-
builder.run(&mut cargo.into());
396+
add_flags_and_try_run_tests(builder, &mut cargo.into());
396397
}
397398
}
398399

@@ -445,7 +446,7 @@ impl Step for Rustfmt {
445446

446447
cargo.add_rustc_lib_path(builder, compiler);
447448

448-
builder.run(&mut cargo.into());
449+
add_flags_and_try_run_tests(builder, &mut cargo.into());
449450
}
450451
}
451452

@@ -496,7 +497,7 @@ impl Step for RustDemangler {
496497

497498
cargo.add_rustc_lib_path(builder, compiler);
498499

499-
builder.run(&mut cargo.into());
500+
add_flags_and_try_run_tests(builder, &mut cargo.into());
500501
}
501502
}
502503

@@ -637,8 +638,7 @@ impl Step for Miri {
637638
// Forward test filters.
638639
cargo.arg("--").args(builder.config.cmd.test_args());
639640

640-
let mut cargo = Command::from(cargo);
641-
builder.run(&mut cargo);
641+
add_flags_and_try_run_tests(builder, &mut cargo.into());
642642

643643
// # Run `cargo miri test`.
644644
// This is just a smoke test (Miri's own CI invokes this in a bunch of different ways and ensures
@@ -711,7 +711,7 @@ impl Step for CompiletestTest {
711711
);
712712
cargo.allow_features("test");
713713

714-
try_run(builder, &mut cargo.into());
714+
add_flags_and_try_run_tests(builder, &mut cargo.into());
715715
}
716716
}
717717

@@ -767,7 +767,7 @@ impl Step for Clippy {
767767

768768
cargo.add_rustc_lib_path(builder, compiler);
769769

770-
if builder.try_run(&mut cargo.into()) {
770+
if add_flags_and_try_run_tests(builder, &mut cargo.into()) {
771771
// The tests succeeded; nothing to do.
772772
return;
773773
}
@@ -1189,7 +1189,7 @@ impl Step for TidySelfTest {
11891189
SourceType::InTree,
11901190
&[],
11911191
);
1192-
try_run(builder, &mut cargo.into());
1192+
add_flags_and_try_run_tests(builder, &mut cargo.into());
11931193
}
11941194
}
11951195

@@ -2178,9 +2178,8 @@ impl Step for Crate {
21782178
cargo.arg("--");
21792179
cargo.args(&builder.config.cmd.test_args());
21802180

2181-
if !builder.config.verbose_tests {
2182-
cargo.arg("--quiet");
2183-
}
2181+
cargo.arg("-Z").arg("unstable-options");
2182+
cargo.arg("--format").arg("json");
21842183

21852184
if target.contains("emscripten") {
21862185
cargo.env(
@@ -2208,7 +2207,7 @@ impl Step for Crate {
22082207
target
22092208
));
22102209
let _time = util::timeit(&builder);
2211-
try_run(builder, &mut cargo.into());
2210+
crate::render_tests::try_run_tests(builder, &mut cargo.into());
22122211
}
22132212
}
22142213

@@ -2328,7 +2327,7 @@ impl Step for CrateRustdoc {
23282327
));
23292328
let _time = util::timeit(&builder);
23302329

2331-
try_run(builder, &mut cargo.into());
2330+
add_flags_and_try_run_tests(builder, &mut cargo.into());
23322331
}
23332332
}
23342333

@@ -2389,17 +2388,13 @@ impl Step for CrateRustdocJsonTypes {
23892388
cargo.arg("'-Ctarget-feature=-crt-static'");
23902389
}
23912390

2392-
if !builder.config.verbose_tests {
2393-
cargo.arg("--quiet");
2394-
}
2395-
23962391
builder.info(&format!(
23972392
"{} rustdoc-json-types stage{} ({} -> {})",
23982393
test_kind, compiler.stage, &compiler.host, target
23992394
));
24002395
let _time = util::timeit(&builder);
24012396

2402-
try_run(builder, &mut cargo.into());
2397+
add_flags_and_try_run_tests(builder, &mut cargo.into());
24032398
}
24042399
}
24052400

@@ -2568,7 +2563,7 @@ impl Step for Bootstrap {
25682563
// rustbuild tests are racy on directory creation so just run them one at a time.
25692564
// Since there's not many this shouldn't be a problem.
25702565
cmd.arg("--test-threads=1");
2571-
try_run(builder, &mut cmd);
2566+
add_flags_and_try_run_tests(builder, &mut cmd);
25722567
}
25732568

25742569
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
@@ -2649,7 +2644,7 @@ impl Step for ReplacePlaceholderTest {
26492644
SourceType::InTree,
26502645
&[],
26512646
);
2652-
try_run(builder, &mut cargo.into());
2647+
add_flags_and_try_run_tests(builder, &mut cargo.into());
26532648
}
26542649

26552650
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {

0 commit comments

Comments
 (0)