Skip to content

Commit 796835f

Browse files
committed
Make ./x test compiler actually run the compiler unit tests
1 parent 14ee63a commit 796835f

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

Diff for: src/bootstrap/src/core/builder/mod.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -922,13 +922,17 @@ impl<'a> Builder<'a> {
922922
test::Incremental,
923923
test::Debuginfo,
924924
test::UiFullDeps,
925-
test::CodegenCranelift,
926-
test::CodegenGCC,
927925
test::Rustdoc,
928926
test::CoverageRunRustdoc,
929927
test::Pretty,
930928
test::Crate,
931929
test::CrateLibrustc,
930+
// The cranelift and gcc tests need to be listed after the
931+
// compiler unit tests (CrateLibrustc) so that they don't
932+
// hijack the whole `compiler` directory during path matching.
933+
// <https://github.com/rust-lang/rust/pull/134919>
934+
test::CodegenCranelift,
935+
test::CodegenGCC,
932936
test::CrateRustdoc,
933937
test::CrateRustdocJsonTypes,
934938
test::CrateBootstrap,

Diff for: src/bootstrap/src/core/builder/tests.rs

+18
Original file line numberDiff line numberDiff line change
@@ -786,3 +786,21 @@ mod sysroot_target_dirs {
786786
);
787787
}
788788
}
789+
790+
/// Regression test for <https://github.com/rust-lang/rust/issues/134916>.
791+
///
792+
/// The command `./x test compiler` should invoke the step that runs unit tests
793+
/// for (most) compiler crates; it should not be hijacked by the cg_clif or
794+
/// cg_gcc tests instead.
795+
#[test]
796+
fn test_test_compiler() {
797+
let cmd = &["test", "compiler"].map(str::to_owned);
798+
let config = configure_with_args(cmd, &[TEST_TRIPLE_1], &[TEST_TRIPLE_1]);
799+
let cache = run_build(&config.paths.clone(), config);
800+
801+
let compiler = cache.contains::<test::CrateLibrustc>();
802+
let cranelift = cache.contains::<test::CodegenCranelift>();
803+
let gcc = cache.contains::<test::CodegenGCC>();
804+
805+
assert_eq!((compiler, cranelift, gcc), (true, false, false));
806+
}

0 commit comments

Comments
 (0)