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
This commit is contained in:
Samuel Tardieu 2025-07-15 12:52:36 +02:00 committed by GitHub
commit 4e72ed79d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 0 deletions

View file

@ -971,6 +971,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
"only-mips64",
"only-msp430",
"only-msvc",
"only-musl",
"only-nightly",
"only-nvptx64",
"only-powerpc",

View file

@ -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

View file

@ -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() {}