about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-01-29 22:01:53 +0000
committerbors <bors@rust-lang.org>2025-01-29 22:01:53 +0000
commit4a5f1cc52b7546c61462f1d92b60cc80d40e170f (patch)
tree512107eb32f36bf4b0e09f29135b0fa3d9e5e1b8 /src
parentae5de6c759cd337ecdb2de4e94f47eaafb5d4606 (diff)
parent6f5a1035f8b3694e519598ddb27d884a591e0d32 (diff)
Auto merge of #135818 - jieyouxu:migrate-translation, r=compiler-errors
tests: Port `translation` to rmake.rs

Part of #121876.

This PR partially supersedes #129011 and is co-authored with `@Oneirical.`

## Summary

This PR ports `tests/run-make/translation` to rmake.rs. Notable changes from the Makefile version include:

- We now actually fail if the rustc invocations fail... The Makefile did not have `SHELL=/bin/bash -o pipefail`, so all the piped rustc invocations to grep vacuously succeeded, even if the broken ftl test case actually regressed over time and ICEs on current master.
    - That test case is converted to assert it fails with a FIXME backlinking to #135817.
- The test coverage is expanded to not ignore windows. Instead, the test now uses symlink capability detection to gate test execution.
- Added some backlinks to relevant tracking issues and the initial translation infra implementation PR.

## Review advice

Best reviewed commit-by-commit.

r? compiler

try-job: aarch64-apple
try-job: i686-mingw
Diffstat (limited to 'src')
-rw-r--r--src/tools/run-make-support/src/command.rs6
-rw-r--r--src/tools/run-make-support/src/external_deps/rustc.rs10
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
3 files changed, 14 insertions, 3 deletions
diff --git a/src/tools/run-make-support/src/command.rs b/src/tools/run-make-support/src/command.rs
index b4dc753ab53..70a72bd1abe 100644
--- a/src/tools/run-make-support/src/command.rs
+++ b/src/tools/run-make-support/src/command.rs
@@ -388,9 +388,13 @@ impl CompletedProcess {
         self
     }
 
+    /// Check the **exit status** of the process. On Unix, this is *not* the **wait status**.
+    ///
+    /// See [`std::process::ExitStatus::code`]. This is not to be confused with
+    /// [`std::process::ExitCode`].
     #[track_caller]
     pub fn assert_exit_code(&self, code: i32) -> &Self {
-        assert!(self.output.status.code() == Some(code));
+        assert_eq!(self.output.status.code(), Some(code));
         self
     }
 }
diff --git a/src/tools/run-make-support/src/external_deps/rustc.rs b/src/tools/run-make-support/src/external_deps/rustc.rs
index 8894ea7fb20..b70db7130f6 100644
--- a/src/tools/run-make-support/src/external_deps/rustc.rs
+++ b/src/tools/run-make-support/src/external_deps/rustc.rs
@@ -1,5 +1,6 @@
 use std::ffi::{OsStr, OsString};
-use std::path::Path;
+use std::path::{Path, PathBuf};
+use std::str::FromStr as _;
 
 use crate::command::Command;
 use crate::env::env_var;
@@ -390,3 +391,10 @@ impl Rustc {
         self
     }
 }
+
+/// Query the sysroot path corresponding `rustc --print=sysroot`.
+#[track_caller]
+pub fn sysroot() -> PathBuf {
+    let path = rustc().print("sysroot").run().stdout_utf8();
+    PathBuf::from_str(path.trim()).unwrap()
+}
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 6f0fd09b353..e75d3dc2147 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -1,3 +1,2 @@
 run-make/split-debuginfo/Makefile
 run-make/symbol-mangling-hashed/Makefile
-run-make/translation/Makefile