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.)
5bb4503d3a test-functions: make sure we use the right library path for binaries without RPATH
test/test-functions | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)