switch all tests to use render_tests
This commit is contained in:
parent
b14b355550
commit
50b3583695
2 changed files with 27 additions and 23 deletions
|
|
@ -14,6 +14,15 @@ use yansi_term::Color;
|
|||
|
||||
const TERSE_TESTS_PER_LINE: usize = 88;
|
||||
|
||||
pub(crate) fn add_flags_and_try_run_tests(builder: &Builder<'_>, cmd: &mut Command) -> bool {
|
||||
if cmd.get_args().position(|arg| arg == "--").is_none() {
|
||||
cmd.arg("--");
|
||||
}
|
||||
cmd.args(&["-Z", "unstable-options", "--format", "json"]);
|
||||
|
||||
try_run_tests(builder, cmd)
|
||||
}
|
||||
|
||||
pub(crate) fn try_run_tests(builder: &Builder<'_>, cmd: &mut Command) -> bool {
|
||||
if builder.config.dry_run() {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ use crate::dist;
|
|||
use crate::doc::DocumentationFormat;
|
||||
use crate::flags::Subcommand;
|
||||
use crate::native;
|
||||
use crate::render_tests::add_flags_and_try_run_tests;
|
||||
use crate::tool::{self, SourceType, Tool};
|
||||
use crate::toolstate::ToolState;
|
||||
use crate::util::{self, add_link_lib_path, dylib_path, dylib_path_var, output, t};
|
||||
|
|
@ -123,7 +124,7 @@ impl Step for CrateJsonDocLint {
|
|||
SourceType::InTree,
|
||||
&[],
|
||||
);
|
||||
try_run(builder, &mut cargo.into());
|
||||
add_flags_and_try_run_tests(builder, &mut cargo.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -172,7 +173,7 @@ You can skip linkcheck with --exclude src/tools/linkchecker"
|
|||
SourceType::InTree,
|
||||
&[],
|
||||
);
|
||||
try_run(builder, &mut cargo.into());
|
||||
add_flags_and_try_run_tests(builder, &mut cargo.into());
|
||||
|
||||
// Build all the default documentation.
|
||||
builder.default_doc(&[]);
|
||||
|
|
@ -333,7 +334,7 @@ impl Step for Cargo {
|
|||
|
||||
cargo.env("PATH", &path_for_cargo(builder, compiler));
|
||||
|
||||
try_run(builder, &mut cargo.into());
|
||||
add_flags_and_try_run_tests(builder, &mut cargo.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -392,7 +393,7 @@ impl Step for RustAnalyzer {
|
|||
cargo.add_rustc_lib_path(builder, compiler);
|
||||
cargo.arg("--").args(builder.config.cmd.test_args());
|
||||
|
||||
builder.run(&mut cargo.into());
|
||||
add_flags_and_try_run_tests(builder, &mut cargo.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -445,7 +446,7 @@ impl Step for Rustfmt {
|
|||
|
||||
cargo.add_rustc_lib_path(builder, compiler);
|
||||
|
||||
builder.run(&mut cargo.into());
|
||||
add_flags_and_try_run_tests(builder, &mut cargo.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -496,7 +497,7 @@ impl Step for RustDemangler {
|
|||
|
||||
cargo.add_rustc_lib_path(builder, compiler);
|
||||
|
||||
builder.run(&mut cargo.into());
|
||||
add_flags_and_try_run_tests(builder, &mut cargo.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -637,8 +638,7 @@ impl Step for Miri {
|
|||
// Forward test filters.
|
||||
cargo.arg("--").args(builder.config.cmd.test_args());
|
||||
|
||||
let mut cargo = Command::from(cargo);
|
||||
builder.run(&mut cargo);
|
||||
add_flags_and_try_run_tests(builder, &mut cargo.into());
|
||||
|
||||
// # Run `cargo miri test`.
|
||||
// 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 {
|
|||
);
|
||||
cargo.allow_features("test");
|
||||
|
||||
try_run(builder, &mut cargo.into());
|
||||
add_flags_and_try_run_tests(builder, &mut cargo.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -767,7 +767,7 @@ impl Step for Clippy {
|
|||
|
||||
cargo.add_rustc_lib_path(builder, compiler);
|
||||
|
||||
if builder.try_run(&mut cargo.into()) {
|
||||
if add_flags_and_try_run_tests(builder, &mut cargo.into()) {
|
||||
// The tests succeeded; nothing to do.
|
||||
return;
|
||||
}
|
||||
|
|
@ -1189,7 +1189,7 @@ impl Step for TidySelfTest {
|
|||
SourceType::InTree,
|
||||
&[],
|
||||
);
|
||||
try_run(builder, &mut cargo.into());
|
||||
add_flags_and_try_run_tests(builder, &mut cargo.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2178,9 +2178,8 @@ impl Step for Crate {
|
|||
cargo.arg("--");
|
||||
cargo.args(&builder.config.cmd.test_args());
|
||||
|
||||
if !builder.config.verbose_tests {
|
||||
cargo.arg("--quiet");
|
||||
}
|
||||
cargo.arg("-Z").arg("unstable-options");
|
||||
cargo.arg("--format").arg("json");
|
||||
|
||||
if target.contains("emscripten") {
|
||||
cargo.env(
|
||||
|
|
@ -2208,7 +2207,7 @@ impl Step for Crate {
|
|||
target
|
||||
));
|
||||
let _time = util::timeit(&builder);
|
||||
try_run(builder, &mut cargo.into());
|
||||
crate::render_tests::try_run_tests(builder, &mut cargo.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2328,7 +2327,7 @@ impl Step for CrateRustdoc {
|
|||
));
|
||||
let _time = util::timeit(&builder);
|
||||
|
||||
try_run(builder, &mut cargo.into());
|
||||
add_flags_and_try_run_tests(builder, &mut cargo.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2389,17 +2388,13 @@ impl Step for CrateRustdocJsonTypes {
|
|||
cargo.arg("'-Ctarget-feature=-crt-static'");
|
||||
}
|
||||
|
||||
if !builder.config.verbose_tests {
|
||||
cargo.arg("--quiet");
|
||||
}
|
||||
|
||||
builder.info(&format!(
|
||||
"{} rustdoc-json-types stage{} ({} -> {})",
|
||||
test_kind, compiler.stage, &compiler.host, target
|
||||
));
|
||||
let _time = util::timeit(&builder);
|
||||
|
||||
try_run(builder, &mut cargo.into());
|
||||
add_flags_and_try_run_tests(builder, &mut cargo.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2568,7 +2563,7 @@ impl Step for Bootstrap {
|
|||
// rustbuild tests are racy on directory creation so just run them one at a time.
|
||||
// Since there's not many this shouldn't be a problem.
|
||||
cmd.arg("--test-threads=1");
|
||||
try_run(builder, &mut cmd);
|
||||
add_flags_and_try_run_tests(builder, &mut cmd);
|
||||
}
|
||||
|
||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
|
|
@ -2649,7 +2644,7 @@ impl Step for ReplacePlaceholderTest {
|
|||
SourceType::InTree,
|
||||
&[],
|
||||
);
|
||||
try_run(builder, &mut cargo.into());
|
||||
add_flags_and_try_run_tests(builder, &mut cargo.into());
|
||||
}
|
||||
|
||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue