about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2025-07-15 12:52:36 +0200
committerGitHub <noreply@github.com>2025-07-15 12:52:36 +0200
commit4e72ed79d44faf05ce948e20154d072af0fabc44 (patch)
tree0844d96670162996454c70d1c62ba39d2fda425b
parent7f2065a4bae1faed5bab928c670964eafbf43b55 (diff)
parentae1b1b4f8a9a1cd012cd7db944bbfa2adae703cb (diff)
downloadrust-4e72ed79d44faf05ce948e20154d072af0fabc44.tar.gz
rust-4e72ed79d44faf05ce948e20154d072af0fabc44.zip
Rollup merge of #142301 - Gelbpunkt:duplicated-path-in-error-musl, r=workingjubilee,fmease,jieyouxu
tests: Fix duplicated-path-in-error fail with musl

musl's dlopen returns a different error than glibc, which contains the name of the file. This would cause the test to fail, since the filename would appear twice in the output (once in the error from rustc, once in the error message from musl). Split the expected test outputs for the different libc implementations.

Fixes rust-lang/rust#128474
-rw-r--r--src/tools/compiletest/src/directives.rs1
-rw-r--r--tests/ui/codegen/duplicated-path-in-error.gnu.stderr (renamed from tests/ui/codegen/duplicated-path-in-error.stderr)0
-rw-r--r--tests/ui/codegen/duplicated-path-in-error.musl.stderr2
-rw-r--r--tests/ui/codegen/duplicated-path-in-error.rs7
4 files changed, 10 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/directives.rs b/src/tools/compiletest/src/directives.rs
index 6bf968a3132..93133ea0bfd 100644
--- a/src/tools/compiletest/src/directives.rs
+++ b/src/tools/compiletest/src/directives.rs
@@ -971,6 +971,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
     "only-mips64",
     "only-msp430",
     "only-msvc",
+    "only-musl",
     "only-nightly",
     "only-nvptx64",
     "only-powerpc",
diff --git a/tests/ui/codegen/duplicated-path-in-error.stderr b/tests/ui/codegen/duplicated-path-in-error.gnu.stderr
index d0d34e2f934..d0d34e2f934 100644
--- a/tests/ui/codegen/duplicated-path-in-error.stderr
+++ b/tests/ui/codegen/duplicated-path-in-error.gnu.stderr
diff --git a/tests/ui/codegen/duplicated-path-in-error.musl.stderr b/tests/ui/codegen/duplicated-path-in-error.musl.stderr
new file mode 100644
index 00000000000..2892ebffdde
--- /dev/null
+++ b/tests/ui/codegen/duplicated-path-in-error.musl.stderr
@@ -0,0 +1,2 @@
+error: couldn't load codegen backend /non-existing-one.so: Error loading shared library /non-existing-one.so: No such file or directory
+
diff --git a/tests/ui/codegen/duplicated-path-in-error.rs b/tests/ui/codegen/duplicated-path-in-error.rs
index a446395de20..fed93828ee2 100644
--- a/tests/ui/codegen/duplicated-path-in-error.rs
+++ b/tests/ui/codegen/duplicated-path-in-error.rs
@@ -1,8 +1,15 @@
+//@ revisions: musl gnu
 //@ only-linux
+//@ ignore-cross-compile because this relies on host libc behaviour
 //@ compile-flags: -Zcodegen-backend=/non-existing-one.so
+//@[gnu] only-gnu
+//@[musl] only-musl
 
 // This test ensures that the error of the "not found dylib" doesn't duplicate
 // the path of the dylib.
+//
+// glibc and musl have different dlopen error messages, so the expected error
+// message differs between the two.
 
 fn main() {}