Skip to content

Commit

Permalink
Rollup merge of rust-lang#126629 - GuillaumeGomez:migrate-run-make-co…
Browse files Browse the repository at this point in the history
…mpressed-debuginfo, r=jieyouxu

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

Part of rust-lang#121876.

r? `@jieyouxu`
  • Loading branch information
jieyouxu committed Jun 19, 2024
2 parents 3f36c28 + 62431b7 commit 1e51597
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 15 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ run-make/comment-section/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
Expand Down
14 changes: 0 additions & 14 deletions tests/run-make/compressed-debuginfo/Makefile

This file was deleted.

36 changes: 36 additions & 0 deletions tests/run-make/compressed-debuginfo/rmake.rs
Original file line number Diff line number Diff line change
@@ -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");
}

0 comments on commit 1e51597

Please sign in to comment.