mark rust-lld-compress-debug-sections test as needing zstd

also make it fail if there's a compression issue
This commit is contained in:
Rémy Rakic 2024-08-10 15:09:20 +00:00
parent 5b374631df
commit 79f3c51a01

View File

@ -1,12 +1,13 @@
// Checks the `compress-debug-sections` option on rust-lld.
//@ needs-rust-lld
//@ needs-llvm-zstd
//@ only-linux
//@ ignore-cross-compile
// FIXME: This test isn't comprehensive and isn't covering all possible combinations.
use run_make_support::{assert_contains, llvm_readobj, run_in_tmpdir, rustc};
use run_make_support::{llvm_readobj, run_in_tmpdir, rustc};
fn check_compression(compression: &str, to_find: &str) {
run_in_tmpdir(|| {
@ -17,19 +18,8 @@ fn check_compression(compression: &str, to_find: &str) {
.arg("-Cdebuginfo=full")
.link_arg(&format!("-Wl,--compress-debug-sections={compression}"))
.input("main.rs")
.run_unchecked();
let stderr = out.stderr_utf8();
if stderr.is_empty() {
llvm_readobj().arg("-t").arg("main").run().assert_stdout_contains(to_find);
} else {
assert_contains(
stderr,
format!(
"LLVM was not built with LLVM_ENABLE_{to_find} \
or did not find {compression} at build time"
),
);
}
.run();
llvm_readobj().arg("-t").arg("main").run().assert_stdout_contains(to_find);
});
}