diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-06-29 22:10:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-29 22:10:57 +0200 |
| commit | fafb2ea57b203e6a22d3fc14e1e71f7983e40cb1 (patch) | |
| tree | 85ceddc39389f4d16d41cf01d5d70768de1b84b3 | |
| parent | 6d74ffd2381b4b42cad64feade96b201ba402dd5 (diff) | |
| parent | 4442fd7a0985ad3ac219b4f9ce8f26a27500acac (diff) | |
| download | rust-fafb2ea57b203e6a22d3fc14e1e71f7983e40cb1.tar.gz rust-fafb2ea57b203e6a22d3fc14e1e71f7983e40cb1.zip | |
Rollup merge of #127081 - Kobzol:lld-test, r=onur-ozkan
Add a run-make test that LLD is not being used by default on the x64 beta/stable channel https://github.com/rust-lang/rust/pull/126701 showed that the handling of `lld` in bootstrap is currently not ideal. While it would be nice to refactor it eventually, we should also make sure that we have a test that checks that `lld` is not used (yet!) by default on the x64 Linux stable channel. CC ``@lqd`` r? ``@onur-ozkan``
| -rw-r--r-- | tests/run-make/rust-lld-by-default-beta-stable/main.rs | 1 | ||||
| -rw-r--r-- | tests/run-make/rust-lld-by-default-beta-stable/rmake.rs | 29 | ||||
| -rw-r--r-- | tests/run-make/rust-lld-by-default-nightly/main.rs (renamed from tests/run-make/rust-lld-by-default/main.rs) | 0 | ||||
| -rw-r--r-- | tests/run-make/rust-lld-by-default-nightly/rmake.rs (renamed from tests/run-make/rust-lld-by-default/rmake.rs) | 4 |
4 files changed, 32 insertions, 2 deletions
diff --git a/tests/run-make/rust-lld-by-default-beta-stable/main.rs b/tests/run-make/rust-lld-by-default-beta-stable/main.rs new file mode 100644 index 00000000000..f328e4d9d04 --- /dev/null +++ b/tests/run-make/rust-lld-by-default-beta-stable/main.rs @@ -0,0 +1 @@ +fn main() {} diff --git a/tests/run-make/rust-lld-by-default-beta-stable/rmake.rs b/tests/run-make/rust-lld-by-default-beta-stable/rmake.rs new file mode 100644 index 00000000000..fc3dffdbaf4 --- /dev/null +++ b/tests/run-make/rust-lld-by-default-beta-stable/rmake.rs @@ -0,0 +1,29 @@ +// Ensure that rust-lld is *not* used as the default linker on `x86_64-unknown-linux-gnu` on stable +// or beta. + +//@ ignore-nightly +//@ only-x86_64-unknown-linux-gnu + +use run_make_support::regex::Regex; +use run_make_support::rustc; +use std::process::Output; + +fn main() { + // A regular compilation should not use rust-lld by default. We'll check that by asking the + // linker to display its version number with a link-arg. + let output = rustc() + .env("RUSTC_LOG", "rustc_codegen_ssa::back::link=info") + .link_arg("-Wl,-v") + .input("main.rs") + .run(); + assert!( + !find_lld_version_in_logs(output.stderr_utf8()), + "the LLD version string should not be present in the output logs:\n{}", + output.stderr_utf8() + ); +} + +fn find_lld_version_in_logs(stderr: String) -> bool { + let lld_version_re = Regex::new(r"^LLD [0-9]+\.[0-9]+\.[0-9]+").unwrap(); + stderr.lines().any(|line| lld_version_re.is_match(line.trim())) +} diff --git a/tests/run-make/rust-lld-by-default/main.rs b/tests/run-make/rust-lld-by-default-nightly/main.rs index e9f655fc09e..e9f655fc09e 100644 --- a/tests/run-make/rust-lld-by-default/main.rs +++ b/tests/run-make/rust-lld-by-default-nightly/main.rs diff --git a/tests/run-make/rust-lld-by-default/rmake.rs b/tests/run-make/rust-lld-by-default-nightly/rmake.rs index 94857a57dfb..f3ce9ada157 100644 --- a/tests/run-make/rust-lld-by-default/rmake.rs +++ b/tests/run-make/rust-lld-by-default-nightly/rmake.rs @@ -1,5 +1,5 @@ -// Ensure that rust-lld is used as the default linker on `x86_64-unknown-linux-gnu`, and that it can -// also be turned off with a CLI flag. +// Ensure that rust-lld is used as the default linker on `x86_64-unknown-linux-gnu` on the nightly +// channel, and that it can also be turned off with a CLI flag. //@ needs-rust-lld //@ ignore-beta |
