Rollup merge of #126629 - GuillaumeGomez:migrate-run-make-compressed-debuginfo, r=jieyouxu

Migrate `run-make/compressed-debuginfo` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? ````@jieyouxu````
This commit is contained in:
Matthias Krüger 2024-06-20 18:20:11 +02:00 committed by GitHub
commit 54e097d5ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 36 additions and 15 deletions

View File

@ -13,7 +13,6 @@ run-make/cdylib-fewer-symbols/Makefile
run-make/compiler-lookup-paths-2/Makefile
run-make/compiler-lookup-paths/Makefile
run-make/compiler-rt-works-on-mingw/Makefile
run-make/compressed-debuginfo/Makefile
run-make/crate-hash-rustc-version/Makefile
run-make/crate-name-priority/Makefile
run-make/cross-lang-lto-clang/Makefile

View File

@ -1,14 +0,0 @@
# ignore-cross-compile
include ../tools.mk
# only-linux
#
# This tests debuginfo-compression.
all: zlib zstandard
zlib:
test "`$(RUSTC) --crate-name=foo --crate-type=lib --emit=obj -C debuginfo=full -Z debuginfo-compression=zlib foo.rs 2>&1 | sed 's/.*unknown.*zlib.*/missing/' | head -n 1`" = missing || readelf -t $(TMPDIR)/foo.o | grep -q ZLIB
zstandard:
test "`$(RUSTC) --crate-name=foo --crate-type=lib --emit=obj -C debuginfo=full -Z debuginfo-compression=zstd foo.rs 2>&1 | sed 's/.*unknown.*zstd.*/missing/' | head -n 1`" = missing || readelf -t $(TMPDIR)/foo.o | grep -q ZST

View File

@ -0,0 +1,36 @@
// Checks the `debuginfo-compression` option.
//@ only-linux
//@ ignore-cross-compile
// FIXME: This test isn't comprehensive and isn't covering all possible combinations.
use run_make_support::{assert_contains, cmd, run_in_tmpdir, rustc};
fn check_compression(compression: &str, to_find: &str) {
run_in_tmpdir(|| {
let out = rustc()
.crate_name("foo")
.crate_type("lib")
.emit("obj")
.arg("-Cdebuginfo=full")
.arg(&format!("-Zdebuginfo-compression={compression}"))
.input("foo.rs")
.run();
let stderr = out.stderr_utf8();
if stderr.is_empty() {
// FIXME: `readelf` might need to be replaced with `llvm-readelf`.
cmd("readelf").arg("-t").arg("foo.o").run().assert_stdout_contains(to_find);
} else {
assert_contains(
&stderr,
&format!("unknown debuginfo compression algorithm {compression}"),
);
}
});
}
fn main() {
check_compression("zlib", "ZLIB");
check_compression("zstd", "ZSTD");
}