mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 18:23:49 +00:00
a509b5a0ba
Improve run-make-support API I think I'll slowly continue this work. Makes things a bit nicer for contributors, so why not. :D r? ``@Kobzol``
36 lines
1.0 KiB
Rust
36 lines
1.0 KiB
Rust
// 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, llvm_readobj, 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() {
|
|
llvm_readobj().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");
|
|
}
|