Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cc625c6

Browse files
committed
Consolidate staging of test steps in message groups
1 parent 6c3a86b commit cc625c6

File tree

2 files changed

+87
-132
lines changed

2 files changed

+87
-132
lines changed

‎src/bootstrap/src/core/build_steps/test.rs

Lines changed: 55 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl Step for CrateBootstrap {
9696
);
9797

9898
let crate_name = path.rsplit_once('/').unwrap().1;
99-
run_cargo_test(cargo, &[], &[], crate_name, bootstrap_host, builder,Mode::ToolBootstrap);
99+
run_cargo_test(cargo, &[], &[], crate_name, bootstrap_host, builder);
100100
}
101101

102102
fn metadata(&self) -> Option<StepMetadata> {
@@ -153,15 +153,7 @@ You can skip linkcheck with --skip src/tools/linkchecker"
153153
SourceType::InTree,
154154
&[],
155155
);
156-
run_cargo_test(
157-
cargo,
158-
&[],
159-
&[],
160-
"linkchecker self tests",
161-
bootstrap_host,
162-
builder,
163-
Mode::ToolBootstrap,
164-
);
156+
run_cargo_test(cargo, &[], &[], "linkchecker self tests", bootstrap_host, builder);
165157

166158
if builder.doc_tests == DocTests::No {
167159
return;
@@ -174,7 +166,7 @@ You can skip linkcheck with --skip src/tools/linkchecker"
174166
let linkchecker = builder.tool_cmd(Tool::Linkchecker);
175167

176168
// Run the linkchecker.
177-
let _guard = builder.msg(Kind::Test,"Linkcheck", None, compiler, bootstrap_host);
169+
let _guard = builder.msg_test("Linkcheck", bootstrap_host,1);
178170
let _time = helpers::timeit(builder);
179171
linkchecker.delay_failure().arg(builder.out.join(host).join("doc")).run(builder);
180172
}
@@ -482,7 +474,7 @@ impl Step for RustAnalyzer {
482474
cargo.env("SKIP_SLOW_TESTS", "1");
483475

484476
cargo.add_rustc_lib_path(builder);
485-
run_cargo_test(cargo, &[], &[], "rust-analyzer", host, builder,Mode::ToolRustc);
477+
run_cargo_test(cargo, &[], &[], "rust-analyzer", host, builder);
486478
}
487479

488480
fn metadata(&self) -> Option<StepMetadata> {
@@ -540,7 +532,7 @@ impl Step for Rustfmt {
540532

541533
cargo.add_rustc_lib_path(builder);
542534

543-
run_cargo_test(cargo, &[], &[], "rustfmt", target, builder,Mode::ToolRustc);
535+
run_cargo_test(cargo, &[], &[], "rustfmt", target, builder);
544536
}
545537

546538
fn metadata(&self) -> Option<StepMetadata> {
@@ -679,8 +671,7 @@ impl Step for Miri {
679671
cargo.env("MIRI_TEST_TARGET", target.rustc_target_arg());
680672

681673
{
682-
let _guard =
683-
builder.msg(Kind::Test, "miri", Mode::ToolRustc, miri.build_compiler, target);
674+
let _guard = builder.msg_test("miri", target, target_compiler.stage);
684675
let _time = helpers::timeit(builder);
685676
cargo.run(builder);
686677
}
@@ -696,13 +687,8 @@ impl Step for Miri {
696687
cargo.args(["tests/pass", "tests/panic"]);
697688

698689
{
699-
let _guard = builder.msg(
700-
Kind::Test,
701-
"miri (mir-opt-level 4)",
702-
Mode::ToolRustc,
703-
miri.build_compiler,
704-
target,
705-
);
690+
let _guard =
691+
builder.msg_test("miri (mir-opt-level 4)", target, target_compiler.stage);
706692
let _time = helpers::timeit(builder);
707693
cargo.run(builder);
708694
}
@@ -772,8 +758,7 @@ impl Step for CargoMiri {
772758
// Finally, run everything.
773759
let mut cargo = BootstrapCommand::from(cargo);
774760
{
775-
let _guard =
776-
builder.msg(Kind::Test, "cargo-miri", Mode::ToolRustc, (host, stage), target);
761+
let _guard = builder.msg_test("cargo-miri", target, stage);
777762
let _time = helpers::timeit(builder);
778763
cargo.run(builder);
779764
}
@@ -833,7 +818,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
833818
cargo.env("TEST_RUSTC", builder.rustc(compiler));
834819

835820
cargo.allow_features(COMPILETEST_ALLOW_FEATURES);
836-
run_cargo_test(cargo, &[], &[], "compiletest self test", host, builder,Mode::ToolStd);
821+
run_cargo_test(cargo, &[], &[], "compiletest self test", host, builder);
837822
}
838823
}
839824

@@ -916,7 +901,7 @@ impl Step for Clippy {
916901
cargo.add_rustc_lib_path(builder);
917902
let cargo = prepare_cargo_test(cargo, &[], &[], target, builder);
918903

919-
let _guard = builder.msg(Kind::Test,"clippy", Mode::ToolRustc, build_compiler, target);
904+
let _guard = builder.msg_test("clippy", target, target_compiler.stage);
920905

921906
// Clippy reports errors if it blessed the outputs
922907
if cargo.allow_failure().run(builder) {
@@ -1046,8 +1031,7 @@ impl Step for RustdocJSStd {
10461031
self.target,
10471032
DocumentationFormat::Html,
10481033
));
1049-
let _guard =
1050-
builder.msg(Kind::Test, "rustdoc-js-std", None, self.build_compiler, self.target);
1034+
let _guard = builder.msg_test("rustdoc-js-std", self.target, self.build_compiler.stage);
10511035
command.run(builder);
10521036
}
10531037

@@ -1200,7 +1184,7 @@ impl Step for RustdocGUI {
12001184
}
12011185

12021186
let _time = helpers::timeit(builder);
1203-
let _guard = builder.msg_test("rustdoc-gui", (self.target, self.test_compiler.stage));
1187+
let _guard = builder.msg_test("rustdoc-gui", self.target, self.test_compiler.stage);
12041188
try_run_tests(builder, &mut cmd, true);
12051189
}
12061190

@@ -1359,15 +1343,7 @@ impl Step for CrateRunMakeSupport {
13591343
&[],
13601344
);
13611345
cargo.allow_features("test");
1362-
run_cargo_test(
1363-
cargo,
1364-
&[],
1365-
&[],
1366-
"run-make-support self test",
1367-
host,
1368-
builder,
1369-
Mode::ToolBootstrap,
1370-
);
1346+
run_cargo_test(cargo, &[], &[], "run-make-support self test", host, builder);
13711347
}
13721348
}
13731349

@@ -1404,15 +1380,7 @@ impl Step for CrateBuildHelper {
14041380
&[],
14051381
);
14061382
cargo.allow_features("test");
1407-
run_cargo_test(
1408-
cargo,
1409-
&[],
1410-
&[],
1411-
"build_helper self test",
1412-
host,
1413-
builder,
1414-
Mode::ToolBootstrap,
1415-
);
1383+
run_cargo_test(cargo, &[], &[], "build_helper self test", host, builder);
14161384
}
14171385
}
14181386

@@ -1920,7 +1888,11 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the
19201888
cmd.arg("--llvm-filecheck").arg(builder.llvm_filecheck(builder.config.host_target));
19211889

19221890
if let Some(codegen_backend) = builder.config.cmd.test_codegen_backend() {
1923-
if !builder.config.enabled_codegen_backends(test_compiler.host).contains(codegen_backend) {
1891+
if !builder
1892+
.config
1893+
.enabled_codegen_backends(test_compiler.host)
1894+
.contains(codegen_backend)
1895+
{
19241896
eprintln!(
19251897
"\
19261898
ERROR: No configured backend named `{name}`
@@ -2326,19 +2298,16 @@ HELP: You can add it into `bootstrap.toml` in `rust.codegen-backends = [{name:?}
23262298
mode: mode.into(),
23272299
compare_mode: None,
23282300
target: self.target.triple.to_string(),
2329-
host: self.compiler.host.triple.to_string(),
2330-
stage: self.compiler.stage,
2301+
host: self.test_compiler.host.triple.to_string(),
2302+
stage: self.test_compiler.stage,
23312303
},
23322304
builder,
23332305
);
23342306

2335-
let _group = builder.msg(
2336-
Kind::Test,
2337-
format!("compiletest suite={suite} mode={mode}"),
2338-
// FIXME: compiletest sometimes behaves as ToolStd, we could expose that difference here
2339-
Mode::ToolBootstrap,
2340-
test_compiler,
2307+
let _group = builder.msg_test(
2308+
format!("with compiletest suite={suite} mode={mode}"),
23412309
target,
2310+
test_compiler.stage,
23422311
);
23432312
try_run_tests(builder, &mut cmd, false);
23442313

@@ -2352,8 +2321,8 @@ HELP: You can add it into `bootstrap.toml` in `rust.codegen-backends = [{name:?}
23522321
mode: mode.into(),
23532322
compare_mode: Some(compare_mode.into()),
23542323
target: self.target.triple.to_string(),
2355-
host: self.compiler.host.triple.to_string(),
2356-
stage: self.compiler.stage,
2324+
host: self.test_compiler.host.triple.to_string(),
2325+
stage: self.test_compiler.stage,
23572326
},
23582327
builder,
23592328
);
@@ -2482,12 +2451,10 @@ impl BookTest {
24822451
}
24832452

24842453
builder.add_rust_test_threads(&mut rustbook_cmd);
2485-
let _guard = builder.msg(
2486-
Kind::Test,
2454+
let _guard = builder.msg_test(
24872455
format_args!("mdbook {}", self.path.display()),
2488-
None,
2489-
test_compiler,
24902456
test_compiler.host,
2457+
test_compiler.stage,
24912458
);
24922459
let _time = helpers::timeit(builder);
24932460
let toolstate = if rustbook_cmd.delay_failure().run(builder) {
@@ -2505,12 +2472,10 @@ impl BookTest {
25052472

25062473
builder.std(test_compiler, host);
25072474

2508-
let _guard = builder.msg(
2509-
Kind::Test,
2475+
let _guard = builder.msg_test(
25102476
format!("book {}", self.name),
2511-
None,
2512-
(test_compiler.host, test_compiler.stage - 1),
2513-
host,
2477+
test_compiler.host,
2478+
test_compiler.stage,
25142479
);
25152480

25162481
// Do a breadth-first traversal of the `src/doc` directory and just run
@@ -2653,13 +2618,7 @@ impl Step for ErrorIndex {
26532618
let mut tool = tool::ErrorIndex::command(builder, self.compilers);
26542619
tool.arg("markdown").arg(&output);
26552620

2656-
let guard = builder.msg(
2657-
Kind::Test,
2658-
"error-index",
2659-
None,
2660-
self.compilers.build_compiler(),
2661-
target_compiler.host,
2662-
);
2621+
let guard = builder.msg_test("error-index", target_compiler.host, target_compiler.stage);
26632622
let _time = helpers::timeit(builder);
26642623
tool.run_capture(builder);
26652624
drop(guard);
@@ -2755,14 +2714,12 @@ fn run_cargo_test<'a>(
27552714
description: impl Into<Option<&'a str>>,
27562715
target: TargetSelection,
27572716
builder: &Builder<'_>,
2758-
mode: impl Into<Option<Mode>>,
27592717
) -> bool {
2760-
let mode = mode.into();
27612718
let compiler = cargo.compiler();
27622719
let mut cargo = prepare_cargo_test(cargo, libtest_args, crates, target, builder);
27632720
let _time = helpers::timeit(builder);
27642721
let _group =
2765-
description.into().and_then(|what| builder.msg(Kind::Test,what, mode, compiler, target));
2722+
description.into().and_then(|what| builder.msg_test(what, target, compiler.stage + 1));
27662723

27672724
#[cfg(feature = "build-metrics")]
27682725
builder.metrics.begin_test_suite(
@@ -2989,15 +2946,7 @@ impl Step for Crate {
29892946
crates.push("alloctests".to_owned());
29902947
}
29912948

2992-
run_cargo_test(
2993-
cargo,
2994-
&[],
2995-
&crates,
2996-
&*crate_description(&self.crates),
2997-
target,
2998-
builder,
2999-
mode,
3000-
);
2949+
run_cargo_test(cargo, &[], &crates, &*crate_description(&self.crates), target, builder);
30012950
}
30022951
}
30032952

@@ -3091,15 +3040,7 @@ impl Step for CrateRustdoc {
30913040
dylib_path.insert(0, PathBuf::from(&*libdir));
30923041
cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
30933042

3094-
run_cargo_test(
3095-
cargo,
3096-
&[],
3097-
&["rustdoc:0.0.0".to_string()],
3098-
"rustdoc",
3099-
target,
3100-
builder,
3101-
Mode::ToolRustc,
3102-
);
3043+
run_cargo_test(cargo, &[], &["rustdoc:0.0.0".to_string()], "rustdoc", target, builder);
31033044
}
31043045
}
31053046

@@ -3158,7 +3099,6 @@ impl Step for CrateRustdocJsonTypes {
31583099
"rustdoc-json-types",
31593100
target,
31603101
builder,
3161-
Mode::ToolTarget,
31623102
);
31633103
}
31643104
}
@@ -3316,8 +3256,6 @@ impl Step for Bootstrap {
33163256
fn run(self, builder: &Builder<'_>) {
33173257
let host = builder.config.host_target;
33183258
let build_compiler = builder.compiler(0, host);
3319-
let _guard =
3320-
builder.msg(Kind::Test, "bootstrap", Mode::ToolBootstrap, build_compiler, host);
33213259

33223260
// Some tests require cargo submodule to be present.
33233261
builder.build.require_submodule("src/tools/cargo", None);
@@ -3356,7 +3294,7 @@ impl Step for Bootstrap {
33563294

33573295
// bootstrap tests are racy on directory creation so just run them one at a time.
33583296
// Since there's not many this shouldn't be a problem.
3359-
run_cargo_test(cargo, &["--test-threads=1"], &[], None, host, builder,Mode::ToolBootstrap);
3297+
run_cargo_test(cargo, &["--test-threads=1"], &[], None, host, builder);
33603298
}
33613299

33623300
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
@@ -3416,7 +3354,11 @@ impl Step for TierCheck {
34163354
cargo.arg("--verbose");
34173355
}
34183356

3419-
let _guard = builder.msg_test("platform support check", self.test_compiler);
3357+
let _guard = builder.msg_test(
3358+
"platform support check",
3359+
self.test_compiler.host,
3360+
self.test_compiler.stage,
3361+
);
34203362
BootstrapCommand::from(cargo).delay_failure().run(builder);
34213363
}
34223364

@@ -3495,9 +3437,8 @@ impl Step for RustInstaller {
34953437
&[],
34963438
);
34973439

3498-
let _guard =
3499-
builder.msg(Kind::Test, "rust-installer", None, build_compiler, bootstrap_host);
3500-
run_cargo_test(cargo, &[], &[], None, bootstrap_host, builder, Mode::ToolBootstrap);
3440+
let _guard = builder.msg_test("rust-installer", bootstrap_host, 1);
3441+
run_cargo_test(cargo, &[], &[], None, bootstrap_host, builder);
35013442

35023443
// We currently don't support running the test.sh script outside linux(?) environments.
35033444
// Eventually this should likely migrate to #[test]s in rust-installer proper rather than a
@@ -3668,7 +3609,11 @@ impl Step for CodegenCranelift {
36683609
// Avoid incremental cache issues when changing rustc
36693610
cargo.env("CARGO_BUILD_INCREMENTAL", "false");
36703611

3671-
let _guard = builder.msg_test("rustc_codegen_cranelift", target_compiler);
3612+
let _guard = builder.msg_test(
3613+
"rustc_codegen_cranelift",
3614+
target_compiler.host,
3615+
target_compiler.stage,
3616+
);
36723617

36733618
// FIXME handle vendoring for source tarballs before removing the --skip-test below
36743619
let download_dir = builder.out.join("cg_clif_download");
@@ -3763,7 +3708,11 @@ impl Step for CodegenGCC {
37633708
.extra_rust_args(&["-Csymbol-mangling-version=v0", "-Cpanic=abort"]),
37643709
);
37653710

3766-
let _guard = builder.msg_test("rustc_codegen_gcc", compilers.build_compiler());
3711+
let _guard = builder.msg_test(
3712+
"rustc_codegen_gcc",
3713+
compilers.target(),
3714+
compilers.target_compiler().stage,
3715+
);
37673716

37683717
let mut cargo = builder::Cargo::new(
37693718
builder,
@@ -3868,7 +3817,7 @@ impl Step for TestFloatParse {
38683817
);
38693818
cargo_test.allow_features(TEST_FLOAT_PARSE_ALLOW_FEATURES);
38703819

3871-
run_cargo_test(cargo_test, &[], &[], "test-float-parse", target, builder,Mode::ToolStd);
3820+
run_cargo_test(cargo_test, &[], &[], "test-float-parse", target, builder);
38723821

38733822
// Run the actual parse tests.
38743823
let mut cargo_run = tool::prepare_tool_cargo(

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /