From 0f76784d72fba47144192a8ebff5745b93ec2876 Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 5 Sep 2025 15:50:39 +0800 Subject: [PATCH 01/12] bootstrap: split `run-make` into {`run-make`,`run-make-cargo`} test suites So that contributors who don't need to run `run-make` tests that require in-tree `cargo` can run the non-cargo `run-make` tests without having to wait for `cargo` (which would require rebuilding as the build cache would be invalidated by compiler modifications without some kind of `--keep-stage-cargo`). --- src/bootstrap/src/core/build_steps/test.rs | 52 +++++++++++++++------- src/bootstrap/src/core/builder/mod.rs | 3 +- src/bootstrap/src/core/builder/tests.rs | 46 ++++++++++++++++--- 3 files changed, 80 insertions(+), 21 deletions(-) diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index cb81d738666a3..4f839bdf7b83f 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1522,6 +1522,12 @@ test!(Pretty { }); test!(RunMake { path: "tests/run-make", mode: "run-make", suite: "run-make", default: true }); +test!(RunMakeCargo { + path: "tests/run-make-cargo", + mode: "run-make", + suite: "run-make-cargo", + default: true +}); test!(AssemblyLlvm { path: "tests/assembly-llvm", @@ -1773,7 +1779,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the target, }); } - if suite == "run-make" { + if mode == "run-make" { builder.tool_exe(Tool::RunMakeSupport); } @@ -1816,25 +1822,41 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the let is_rustdoc = suite == "rustdoc-ui" || suite == "rustdoc-js"; + // There are (potentially) 2 `cargo`s to consider: + // + // - A "bootstrap" cargo, which is the same cargo used to build bootstrap itself, and is + // used to build the `run-make` test recipes and the `run-make-support` test library. All + // of these may not use unstable rustc/cargo features. + // - An in-tree cargo, which should be considered as under test. The `run-make-cargo` test + // suite is intended to support the use case of testing the "toolchain" (that is, at the + // minimum the interaction between in-tree cargo + rustc) together. + // + // For build time and iteration purposes, we partition `run-make` tests which needs an + // in-tree cargo (a smaller subset) versus `run-make` tests that do not into two test + // suites, `run-make` and `run-make-cargo`. That way, contributors who do not need to run + // the `run-make` tests that need in-tree cargo do not need to spend time building in-tree + // cargo. if mode == "run-make" { - let cargo_path = if test_compiler.stage == 0 { - // If we're using `--stage 0`, we should provide the bootstrap cargo. - builder.initial_cargo.clone() - } else { - builder - .ensure(tool::Cargo::from_build_compiler( - builder.compiler(test_compiler.stage - 1, test_compiler.host), - test_compiler.host, - )) - .tool_path - }; - - cmd.arg("--cargo-path").arg(cargo_path); - // We need to pass the compiler that was used to compile run-make-support, // because we have to use the same compiler to compile rmake.rs recipes. let stage0_rustc_path = builder.compiler(0, test_compiler.host); cmd.arg("--stage0-rustc-path").arg(builder.rustc(stage0_rustc_path)); + + if suite == "run-make-cargo" { + let cargo_path = if test_compiler.stage == 0 { + // If we're using `--stage 0`, we should provide the bootstrap cargo. + builder.initial_cargo.clone() + } else { + builder + .ensure(tool::Cargo::from_build_compiler( + builder.compiler(test_compiler.stage - 1, test_compiler.host), + test_compiler.host, + )) + .tool_path + }; + + cmd.arg("--cargo-path").arg(cargo_path); + } } // Avoid depending on rustdoc when we don't need it. diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index 627085df812c5..0cbf258f0fd92 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -444,6 +444,7 @@ const PATH_REMAP: &[(&str, &[&str])] = &[ "tests/mir-opt", "tests/pretty", "tests/run-make", + "tests/run-make-cargo", "tests/rustdoc", "tests/rustdoc-gui", "tests/rustdoc-js", @@ -1127,8 +1128,8 @@ impl<'a> Builder<'a> { test::RustInstaller, test::TestFloatParse, test::CollectLicenseMetadata, - // Run run-make last, since these won't pass without make on Windows test::RunMake, + test::RunMakeCargo, ), Kind::Miri => describe!(test::Crate), Kind::Bench => describe!(test::Crate, test::CrateLibrustc), diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs index 9e8c13eb4dec7..4dad47daf8888 100644 --- a/src/bootstrap/src/core/builder/tests.rs +++ b/src/bootstrap/src/core/builder/tests.rs @@ -2099,8 +2099,9 @@ mod snapshot { [build] rustc 0 -> HtmlChecker 1 [test] html-check [build] rustc 0 -> RunMakeSupport 1 - [build] rustc 0 -> cargo 1 [test] compiletest-run-make 1 + [build] rustc 0 -> cargo 1 + [test] compiletest-run-make-cargo 1 "); } @@ -2118,7 +2119,6 @@ mod snapshot { [test] compiletest-ui 1 [test] compiletest-ui-fulldeps 1 [build] rustc 0 -> RunMakeSupport 1 - [build] rustc 0 -> cargo 1 [build] rustdoc 1 [test] compiletest-run-make 1 [test] compiletest-rustdoc 1 @@ -2147,7 +2147,6 @@ mod snapshot { [build] rustc 2 -> rustc 3 [test] compiletest-ui-fulldeps 2 [build] rustc 0 -> RunMakeSupport 1 - [build] rustc 1 -> cargo 2 [build] rustdoc 2 [test] compiletest-run-make 2 [test] compiletest-rustdoc 2 @@ -2181,7 +2180,6 @@ mod snapshot { [build] rustc 2 -> rustc 3 [test] compiletest-ui-fulldeps 2 [build] rustc 0 -> RunMakeSupport 1 - [build] rustc 1 -> cargo 2 [build] rustdoc 2 [test] compiletest-run-make 2 [test] compiletest-rustdoc 2 @@ -2276,8 +2274,9 @@ mod snapshot { [build] rustc 0 -> HtmlChecker 1 [test] html-check [build] rustc 0 -> RunMakeSupport 1 - [build] rustc 1 -> cargo 2 [test] compiletest-run-make 2 + [build] rustc 1 -> cargo 2 + [test] compiletest-run-make-cargo 2 "); } @@ -2411,6 +2410,43 @@ mod snapshot { "); } + // Differential snapshots for `./x test run-make` run `./x test run-make-cargo`: only + // `run-make-cargo` should build an in-tree cargo, running `./x test run-make` should not. + #[test] + fn test_run_make_no_cargo() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("test") + .path("run-make") + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 0 -> RunMakeSupport 1 + [build] rustc 1 -> std 1 + [build] rustc 0 -> Compiletest 1 + [build] rustdoc 1 + [test] compiletest-run-make 1 + "); + } + + #[test] + fn test_run_make_cargo_builds_cargo() { + let ctx = TestCtx::new(); + insta::assert_snapshot!( + ctx.config("test") + .path("run-make-cargo") + .render_steps(), @r" + [build] llvm + [build] rustc 0 -> rustc 1 + [build] rustc 0 -> RunMakeSupport 1 + [build] rustc 1 -> std 1 + [build] rustc 0 -> Compiletest 1 + [build] rustc 0 -> cargo 1 + [build] rustdoc 1 + [test] compiletest-run-make-cargo 1 + "); + } + #[test] fn doc_all() { let ctx = TestCtx::new(); From f220710ace9d8caf1993d76469490bf60f76356a Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 5 Sep 2025 16:02:31 +0800 Subject: [PATCH 02/12] compiletest: implement {`run-make`,`run-make-cargo`} test suite split - `run-make` test suite will now no longer receive a `cargo`. - NOTE: the user could technically still write `Command::new("cargo")` which might find *a* cargo from the environment, but that is not a supported case. - `run-make-cargo` will receive a built in-tree `cargo`. --- src/tools/compiletest/src/common.rs | 4 +--- src/tools/compiletest/src/directives.rs | 2 +- src/tools/compiletest/src/runtest/run_make.rs | 11 ++++++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 62fdee987355a..143ccdcb9e520 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -67,6 +67,7 @@ string_enum! { MirOpt => "mir-opt", Pretty => "pretty", RunMake => "run-make", + RunMakeCargo => "run-make-cargo", Rustdoc => "rustdoc", RustdocGui => "rustdoc-gui", RustdocJs => "rustdoc-js", @@ -269,9 +270,6 @@ pub struct Config { /// between e.g. beta `cargo` vs in-tree `cargo`. /// /// FIXME: maybe rename this to reflect that this is a *staged* host cargo. - /// - /// FIXME(#134109): split `run-make` into two test suites, a test suite *with* staged cargo, and - /// another test suite *without*. pub cargo_path: Option, /// Path to the stage 0 `rustc` used to build `run-make` recipes. This must not be confused with diff --git a/src/tools/compiletest/src/directives.rs b/src/tools/compiletest/src/directives.rs index f2ad049d5265a..857953072c436 100644 --- a/src/tools/compiletest/src/directives.rs +++ b/src/tools/compiletest/src/directives.rs @@ -1012,7 +1012,7 @@ impl Config { if let Some(raw) = self.parse_name_value_directive(line, "revisions", testfile, line_number) { if self.mode == TestMode::RunMake { - panic!("`run-make` tests do not support revisions: {}", testfile); + panic!("`run-make` mode tests do not support revisions: {}", testfile); } let mut duplicates: HashSet<_> = existing.iter().cloned().collect(); diff --git a/src/tools/compiletest/src/runtest/run_make.rs b/src/tools/compiletest/src/runtest/run_make.rs index 8a0e45cf8ca35..738f504d5c1cf 100644 --- a/src/tools/compiletest/src/runtest/run_make.rs +++ b/src/tools/compiletest/src/runtest/run_make.rs @@ -5,11 +5,12 @@ use build_helper::fs::{ignore_not_found, recursive_remove}; use camino::{Utf8Path, Utf8PathBuf}; use super::{ProcRes, TestCx, disable_error_reporting}; +use crate::common::TestSuite; use crate::util::{copy_dir_all, dylib_env_var}; impl TestCx<'_> { pub(super) fn run_rmake_test(&self) { - // For `run-make` V2, we need to perform 2 steps to build and run a `run-make` V2 recipe + // For `run-make`, we need to perform 2 steps to build and run a `run-make` recipe // (`rmake.rs`) to run the actual tests. The support library is already built as a tool rust // library and is available under // `build/$HOST/bootstrap-tools/$TARGET/release/librun_make_support.rlib`. @@ -189,8 +190,12 @@ impl TestCx<'_> { // through a specific CI runner). .env("LLVM_COMPONENTS", &self.config.llvm_components); - if let Some(ref cargo) = self.config.cargo_path { - cmd.env("CARGO", cargo); + // Only `run-make-cargo` test suite gets an in-tree `cargo`, not `run-make`. + if self.config.suite == TestSuite::RunMakeCargo { + cmd.env( + "CARGO", + self.config.cargo_path.as_ref().expect("cargo must be built and made available"), + ); } if let Some(ref rustdoc) = self.config.rustdoc_path { From aebcbe0a4b1bb7df327bccf94a82117b4ca99a9f Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 5 Sep 2025 16:10:36 +0800 Subject: [PATCH 03/12] `run-make-support`: handle unavailable in-tree cargo under `run-make` test suite --- .../run-make-support/src/external_deps/cargo.rs | 14 ++++++++++---- src/tools/run-make-support/src/lib.rs | 5 +++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/tools/run-make-support/src/external_deps/cargo.rs b/src/tools/run-make-support/src/external_deps/cargo.rs index 8da9f002c41b3..3f2d0ce14e3bc 100644 --- a/src/tools/run-make-support/src/external_deps/cargo.rs +++ b/src/tools/run-make-support/src/external_deps/cargo.rs @@ -1,11 +1,17 @@ use crate::command::Command; -use crate::env_var; use crate::util::set_host_compiler_dylib_path; -/// Returns a command that can be used to invoke cargo. The cargo is provided by compiletest -/// through the `CARGO` env var. +/// Returns a command that can be used to invoke in-tree cargo. The cargo is provided by compiletest +/// through the `CARGO` env var, and is **only** available for the `run-make-cargo` test suite. pub fn cargo() -> Command { - let mut cmd = Command::new(env_var("CARGO")); + let cargo_path = std::env::var("CARGO").unwrap_or_else(|e| { + panic!( + "in-tree `cargo` should be available for `run-make-cargo` test suite, but not \ + `run-make` test suite: {e}" + ) + }); + + let mut cmd = Command::new(cargo_path); set_host_compiler_dylib_path(&mut cmd); cmd } diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs index 191e205f2577f..fef75401d9456 100644 --- a/src/tools/run-make-support/src/lib.rs +++ b/src/tools/run-make-support/src/lib.rs @@ -1,7 +1,8 @@ //! `run-make-support` is a support library for run-make tests. It provides command wrappers and //! convenience utility functions to help test writers reduce duplication. The support library -//! notably is built via cargo: this means that if your test wants some non-trivial utility, such -//! as `object` or `wasmparser`, they can be re-exported and be made available through this library. +//! notably is built via bootstrap cargo: this means that if your test wants some non-trivial +//! utility, such as `object` or `wasmparser`, they can be re-exported and be made available through +//! this library. #![warn(unreachable_pub)] From 7154d39231fd8051bc207dda3afba21a11b14fcd Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 5 Sep 2025 16:28:10 +0800 Subject: [PATCH 04/12] tests: move `run-make` tests requiring in-tree cargo to `run-make-cargo` test suite --- tests/{run-make => run-make-cargo}/apple-slow-tls/rmake.rs | 0 .../apple-slow-tls/tls_test/Cargo.toml | 0 .../apple-slow-tls/tls_test/src/main.rs | 0 tests/{run-make => run-make-cargo}/compiler-builtins/Cargo.toml | 0 tests/{run-make => run-make-cargo}/compiler-builtins/lib.rs | 0 tests/{run-make => run-make-cargo}/compiler-builtins/rmake.rs | 0 .../{run-make => run-make-cargo}/rustc-crates-on-stable/rmake.rs | 0 .../rustdoc-scrape-examples-paths/foo/Cargo.toml | 0 .../rustdoc-scrape-examples-paths/foo/examples/complex.rs | 0 .../rustdoc-scrape-examples-paths/foo/examples/tester.rs | 0 .../rustdoc-scrape-examples-paths/foo/src/lib.rs | 0 .../rustdoc-scrape-examples-paths/rmake.rs | 0 tests/{run-make => run-make-cargo}/thumb-none-cortex-m/rmake.rs | 0 .../thumb-none-qemu/example/.cargo/config.toml | 0 .../thumb-none-qemu/example/Cargo.lock | 0 .../thumb-none-qemu/example/Cargo.toml | 0 .../{run-make => run-make-cargo}/thumb-none-qemu/example/memory.x | 0 .../thumb-none-qemu/example/src/main.rs | 0 tests/{run-make => run-make-cargo}/thumb-none-qemu/rmake.rs | 0 tests/{run-make => run-make-cargo}/uefi-qemu/rmake.rs | 0 .../uefi-qemu/uefi_qemu_test/Cargo.lock | 0 .../uefi-qemu/uefi_qemu_test/Cargo.toml | 0 .../uefi-qemu/uefi_qemu_test/src/main.rs | 0 .../x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_asm.checks | 0 .../x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c.checks | 0 .../x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c_asm.checks | 0 .../x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx.checks | 0 .../x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx_asm.checks | 0 .../x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_asm.checks | 0 .../x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c.checks | 0 .../x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_asm.checks | 0 .../cmake_plus_one_c_global_asm.checks | 0 .../x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx.checks | 0 .../x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_asm.checks | 0 .../cmake_plus_one_cxx_global_asm.checks | 0 .../x86_64-fortanix-unknown-sgx-lvi/enclave/Cargo.toml | 0 .../x86_64-fortanix-unknown-sgx-lvi/enclave/build.rs | 0 .../x86_64-fortanix-unknown-sgx-lvi/enclave/foo.c | 0 .../x86_64-fortanix-unknown-sgx-lvi/enclave/foo_asm.s | 0 .../x86_64-fortanix-unknown-sgx-lvi/enclave/foo_cxx.cpp | 0 .../enclave/libcmake_foo/CMakeLists.txt | 0 .../enclave/libcmake_foo/src/foo.c | 0 .../enclave/libcmake_foo/src/foo_asm.s | 0 .../enclave/libcmake_foo/src/foo_cxx.cpp | 0 .../x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs | 0 .../x86_64-fortanix-unknown-sgx-lvi/jumpto.checks | 0 .../print.with_frame_pointers.checks | 0 .../print.without_frame_pointers.checks | 0 .../x86_64-fortanix-unknown-sgx-lvi/rmake.rs | 0 .../rust_plus_one_global_asm.checks | 0 .../x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks | 0 51 files changed, 0 insertions(+), 0 deletions(-) rename tests/{run-make => run-make-cargo}/apple-slow-tls/rmake.rs (100%) rename tests/{run-make => run-make-cargo}/apple-slow-tls/tls_test/Cargo.toml (100%) rename tests/{run-make => run-make-cargo}/apple-slow-tls/tls_test/src/main.rs (100%) rename tests/{run-make => run-make-cargo}/compiler-builtins/Cargo.toml (100%) rename tests/{run-make => run-make-cargo}/compiler-builtins/lib.rs (100%) rename tests/{run-make => run-make-cargo}/compiler-builtins/rmake.rs (100%) rename tests/{run-make => run-make-cargo}/rustc-crates-on-stable/rmake.rs (100%) rename tests/{run-make => run-make-cargo}/rustdoc-scrape-examples-paths/foo/Cargo.toml (100%) rename tests/{run-make => run-make-cargo}/rustdoc-scrape-examples-paths/foo/examples/complex.rs (100%) rename tests/{run-make => run-make-cargo}/rustdoc-scrape-examples-paths/foo/examples/tester.rs (100%) rename tests/{run-make => run-make-cargo}/rustdoc-scrape-examples-paths/foo/src/lib.rs (100%) rename tests/{run-make => run-make-cargo}/rustdoc-scrape-examples-paths/rmake.rs (100%) rename tests/{run-make => run-make-cargo}/thumb-none-cortex-m/rmake.rs (100%) rename tests/{run-make => run-make-cargo}/thumb-none-qemu/example/.cargo/config.toml (100%) rename tests/{run-make => run-make-cargo}/thumb-none-qemu/example/Cargo.lock (100%) rename tests/{run-make => run-make-cargo}/thumb-none-qemu/example/Cargo.toml (100%) rename tests/{run-make => run-make-cargo}/thumb-none-qemu/example/memory.x (100%) rename tests/{run-make => run-make-cargo}/thumb-none-qemu/example/src/main.rs (100%) rename tests/{run-make => run-make-cargo}/thumb-none-qemu/rmake.rs (100%) rename tests/{run-make => run-make-cargo}/uefi-qemu/rmake.rs (100%) rename tests/{run-make => run-make-cargo}/uefi-qemu/uefi_qemu_test/Cargo.lock (100%) rename tests/{run-make => run-make-cargo}/uefi-qemu/uefi_qemu_test/Cargo.toml (100%) rename tests/{run-make => run-make-cargo}/uefi-qemu/uefi_qemu_test/src/main.rs (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_asm.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c_asm.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx_asm.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_asm.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_asm.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_global_asm.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_asm.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/enclave/Cargo.toml (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/enclave/build.rs (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/enclave/foo.c (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_asm.s (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_cxx.cpp (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/CMakeLists.txt (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo.c (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_asm.s (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_cxx.cpp (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/jumpto.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/print.with_frame_pointers.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/print.without_frame_pointers.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/rmake.rs (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/rust_plus_one_global_asm.checks (100%) rename tests/{run-make => run-make-cargo}/x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks (100%) diff --git a/tests/run-make/apple-slow-tls/rmake.rs b/tests/run-make-cargo/apple-slow-tls/rmake.rs similarity index 100% rename from tests/run-make/apple-slow-tls/rmake.rs rename to tests/run-make-cargo/apple-slow-tls/rmake.rs diff --git a/tests/run-make/apple-slow-tls/tls_test/Cargo.toml b/tests/run-make-cargo/apple-slow-tls/tls_test/Cargo.toml similarity index 100% rename from tests/run-make/apple-slow-tls/tls_test/Cargo.toml rename to tests/run-make-cargo/apple-slow-tls/tls_test/Cargo.toml diff --git a/tests/run-make/apple-slow-tls/tls_test/src/main.rs b/tests/run-make-cargo/apple-slow-tls/tls_test/src/main.rs similarity index 100% rename from tests/run-make/apple-slow-tls/tls_test/src/main.rs rename to tests/run-make-cargo/apple-slow-tls/tls_test/src/main.rs diff --git a/tests/run-make/compiler-builtins/Cargo.toml b/tests/run-make-cargo/compiler-builtins/Cargo.toml similarity index 100% rename from tests/run-make/compiler-builtins/Cargo.toml rename to tests/run-make-cargo/compiler-builtins/Cargo.toml diff --git a/tests/run-make/compiler-builtins/lib.rs b/tests/run-make-cargo/compiler-builtins/lib.rs similarity index 100% rename from tests/run-make/compiler-builtins/lib.rs rename to tests/run-make-cargo/compiler-builtins/lib.rs diff --git a/tests/run-make/compiler-builtins/rmake.rs b/tests/run-make-cargo/compiler-builtins/rmake.rs similarity index 100% rename from tests/run-make/compiler-builtins/rmake.rs rename to tests/run-make-cargo/compiler-builtins/rmake.rs diff --git a/tests/run-make/rustc-crates-on-stable/rmake.rs b/tests/run-make-cargo/rustc-crates-on-stable/rmake.rs similarity index 100% rename from tests/run-make/rustc-crates-on-stable/rmake.rs rename to tests/run-make-cargo/rustc-crates-on-stable/rmake.rs diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/Cargo.toml b/tests/run-make-cargo/rustdoc-scrape-examples-paths/foo/Cargo.toml similarity index 100% rename from tests/run-make/rustdoc-scrape-examples-paths/foo/Cargo.toml rename to tests/run-make-cargo/rustdoc-scrape-examples-paths/foo/Cargo.toml diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/complex.rs b/tests/run-make-cargo/rustdoc-scrape-examples-paths/foo/examples/complex.rs similarity index 100% rename from tests/run-make/rustdoc-scrape-examples-paths/foo/examples/complex.rs rename to tests/run-make-cargo/rustdoc-scrape-examples-paths/foo/examples/complex.rs diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/tester.rs b/tests/run-make-cargo/rustdoc-scrape-examples-paths/foo/examples/tester.rs similarity index 100% rename from tests/run-make/rustdoc-scrape-examples-paths/foo/examples/tester.rs rename to tests/run-make-cargo/rustdoc-scrape-examples-paths/foo/examples/tester.rs diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/src/lib.rs b/tests/run-make-cargo/rustdoc-scrape-examples-paths/foo/src/lib.rs similarity index 100% rename from tests/run-make/rustdoc-scrape-examples-paths/foo/src/lib.rs rename to tests/run-make-cargo/rustdoc-scrape-examples-paths/foo/src/lib.rs diff --git a/tests/run-make/rustdoc-scrape-examples-paths/rmake.rs b/tests/run-make-cargo/rustdoc-scrape-examples-paths/rmake.rs similarity index 100% rename from tests/run-make/rustdoc-scrape-examples-paths/rmake.rs rename to tests/run-make-cargo/rustdoc-scrape-examples-paths/rmake.rs diff --git a/tests/run-make/thumb-none-cortex-m/rmake.rs b/tests/run-make-cargo/thumb-none-cortex-m/rmake.rs similarity index 100% rename from tests/run-make/thumb-none-cortex-m/rmake.rs rename to tests/run-make-cargo/thumb-none-cortex-m/rmake.rs diff --git a/tests/run-make/thumb-none-qemu/example/.cargo/config.toml b/tests/run-make-cargo/thumb-none-qemu/example/.cargo/config.toml similarity index 100% rename from tests/run-make/thumb-none-qemu/example/.cargo/config.toml rename to tests/run-make-cargo/thumb-none-qemu/example/.cargo/config.toml diff --git a/tests/run-make/thumb-none-qemu/example/Cargo.lock b/tests/run-make-cargo/thumb-none-qemu/example/Cargo.lock similarity index 100% rename from tests/run-make/thumb-none-qemu/example/Cargo.lock rename to tests/run-make-cargo/thumb-none-qemu/example/Cargo.lock diff --git a/tests/run-make/thumb-none-qemu/example/Cargo.toml b/tests/run-make-cargo/thumb-none-qemu/example/Cargo.toml similarity index 100% rename from tests/run-make/thumb-none-qemu/example/Cargo.toml rename to tests/run-make-cargo/thumb-none-qemu/example/Cargo.toml diff --git a/tests/run-make/thumb-none-qemu/example/memory.x b/tests/run-make-cargo/thumb-none-qemu/example/memory.x similarity index 100% rename from tests/run-make/thumb-none-qemu/example/memory.x rename to tests/run-make-cargo/thumb-none-qemu/example/memory.x diff --git a/tests/run-make/thumb-none-qemu/example/src/main.rs b/tests/run-make-cargo/thumb-none-qemu/example/src/main.rs similarity index 100% rename from tests/run-make/thumb-none-qemu/example/src/main.rs rename to tests/run-make-cargo/thumb-none-qemu/example/src/main.rs diff --git a/tests/run-make/thumb-none-qemu/rmake.rs b/tests/run-make-cargo/thumb-none-qemu/rmake.rs similarity index 100% rename from tests/run-make/thumb-none-qemu/rmake.rs rename to tests/run-make-cargo/thumb-none-qemu/rmake.rs diff --git a/tests/run-make/uefi-qemu/rmake.rs b/tests/run-make-cargo/uefi-qemu/rmake.rs similarity index 100% rename from tests/run-make/uefi-qemu/rmake.rs rename to tests/run-make-cargo/uefi-qemu/rmake.rs diff --git a/tests/run-make/uefi-qemu/uefi_qemu_test/Cargo.lock b/tests/run-make-cargo/uefi-qemu/uefi_qemu_test/Cargo.lock similarity index 100% rename from tests/run-make/uefi-qemu/uefi_qemu_test/Cargo.lock rename to tests/run-make-cargo/uefi-qemu/uefi_qemu_test/Cargo.lock diff --git a/tests/run-make/uefi-qemu/uefi_qemu_test/Cargo.toml b/tests/run-make-cargo/uefi-qemu/uefi_qemu_test/Cargo.toml similarity index 100% rename from tests/run-make/uefi-qemu/uefi_qemu_test/Cargo.toml rename to tests/run-make-cargo/uefi-qemu/uefi_qemu_test/Cargo.toml diff --git a/tests/run-make/uefi-qemu/uefi_qemu_test/src/main.rs b/tests/run-make-cargo/uefi-qemu/uefi_qemu_test/src/main.rs similarity index 100% rename from tests/run-make/uefi-qemu/uefi_qemu_test/src/main.rs rename to tests/run-make-cargo/uefi-qemu/uefi_qemu_test/src/main.rs diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_asm.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_asm.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_asm.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_asm.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c_asm.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c_asm.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c_asm.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_c_asm.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx_asm.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx_asm.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx_asm.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cc_plus_one_cxx_asm.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_asm.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_asm.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_asm.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_asm.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_asm.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_asm.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_asm.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_asm.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_global_asm.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_global_asm.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_global_asm.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_c_global_asm.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_asm.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_asm.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_asm.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_asm.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/Cargo.toml b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/Cargo.toml similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/Cargo.toml rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/Cargo.toml diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/build.rs b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/build.rs similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/build.rs rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/build.rs diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo.c b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/foo.c similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo.c rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/foo.c diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_asm.s b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_asm.s similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_asm.s rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_asm.s diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_cxx.cpp b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_cxx.cpp similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_cxx.cpp rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/foo_cxx.cpp diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/CMakeLists.txt b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/CMakeLists.txt similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/CMakeLists.txt rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/CMakeLists.txt diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo.c b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo.c similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo.c rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo.c diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_asm.s b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_asm.s similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_asm.s rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_asm.s diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_cxx.cpp b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_cxx.cpp similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_cxx.cpp rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/libcmake_foo/src/foo_cxx.cpp diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/enclave/src/main.rs diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/jumpto.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/jumpto.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/jumpto.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/jumpto.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.with_frame_pointers.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/print.with_frame_pointers.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.with_frame_pointers.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/print.with_frame_pointers.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.without_frame_pointers.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/print.without_frame_pointers.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.without_frame_pointers.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/print.without_frame_pointers.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rmake.rs b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/rmake.rs similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rmake.rs rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/rmake.rs diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rust_plus_one_global_asm.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/rust_plus_one_global_asm.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/rust_plus_one_global_asm.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/rust_plus_one_global_asm.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks b/tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks rename to tests/run-make-cargo/x86_64-fortanix-unknown-sgx-lvi/unw_getcontext.checks From 9504090e7de2651b23ff83aaff7ef6eceab0024c Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 5 Sep 2025 16:48:11 +0800 Subject: [PATCH 05/12] tests: update test instruction in `thumb-none-cortex-m` --- tests/run-make-cargo/thumb-none-cortex-m/rmake.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-make-cargo/thumb-none-cortex-m/rmake.rs b/tests/run-make-cargo/thumb-none-cortex-m/rmake.rs index 27afef874da64..6158b9c36da24 100644 --- a/tests/run-make-cargo/thumb-none-cortex-m/rmake.rs +++ b/tests/run-make-cargo/thumb-none-cortex-m/rmake.rs @@ -4,7 +4,7 @@ //! //! How to run this //! $ ./x.py clean -//! $ ./x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi tests/run-make +//! $ ./x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi tests/run-make-cargo //! //! Supported targets: //! - thumbv6m-none-eabi (Bare Cortex-M0, M0+, M1) From c959d3a54156593e58d480f53edafe681c031c19 Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 5 Sep 2025 16:47:35 +0800 Subject: [PATCH 06/12] ci: update jobs to also run `tests/run-make-cargo` For the ones that explicitly picks which test suite to run. --- .../docker/host-aarch64/aarch64-gnu-debug/Dockerfile | 2 +- src/ci/docker/host-x86_64/dist-various-1/Dockerfile | 2 +- src/ci/docker/host-x86_64/test-various/Dockerfile | 10 ++++++---- src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/ci/docker/host-aarch64/aarch64-gnu-debug/Dockerfile b/src/ci/docker/host-aarch64/aarch64-gnu-debug/Dockerfile index cf030f6830e5b..71de8f917fa2c 100644 --- a/src/ci/docker/host-aarch64/aarch64-gnu-debug/Dockerfile +++ b/src/ci/docker/host-aarch64/aarch64-gnu-debug/Dockerfile @@ -54,4 +54,4 @@ ENV RUST_CONFIGURE_ARGS \ ENV SCRIPT \ python3 ../x.py --stage 2 build && \ - python3 ../x.py --stage 2 test tests/run-make + python3 ../x.py --stage 2 test tests/run-make tests/run-make-cargo diff --git a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile index 4d5980027cac1..e59012ff6afa9 100644 --- a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile @@ -158,7 +158,7 @@ ENV RUST_CONFIGURE_ARGS \ --disable-docs ENV SCRIPT \ - python3 ../x.py --stage 2 test --host='' --target $RUN_MAKE_TARGETS tests/run-make && \ + python3 ../x.py --stage 2 test --host='' --target $RUN_MAKE_TARGETS tests/run-make tests/run-make-cargo && \ python3 ../x.py dist --host='' --target $TARGETS # sccache diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile index 6ff529c9e718b..e1c882d5b0850 100644 --- a/src/ci/docker/host-x86_64/test-various/Dockerfile +++ b/src/ci/docker/host-x86_64/test-various/Dockerfile @@ -60,9 +60,10 @@ RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v19.0 tar -xJ ENV PATH "$PATH:/wasmtime-v19.0.0-x86_64-linux" -ENV WASM_WASIP_TARGET=wasm32-wasip1 +ENV WASM_WASIP_TARGET=wasm32-wasip1 ENV WASM_WASIP_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_WASIP_TARGET \ tests/run-make \ + tests/run-make-cargo \ tests/ui \ tests/mir-opt \ tests/codegen-units \ @@ -73,6 +74,7 @@ ENV WASM_WASIP_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $ ENV NVPTX_TARGETS=nvptx64-nvidia-cuda ENV NVPTX_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $NVPTX_TARGETS \ tests/run-make \ + tests/run-make-cargo \ tests/assembly-llvm ENV MUSL_TARGETS=x86_64-unknown-linux-musl \ @@ -88,8 +90,8 @@ ENV UEFI_TARGETS=aarch64-unknown-uefi,i686-unknown-uefi,x86_64-unknown-uefi \ CC_x86_64_unknown_uefi=clang-11 \ CXX_x86_64_unknown_uefi=clang++-11 ENV UEFI_SCRIPT python3 /checkout/x.py --stage 2 build --host='' --target $UEFI_TARGETS && \ - python3 /checkout/x.py --stage 2 test tests/run-make/uefi-qemu/rmake.rs --target aarch64-unknown-uefi && \ - python3 /checkout/x.py --stage 2 test tests/run-make/uefi-qemu/rmake.rs --target i686-unknown-uefi && \ - python3 /checkout/x.py --stage 2 test tests/run-make/uefi-qemu/rmake.rs --target x86_64-unknown-uefi + python3 /checkout/x.py --stage 2 test tests/run-make-cargo/uefi-qemu/rmake.rs --target aarch64-unknown-uefi && \ + python3 /checkout/x.py --stage 2 test tests/run-make-cargo/uefi-qemu/rmake.rs --target i686-unknown-uefi && \ + python3 /checkout/x.py --stage 2 test tests/run-make-cargo/uefi-qemu/rmake.rs --target x86_64-unknown-uefi ENV SCRIPT $WASM_WASIP_SCRIPT && $NVPTX_SCRIPT && $MUSL_SCRIPT && $UEFI_SCRIPT diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile index 5052d86f0ac74..7e6a59aaf898e 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile @@ -56,4 +56,4 @@ ENV RUST_CONFIGURE_ARGS \ ENV SCRIPT \ python3 ../x.py --stage 2 build && \ python3 ../x.py --stage 2 test tests/ui && \ - python3 ../x.py --stage 2 test tests/run-make + python3 ../x.py --stage 2 test tests/run-make tests/run-make-cargo From e77a22f3c995e439d79dcf2b2c96835dbd0f2cb8 Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 5 Sep 2025 16:35:36 +0800 Subject: [PATCH 07/12] cg_clif: account for moved `tests/run-make-cargo/compiler-builtins` --- compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh index 52e02c857c7ad..476a6f311bbf4 100755 --- a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh +++ b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh @@ -121,7 +121,7 @@ rm tests/ui/abi/large-byval-align.rs # exceeds implementation limit of Cranelift # ============================================================ rm -r tests/run-make/remap-path-prefix-dwarf # requires llvm-dwarfdump rm -r tests/run-make/strip # same -rm -r tests/run-make/compiler-builtins # Expects lib/rustlib/src/rust to contains the standard library source +rm -r tests/run-make-cargo/compiler-builtins # Expects lib/rustlib/src/rust to contains the standard library source rm -r tests/run-make/translation # same rm -r tests/run-make/missing-unstable-trait-bound # This disables support for unstable features, but running cg_clif needs some unstable features rm -r tests/run-make/const-trait-stable-toolchain # same From 6543e4d2fa0113fef4177e92b73a5d7c6411a9ad Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 5 Sep 2025 21:24:45 +0800 Subject: [PATCH 08/12] cg_clif: run `run-make-cargo` test suite --- compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh index 476a6f311bbf4..62f1cc6a8933b 100755 --- a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh +++ b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh @@ -166,5 +166,5 @@ index 073116933bd..c3e4578204d 100644 EOF echo "[TEST] rustc test suite" -./x.py test --stage 0 --test-args=--no-capture tests/{codegen-units,run-make,ui,incremental} +./x.py test --stage 0 --test-args=--no-capture tests/{codegen-units,run-make,run-make-cargo,ui,incremental} popd From 1a2055a5252054e597655fc42df910f074ab0fbf Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 5 Sep 2025 21:39:29 +0800 Subject: [PATCH 09/12] cg_gcc: run `run-make-cargo` tests --- .../build_system/src/test.rs | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_codegen_gcc/build_system/src/test.rs b/compiler/rustc_codegen_gcc/build_system/src/test.rs index 3dd3fce2eec5d..1823aa71f408e 100644 --- a/compiler/rustc_codegen_gcc/build_system/src/test.rs +++ b/compiler/rustc_codegen_gcc/build_system/src/test.rs @@ -1083,11 +1083,12 @@ where fn test_rustc(env: &Env, args: &TestArg) -> Result<(), String> { test_rustc_inner(env, args, |_| Ok(false), false, "run-make")?; + test_rustc_inner(env, args, |_| Ok(false), false, "run-make-cargo")?; test_rustc_inner(env, args, |_| Ok(false), false, "ui") } fn test_failing_rustc(env: &Env, args: &TestArg) -> Result<(), String> { - let result1 = test_rustc_inner( + let run_make_result = test_rustc_inner( env, args, retain_files_callback("tests/failing-run-make-tests.txt", "run-make"), @@ -1095,7 +1096,15 @@ fn test_failing_rustc(env: &Env, args: &TestArg) -> Result<(), String> { "run-make", ); - let result2 = test_rustc_inner( + let run_make_cargo_result = test_rustc_inner( + env, + args, + retain_files_callback("tests/failing-run-make-tests.txt", "run-make-cargo"), + false, + "run-make", + ); + + let ui_result = test_rustc_inner( env, args, retain_files_callback("tests/failing-ui-tests.txt", "ui"), @@ -1103,7 +1112,7 @@ fn test_failing_rustc(env: &Env, args: &TestArg) -> Result<(), String> { "ui", ); - result1.and(result2) + run_make_result.and(run_make_cargo_result).and(ui_result) } fn test_successful_rustc(env: &Env, args: &TestArg) -> Result<(), String> { @@ -1120,6 +1129,13 @@ fn test_successful_rustc(env: &Env, args: &TestArg) -> Result<(), String> { remove_files_callback("tests/failing-run-make-tests.txt", "run-make"), false, "run-make", + )?; + test_rustc_inner( + env, + args, + remove_files_callback("tests/failing-run-make-tests.txt", "run-make-cargo"), + false, + "run-make-cargo", ) } From 34158add05c09a4a60162d5afb09d3c6e607a529 Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 5 Sep 2025 16:38:09 +0800 Subject: [PATCH 10/12] tidy: account for moved `tests/run-make/uefi-qemu` --- src/tools/tidy/src/deps.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 560f11ecf50ec..fee48bea144de 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -80,7 +80,7 @@ pub(crate) const WORKSPACES: &[(&str, ExceptionList, Option<(&[&str], &[&str])>, ("src/tools/rustbook", EXCEPTIONS_RUSTBOOK, None, &["src/doc/book", "src/doc/reference"]), ("src/tools/rustc-perf", EXCEPTIONS_RUSTC_PERF, None, &["src/tools/rustc-perf"]), ("src/tools/test-float-parse", EXCEPTIONS, None, &[]), - ("tests/run-make/uefi-qemu/uefi_qemu_test", EXCEPTIONS_UEFI_QEMU_TEST, None, &[]), + ("tests/run-make-cargo/uefi-qemu/uefi_qemu_test", EXCEPTIONS_UEFI_QEMU_TEST, None, &[]), // tidy-alphabetical-end ]; From 8665305f2b4c75b79de950d49002cf29a290f76b Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 5 Sep 2025 16:33:43 +0800 Subject: [PATCH 11/12] triagebot: account for new `tests/run-make-cargo` test suite --- triagebot.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/triagebot.toml b/triagebot.toml index b957c6465e602..eda48cfefb221 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -336,6 +336,7 @@ trigger_files = [ "tests/mir-opt", "tests/pretty", "tests/run-make", + "tests/run-make-cargo", "tests/ui", "tests/ui-fulldeps", ] @@ -592,6 +593,7 @@ trigger_files = [ [autolabel."A-run-make"] trigger_files = [ "tests/run-make", + "tests/run-make-cargo", "src/tools/run-make-support" ] @@ -1542,6 +1544,7 @@ dep-bumps = [ "/src/rustdoc-json-types" = ["rustdoc"] "/src/stage0" = ["bootstrap"] "/tests/run-make" = ["@jieyouxu"] +"/tests/run-make-cargo" = ["@jieyouxu"] "/tests/rustdoc" = ["rustdoc"] "/tests/rustdoc-gui" = ["rustdoc"] "/tests/rustdoc-js-std" = ["rustdoc"] From f755e64c36edf552a222a165fca3027f1063c817 Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 5 Sep 2025 17:00:42 +0800 Subject: [PATCH 12/12] rustc-dev-guide: update docs for `run-make-cargo` --- src/doc/rustc-dev-guide/src/tests/adding.md | 2 + .../src/tests/best-practices.md | 8 ++-- .../rustc-dev-guide/src/tests/compiletest.md | 15 +++++-- .../rustc-dev-guide/src/tests/directives.md | 40 +++++++++---------- src/doc/rustc-dev-guide/src/tests/misc.md | 4 +- 5 files changed, 39 insertions(+), 30 deletions(-) diff --git a/src/doc/rustc-dev-guide/src/tests/adding.md b/src/doc/rustc-dev-guide/src/tests/adding.md index e5c26bef11d0c..46b8a1e4cf4b4 100644 --- a/src/doc/rustc-dev-guide/src/tests/adding.md +++ b/src/doc/rustc-dev-guide/src/tests/adding.md @@ -29,6 +29,8 @@ guidelines: suites. - Need to inspect the resulting binary in some way? Or if all the other test suites are too limited for your purposes? Then use `run-make`. + - Use `run-make-cargo` if you need to exercise in-tree `cargo` in conjunction + with in-tree `rustc`. - Check out the [compiletest] chapter for more specialized test suites. After deciding on which kind of test to add, see [best diff --git a/src/doc/rustc-dev-guide/src/tests/best-practices.md b/src/doc/rustc-dev-guide/src/tests/best-practices.md index be00207e3fb93..efc626035b79d 100644 --- a/src/doc/rustc-dev-guide/src/tests/best-practices.md +++ b/src/doc/rustc-dev-guide/src/tests/best-practices.md @@ -83,10 +83,10 @@ related tests. - E.g. for an implementation of RFC 2093 specifically, we can group a collection of tests under `tests/ui/rfc-2093-infer-outlives/`. For the directory name, include what the RFC is about. -- For the [`run-make`] test suite, each `rmake.rs` must be contained within an - immediate subdirectory under `tests/run-make/`. Further nesting is not - presently supported. Avoid including issue number in the directory name too, - include that info in a comment inside `rmake.rs`. +- For the [`run-make`]/`run-make-support` test suites, each `rmake.rs` must + be contained within an immediate subdirectory under `tests/run-make/` or + `tests/run-make-cargo/` respectively. Further nesting is not presently + supported. Avoid using _only_ an issue number for the test name as well. ## Test descriptions diff --git a/src/doc/rustc-dev-guide/src/tests/compiletest.md b/src/doc/rustc-dev-guide/src/tests/compiletest.md index 4980ed845d6dd..a4a729935fa47 100644 --- a/src/doc/rustc-dev-guide/src/tests/compiletest.md +++ b/src/doc/rustc-dev-guide/src/tests/compiletest.md @@ -397,13 +397,19 @@ your test, causing separate files to be generated for 32bit and 64bit systems. ### `run-make` tests -The tests in [`tests/run-make`] are general-purpose tests using Rust *recipes*, -which are small programs (`rmake.rs`) allowing arbitrary Rust code such as -`rustc` invocations, and is supported by a [`run_make_support`] library. Using -Rust recipes provide the ultimate in flexibility. +The tests in [`tests/run-make`] and [`tests/run-make-cargo`] are general-purpose +tests using Rust *recipes*, which are small programs (`rmake.rs`) allowing +arbitrary Rust code such as `rustc` invocations, and is supported by a +[`run_make_support`] library. Using Rust recipes provide the ultimate in +flexibility. `run-make` tests should be used if no other test suites better suit your needs. +The `run-make-cargo` test suite additionally builds an in-tree `cargo` to support +use cases that require testing in-tree `cargo` in conjunction with in-tree `rustc`. +The `run-make` test suite does not have access to in-tree `cargo` (so it can be the +faster-to-iterate test suite). + #### Using Rust recipes Each test should be in a separate directory with a `rmake.rs` Rust program, @@ -476,6 +482,7 @@ Then add a corresponding entry to `"rust-analyzer.linkedProjects"` ``` [`tests/run-make`]: https://github.com/rust-lang/rust/tree/master/tests/run-make +[`tests/run-make-cargo`]: https://github.com/rust-lang/rust/tree/master/tests/run-make-cargo [`run_make_support`]: https://github.com/rust-lang/rust/tree/master/src/tools/run-make-support ### Coverage tests diff --git a/src/doc/rustc-dev-guide/src/tests/directives.md b/src/doc/rustc-dev-guide/src/tests/directives.md index fbbeb7e97d3b7..4ff6b7cb10f00 100644 --- a/src/doc/rustc-dev-guide/src/tests/directives.md +++ b/src/doc/rustc-dev-guide/src/tests/directives.md @@ -52,14 +52,14 @@ not be exhaustive. Directives can generally be found by browsing the See [Building auxiliary crates](compiletest.html#building-auxiliary-crates) -| Directive | Explanation | Supported test suites | Possible values | -|-----------------------|-------------------------------------------------------------------------------------------------------|-----------------------|-----------------------------------------------| -| `aux-bin` | Build a aux binary, made available in `auxiliary/bin` relative to test directory | All except `run-make` | Path to auxiliary `.rs` file | -| `aux-build` | Build a separate crate from the named source file | All except `run-make` | Path to auxiliary `.rs` file | -| `aux-crate` | Like `aux-build` but makes available as extern prelude | All except `run-make` | `=` | -| `aux-codegen-backend` | Similar to `aux-build` but pass the compiled dylib to `-Zcodegen-backend` when building the main file | `ui-fulldeps` | Path to codegen backend file | -| `proc-macro` | Similar to `aux-build`, but for aux forces host and don't use `-Cprefer-dynamic`[^pm]. | All except `run-make` | Path to auxiliary proc-macro `.rs` file | -| `build-aux-docs` | Build docs for auxiliaries as well. Note that this only works with `aux-build`, not `aux-crate`. | All except `run-make` | N/A | +| Directive | Explanation | Supported test suites | Possible values | +|-----------------------|-------------------------------------------------------------------------------------------------------|----------------------------------------|-----------------------------------------------| +| `aux-bin` | Build a aux binary, made available in `auxiliary/bin` relative to test directory | All except `run-make`/`run-make-cargo` | Path to auxiliary `.rs` file | +| `aux-build` | Build a separate crate from the named source file | All except `run-make`/`run-make-cargo` | Path to auxiliary `.rs` file | +| `aux-crate` | Like `aux-build` but makes available as extern prelude | All except `run-make`/`run-make-cargo` | `=` | +| `aux-codegen-backend` | Similar to `aux-build` but pass the compiled dylib to `-Zcodegen-backend` when building the main file | `ui-fulldeps` | Path to codegen backend file | +| `proc-macro` | Similar to `aux-build`, but for aux forces host and don't use `-Cprefer-dynamic`[^pm]. | All except `run-make`/`run-make-cargo` | Path to auxiliary proc-macro `.rs` file | +| `build-aux-docs` | Build docs for auxiliaries as well. Note that this only works with `aux-build`, not `aux-crate`. | All except `run-make`/`run-make-cargo` | N/A | [^pm]: please see the [Auxiliary proc-macro section](compiletest.html#auxiliary-proc-macro) in the compiletest chapter for specifics. @@ -243,18 +243,18 @@ ignoring debuggers. ### Affecting how tests are built -| Directive | Explanation | Supported test suites | Possible values | -|---------------------|----------------------------------------------------------------------------------------------|---------------------------|--------------------------------------------------------------------------------------------| -| `compile-flags` | Flags passed to `rustc` when building the test or aux file | All except for `run-make` | Any valid `rustc` flags, e.g. `-Awarnings -Dfoo`. Cannot be `-Cincremental` or `--edition` | -| `edition` | The edition used to build the test | All except for `run-make` | Any valid `--edition` value | -| `rustc-env` | Env var to set when running `rustc` | All except for `run-make` | `=` | -| `unset-rustc-env` | Env var to unset when running `rustc` | All except for `run-make` | Any env var name | -| `incremental` | Proper incremental support for tests outside of incremental test suite | `ui`, `crashes` | N/A | -| `no-prefer-dynamic` | Don't use `-C prefer-dynamic`, don't build as a dylib via a `--crate-type=dylib` preset flag | `ui`, `crashes` | N/A | +| Directive | Explanation | Supported test suites | Possible values | +|---------------------|----------------------------------------------------------------------------------------------|--------------------------------------------|--------------------------------------------------------------------------------------------| +| `compile-flags` | Flags passed to `rustc` when building the test or aux file | All except for `run-make`/`run-make-cargo` | Any valid `rustc` flags, e.g. `-Awarnings -Dfoo`. Cannot be `-Cincremental` or `--edition` | +| `edition` | The edition used to build the test | All except for `run-make`/`run-make-cargo` | Any valid `--edition` value | +| `rustc-env` | Env var to set when running `rustc` | All except for `run-make`/`run-make-cargo` | `=` | +| `unset-rustc-env` | Env var to unset when running `rustc` | All except for `run-make`/`run-make-cargo` | Any env var name | +| `incremental` | Proper incremental support for tests outside of incremental test suite | `ui`, `crashes` | N/A | +| `no-prefer-dynamic` | Don't use `-C prefer-dynamic`, don't build as a dylib via a `--crate-type=dylib` preset flag | `ui`, `crashes` | N/A |
-Tests (outside of `run-make`) that want to use incremental tests not in the +Tests (outside of `run-make`/`run-make-cargo`) that want to use incremental tests not in the incremental test-suite must not pass `-C incremental` via `compile-flags`, and must instead use the `//@ incremental` directive. @@ -264,9 +264,9 @@ Consider writing the test as a proper incremental test instead. ### Rustdoc -| Directive | Explanation | Supported test suites | Possible values | -|-------------|--------------------------------------------------------------|------------------------------------------|---------------------------| -| `doc-flags` | Flags passed to `rustdoc` when building the test or aux file | `rustdoc`, `rustdoc-js`, `rustdoc-json` | Any valid `rustdoc` flags | +| Directive | Explanation | Supported test suites | Possible values | +|-------------|--------------------------------------------------------------|-----------------------------------------|---------------------------| +| `doc-flags` | Flags passed to `rustdoc` when building the test or aux file | `rustdoc`, `rustdoc-js`, `rustdoc-json` | Any valid `rustdoc` flags |