2024-06-18 08:13:40 -05:00
|
|
|
// Checks the `debuginfo-compression` option.
|
|
|
|
|
|
|
|
//@ only-linux
|
|
|
|
//@ ignore-cross-compile
|
|
|
|
|
|
|
|
// FIXME: This test isn't comprehensive and isn't covering all possible combinations.
|
|
|
|
|
2024-08-10 13:06:10 -05:00
|
|
|
use run_make_support::{assert_contains, llvm_readobj, run_in_tmpdir, rustc};
|
2024-06-18 08:13:40 -05:00
|
|
|
|
|
|
|
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() {
|
2024-06-23 16:44:58 -05:00
|
|
|
llvm_readobj().arg("-t").arg("foo.o").run().assert_stdout_contains(to_find);
|
2024-06-18 08:13:40 -05:00
|
|
|
} else {
|
|
|
|
assert_contains(
|
2024-07-01 03:45:55 -05:00
|
|
|
stderr,
|
|
|
|
format!("unknown debuginfo compression algorithm {compression}"),
|
2024-06-18 08:13:40 -05:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
check_compression("zlib", "ZLIB");
|
|
|
|
check_compression("zstd", "ZSTD");
|
|
|
|
}
|