about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-06-20 18:20:11 +0200
committerGitHub <noreply@github.com>2024-06-20 18:20:11 +0200
commit54e097d5ef373285547d04ce1d86f65097ca9c18 (patch)
tree979b2f6de2850770469ce8803e177e8e2c4270c6
parent440504726c8fdf1915ddbdf00e7e1c86a8945598 (diff)
parent62431b73e00eaae0788b53f4ccf6cecb9f7f03ca (diff)
downloadrust-54e097d5ef373285547d04ce1d86f65097ca9c18.tar.gz
rust-54e097d5ef373285547d04ce1d86f65097ca9c18.zip
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````
-rw-r--r--src/tools/tidy/src/allowed_run_make_makefiles.txt1
-rw-r--r--tests/run-make/compressed-debuginfo/Makefile14
-rw-r--r--tests/run-make/compressed-debuginfo/rmake.rs36
3 files changed, 36 insertions, 15 deletions
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 0cbbdb5d6db..a058c6ee97e 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -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
diff --git a/tests/run-make/compressed-debuginfo/Makefile b/tests/run-make/compressed-debuginfo/Makefile
deleted file mode 100644
index d2f24dde00d..00000000000
--- a/tests/run-make/compressed-debuginfo/Makefile
+++ /dev/null
@@ -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
diff --git a/tests/run-make/compressed-debuginfo/rmake.rs b/tests/run-make/compressed-debuginfo/rmake.rs
new file mode 100644
index 00000000000..9c6d50ab243
--- /dev/null
+++ b/tests/run-make/compressed-debuginfo/rmake.rs
@@ -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");
+}