Skip to content

forward the bootstrap runner to run-make #141856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/tools/compiletest/src/runtest/run_make.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ impl TestCx<'_> {
cmd.env("REMOTE_TEST_CLIENT", remote_test_client);
}

if let Some(runner) = &self.config.runner {
cmd.env("RUNNER", runner);
}

// We don't want RUSTFLAGS set from the outside to interfere with
// compiler flags set in the test cases:
cmd.env_remove("RUSTFLAGS");
Expand Down
25 changes: 24 additions & 1 deletion src/tools/run-make-support/src/run.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::ffi::OsStr;
use std::ffi::{OsStr, OsString};
use std::path::PathBuf;
use std::{env, panic};

Expand All @@ -21,6 +21,20 @@ fn run_common(name: &str, args: Option<&[&str]>) -> Command {
// will have to be changed (and the support files will have to be uploaded).
cmd.arg("0");
cmd.arg(bin_path);
cmd
} else if let Ok(runner) = std::env::var("RUNNER") {
let mut args = split_maybe_args(&runner);

let prog = args.remove(0);
let mut cmd = Command::new(prog);

for arg in args {
cmd.arg(arg);
}

cmd.arg("--");
cmd.arg(bin_path);

cmd
} else {
Comment on lines +25 to 38
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I think the problem is that the wasm tests set the (bootstrap) runner (probably to wasmtime), that now gets forwarded to run-make where it didn't before, and then this bit of code tries to execute any run command with that runner. But the tests in question don't actually expect that, they run on the host instead.

I'm not sure about this, but I think that means that these tests were never really testing what they were supposed to anyway? E.g. alloc-no-oom-handling appears to, currently, just ignore the target completely, and compile and run a host binary.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm yeah, e.g. alloc-no-oom-handling are broken re. cross-compile, because it's not cross-by-default, but only opt-in cross ATM with sth like rustc().target(()). I'll try to get #139244 working next week, which might make your life here easier.

Command::new(bin_path)
Expand Down Expand Up @@ -92,3 +106,12 @@ pub fn cmd<S: AsRef<OsStr>>(program: S) -> Command {
command.env("LC_ALL", "C"); // force english locale
command
}

fn split_maybe_args(s: &str) -> Vec<OsString> {
// FIXME(132599): implement proper env var/shell argument splitting.
s.split(' ')
.filter_map(|s| {
if s.chars().all(|c| c.is_whitespace()) { None } else { Some(OsString::from(s)) }
})
.collect()
}
9 changes: 6 additions & 3 deletions tests/run-make/c-link-to-rust-va-list-fn/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
// prevent the creation of a functional binary.
// See https://github.com/rust-lang/rust/pull/49878

//@ ignore-cross-compile
//@ ignore-none
// Reason: no-std is not supported
//@ ignore-nvptx64-nvidia-cuda
// Reason: can't find crate for 'std'

use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name};
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name, target};

fn main() {
rustc().input("checkrust.rs").run();
rustc().input("checkrust.rs").target(target()).run();
cc().input("test.c")
.input(static_lib_name("checkrust"))
.out_exe("test")
Expand Down
Loading