Skip to content

Commit b604379

Browse files
authored
Rollup merge of #162482 - GuillaumeGomez:run-make-backends, r=Kobzol
Make `run-make` testsuite work with other codegen backend than LLVM Needed for #159924. Currently, we always run `run-make` testsuite with the codegen backend rustc was compiled with. However, in CI it's compiled with LLVM, so when we want to test with GCC (with `--test-codegen-backend`), it compiles `rmake.rs` with the GCC backend, but when running the test, it doesn't use the GCC backend since it just calls `rustc`. So to get around that, I now pass the codegen backend through the environment and set it in the `rustc` function of `run_make_support`. To be noted that for now it's only for the `rustc` function, no other command uses it. Should I extend it right away for all commands (well, likely only `cargo`) or just `rustc` for now is enough? r? @jieyouxu
2 parents 0d31508 + 21cfbad commit b604379

80 files changed

Lines changed: 170 additions & 5 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/tools/compiletest/src/runtest/run_make.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ impl TestCx<'_> {
203203
// through a specific CI runner).
204204
.env("LLVM_COMPONENTS", &self.config.llvm_components);
205205

206+
if let Some(codegen_backend) = &self.config.override_codegen_backend {
207+
// In case it's a different codegen backend than LLVM.
208+
cmd.env("RUSTC_CODEGEN_BACKEND", codegen_backend.as_str());
209+
}
210+
206211
// The `run-make-cargo` and `build-std` suites need an in-tree `cargo`, `run-make` does not.
207212
if matches!(self.config.suite, TestSuite::RunMakeCargo | TestSuite::BuildStd) {
208213
cmd.env(

src/tools/run-make-support/src/external_deps/rustc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ pub fn rustc_path() -> String {
7676
fn setup_common() -> Command {
7777
let mut cmd = Command::new(rustc_path());
7878
set_host_compiler_dylib_path(&mut cmd);
79+
if let Ok(codegen_backend) = std::env::var("RUSTC_CODEGEN_BACKEND") {
80+
cmd.arg(format!("-Zcodegen-backend={codegen_backend}"));
81+
}
7982
cmd
8083
}
8184

tests/run-make/amdgpu-kd/rmake.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
//@ needs-llvm-components: amdgpu
77
//@ needs-rust-lld
8+
//@ ignore-backends: gcc
89

910
use run_make_support::targets::is_windows_gnu;
1011
use run_make_support::{llvm_readobj, rustc};

tests/run-make/atomic-lock-free/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// guaranteed to be lock-free.
33

44
//@ only-linux
5+
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
6+
//@ ignore-backends: gcc
57

68
use run_make_support::{llvm_components_contain, llvm_readobj, rustc};
79

tests/run-make/avr-custom-target-missing-cpu/rmake.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Make sure that reports the normal missing-CPU diagnostic instead of ICEing
33
//
44
//@ needs-llvm-components: avr
5+
//@ ignore-backends: gcc
56

67
use run_make_support::rustc;
78

tests/run-make/avr-rjmp-offset/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@ needs-llvm-components: avr
22
//@ needs-rust-lld
3+
//@ ignore-backends: gcc
4+
35
//! Regression test for #129301/llvm-project#106722 within `rustc`.
46
//!
57
//! Some LLVM-versions had wrong offsets in the local labels, causing the first

tests/run-make/branch-protection-check-IBT/rmake.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
// FIXME(#93754): increase the test coverage of this test.
3838
//@ only-x86_64-unknown-linux-gnu
3939
//@ ignore-cross-compile
40+
//@ ignore-backends: gcc
4041

4142
use run_make_support::{bare_rustc, llvm_readobj};
4243

tests/run-make/c-link-to-rust-va-list-fn/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
//@ ignore-sgx: (x86 machine code cannot be directly executed)
99
//@ ignore-pauthtest: (it requires non-trivial compilation of c sources, and only supports dynamic
1010
// linking, ignore the test).
11+
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
12+
//@ ignore-backends: gcc
1113

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

tests/run-make/cdylib/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
// - `bar()` which implements basic addition.
1010

1111
//@ ignore-cross-compile
12+
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
13+
//@ ignore-backends: gcc
1214

1315
use run_make_support::{cc, cwd, dynamic_lib_name, is_windows_msvc, rfs, run, rustc};
1416

tests/run-make/codegen-options-parsing/rmake.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// contain specific helpful indications.
33

44
//@ ignore-cross-compile
5+
// FIXME: Once GCC backend is fixed, remove this `ignore-backends`.
6+
//@ ignore-backends: gcc
57

68
use run_make_support::regex::Regex;
79
use run_make_support::rustc;

0 commit comments

Comments
 (0)