Fixing test to consider statically linked binaries (#10835)

The test calls `ldd` on `redis-server` in order to find out whether the binary
was linked against `libmusl`; However, `ldd` returns a value different from `0`
when statically linking the binaries agains libc-musl, because `redis-server` is
not a dynamic executable (as given by the exception thrown by the failing test),
and `make test` terminates with an error::

   $ ldd src/redis-server
       not a dynamic executable
   $ echo $?
   1

This commit fixes the test by ignoring such failures.

Co-authored-by: Yossi Gottlieb <yossigo@gmail.com>
This commit is contained in:
Christian Krieg 2022-06-09 11:59:33 +02:00 committed by GitHub
parent 6e1c3ff132
commit 032619b82b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -8,9 +8,12 @@ if {$system_name eq {darwin}} {
set backtrace_supported 1
} elseif {$system_name eq {linux}} {
# Avoid the test on libmusl, which does not support backtrace
set ldd [exec ldd src/redis-server]
if {![string match {*libc.*musl*} $ldd]} {
set backtrace_supported 1
# and on static binaries (ldd exit code 1) where we can't detect libmusl
catch {
set ldd [exec ldd src/redis-server]
if {![string match {*libc.*musl*} $ldd]} {
set backtrace_supported 1
}
}
}