Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a297af7

Browse files
committedMar 21, 2025
Auto merge of rust-lang#138652 - ferrocene:pa-remote-test-rmake, r=<try>
Reintroduce remote-test support in run-make tests The old Makefile-based infrastructure included support for executing binaries with remote-test-client if configured, but that didn't get ported to run_make_support as part of the rmake migration. This PR re-introduces back that support, with the same implementation (and limitations) of the original Makefile-based support. [Old Makefile-based implementation of this](https://github.com/rust-lang/rust/blob/9b8accbeb6336fa24d02b2a8bcaecaf44fe2bb65/tests/run-make/tools.mk#L65-L74) try-job: armhf-gnu
2 parents 5d85a71 + 6dc5705 commit a297af7

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed
 

‎src/tools/run-make-support/src/run.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,20 @@ fn run_common(name: &str, args: Option<&[&str]>) -> Command {
1212
bin_path.push(cwd());
1313
bin_path.push(name);
1414
let ld_lib_path_envvar = env_var("LD_LIB_PATH_ENVVAR");
15-
let mut cmd = Command::new(bin_path);
15+
16+
let mut cmd = if let Some(rtc) = env::var_os("REMOTE_TEST_CLIENT") {
17+
let mut cmd = Command::new(rtc);
18+
cmd.arg("run");
19+
// FIXME: the "0" indicates how many support files should be uploaded along with the binary
20+
// to execute. If a test requires additional files to be pushed to the remote machine, this
21+
// will have to be changed (and the support files will have to be uploaded).
22+
cmd.arg("0");
23+
cmd.arg(bin_path);
24+
cmd
25+
} else {
26+
Command::new(bin_path)
27+
};
28+
1629
if let Some(args) = args {
1730
for arg in args {
1831
cmd.arg(arg);

‎tests/run-make/doctests-keep-binaries/rmake.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
use std::path::Path;
55

66
use run_make_support::rfs::{create_dir, remove_dir_all};
7-
use run_make_support::{run, rustc, rustdoc};
7+
use run_make_support::{run, rustc, rustdoc, target};
88

99
fn setup_test_env<F: FnOnce(&Path, &Path)>(callback: F) {
1010
let out_dir = Path::new("doctests");
1111
create_dir(&out_dir);
12-
rustc().input("t.rs").crate_type("rlib").run();
12+
rustc().target(target()).input("t.rs").crate_type("rlib").run();
1313
callback(&out_dir, Path::new("libt.rlib"));
1414
remove_dir_all(out_dir);
1515
}
@@ -22,6 +22,7 @@ fn check_generated_binaries() {
2222
fn main() {
2323
setup_test_env(|out_dir, extern_path| {
2424
rustdoc()
25+
.target(target())
2526
.input("t.rs")
2627
.arg("-Zunstable-options")
2728
.arg("--test")
@@ -33,6 +34,7 @@ fn main() {
3334
});
3435
setup_test_env(|out_dir, extern_path| {
3536
rustdoc()
37+
.target(target())
3638
.input("t.rs")
3739
.arg("-Zunstable-options")
3840
.arg("--test")
@@ -49,6 +51,7 @@ fn main() {
4951
create_dir(&run_dir_path);
5052

5153
rustdoc()
54+
.target(target())
5255
.input("t.rs")
5356
.arg("-Zunstable-options")
5457
.arg("--test")

‎tests/run-make/target-cpu-native/rmake.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
// warnings when used, and that binaries produced by it can also be successfully executed.
44
// See https://github.com/rust-lang/rust/pull/23238
55

6-
use run_make_support::{run, rustc};
6+
use run_make_support::{run, rustc, target};
77

88
fn main() {
9-
let out = rustc().input("foo.rs").arg("-Ctarget-cpu=native").run().stderr_utf8();
9+
let out =
10+
rustc().target(target()).input("foo.rs").arg("-Ctarget-cpu=native").run().stderr_utf8();
1011
run("foo");
1112
// There should be zero warnings emitted - the bug would cause "unknown CPU `native`"
1213
// to be printed out.

0 commit comments

Comments
 (0)
Failed to load comments.