]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-functions: make sure we use the right library path for binaries without RPATH
authorLennart Poettering <lennart@poettering.net>
Wed, 27 Nov 2019 17:25:52 +0000 (18:25 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 28 Nov 2019 08:20:40 +0000 (09:20 +0100)
Meson appears to set the rpath only for some binaries it builds, but not
all. (The rules are not clear to me, but that's besides the point of
this commit).

Let's make sure if our test script operates on a binary that has no
rpath set we fall back preferably to the BUILD_DIR rather than directly
to the host.

This matters if a test uses a libsystemd symbol introduced in a version
newer than the one on the host. In that case "ldd" will not work on the
test binary if rpath is not set. With this fix that behaviour is
corrected, and "ldd" works correctly even in this case.

(Or in other words: before this fix on binaries lacking rpath we'd base
dependency info on the libraries of the host, not the buidl tree, if
they exist in both.)

test/test-functions

index 25a7b9b6f5ab489d79b3587d325d1ff619fb8a12..468a36d310feda25d843d107780a2f91ab23f611 100644 (file)
@@ -536,7 +536,13 @@ install_systemd() {
 
 get_ldpath() {
     local _bin="$1"
-    objdump -p "$_bin" 2>/dev/null | awk "/R(UN)?PATH/ { print \"$initdir\" \$2 }" | paste -sd :
+    local rpath=$(objdump -p "$_bin" 2>/dev/null | awk "/R(UN)?PATH/ { print \"$initdir\" \$2 }" | paste -sd :)
+
+    if [ -z "$rpath" ] ; then
+        echo $BUILD_DIR
+    else
+        echo $rpath
+    fi
 }
 
 install_missing_libraries() {