about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2024-12-31 14:12:45 +1100
committerGitHub <noreply@github.com>2024-12-31 14:12:45 +1100
commita777f4a7931ee6748c4deef2bd334f7c14b80817 (patch)
tree42489369fe93a768f5d0e2ce66e37d1c0cef77a3 /src/bootstrap
parent4e5fec2f1ea4b1cfecaa14304c9f56de59b344cb (diff)
parent796835f376fccba1879c13ab40afda64c99551e2 (diff)
downloadrust-a777f4a7931ee6748c4deef2bd334f7c14b80817.tar.gz
rust-a777f4a7931ee6748c4deef2bd334f7c14b80817.zip
Rollup merge of #134919 - Zalathar:x-test-compiler, r=jieyouxu
bootstrap: Make `./x test compiler` actually run the compiler unit tests

Fixes #134916.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/core/builder/mod.rs8
-rw-r--r--src/bootstrap/src/core/builder/tests.rs18
2 files changed, 24 insertions, 2 deletions
diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs
index 18beaf3676d..b000d8775cf 100644
--- a/src/bootstrap/src/core/builder/mod.rs
+++ b/src/bootstrap/src/core/builder/mod.rs
@@ -922,13 +922,17 @@ impl<'a> Builder<'a> {
                 test::Incremental,
                 test::Debuginfo,
                 test::UiFullDeps,
-                test::CodegenCranelift,
-                test::CodegenGCC,
                 test::Rustdoc,
                 test::CoverageRunRustdoc,
                 test::Pretty,
                 test::Crate,
                 test::CrateLibrustc,
+                // The cranelift and gcc tests need to be listed after the
+                // compiler unit tests (CrateLibrustc) so that they don't
+                // hijack the whole `compiler` directory during path matching.
+                // <https://github.com/rust-lang/rust/pull/134919>
+                test::CodegenCranelift,
+                test::CodegenGCC,
                 test::CrateRustdoc,
                 test::CrateRustdocJsonTypes,
                 test::CrateBootstrap,
diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs
index a0acd839374..21694cf46fe 100644
--- a/src/bootstrap/src/core/builder/tests.rs
+++ b/src/bootstrap/src/core/builder/tests.rs
@@ -786,3 +786,21 @@ mod sysroot_target_dirs {
         );
     }
 }
+
+/// Regression test for <https://github.com/rust-lang/rust/issues/134916>.
+///
+/// The command `./x test compiler` should invoke the step that runs unit tests
+/// for (most) compiler crates; it should not be hijacked by the cg_clif or
+/// cg_gcc tests instead.
+#[test]
+fn test_test_compiler() {
+    let cmd = &["test", "compiler"].map(str::to_owned);
+    let config = configure_with_args(cmd, &[TEST_TRIPLE_1], &[TEST_TRIPLE_1]);
+    let cache = run_build(&config.paths.clone(), config);
+
+    let compiler = cache.contains::<test::CrateLibrustc>();
+    let cranelift = cache.contains::<test::CodegenCranelift>();
+    let gcc = cache.contains::<test::CodegenGCC>();
+
+    assert_eq!((compiler, cranelift, gcc), (true, false, false));
+}