From a9d34376e659deb44b99875ea35764de9cf802f0 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 14 Jan 2021 16:48:13 +0000 Subject: [PATCH] test: skip missing optional libraries in image install Not all optional libraries might be available on developers machines, so log and skip. Also some pkg-config files are broken (eg: tss2 on Debian Stable) so skip if the required variables are missing, and improve logs. --- test/test-functions | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/test/test-functions b/test/test-functions index 06dea3c7bec..efa2989bff9 100644 --- a/test/test-functions +++ b/test/test-functions @@ -698,14 +698,25 @@ install_missing_libraries() { # A number of dependencies is now optional via dlopen, so the install # script will not pick them up, since it looks at linkage. for lib in libcryptsetup libidn libidn2 pwquality libqrencode tss2-esys tss2-rc tss2-mu libfido2; do - if pkg-config --exists ${lib}; then - path=$(pkg-config --variable=libdir ${lib}) - if ! [[ ${lib} =~ ^lib ]]; then - lib="lib${lib}" - fi - inst_libs "${path}/${lib}.so" - inst_library "${path}/${lib}.so" - fi + ddebug "Searching for $lib via pkg-config" + if pkg-config --exists ${lib}; then + path=$(pkg-config --variable=libdir ${lib}) + if [ -z "${path}" ]; then + ddebug "$lib.pc does not contain a libdir variable, skipping" + continue + fi + + if ! [[ ${lib} =~ ^lib ]]; then + lib="lib${lib}" + fi + # Some pkg-config files are broken and give out the wrong paths + # (eg: libcryptsetup), so just ignore them + inst_libs "${path}/${lib}.so" || true + inst_library "${path}/${lib}.so" || true + else + ddebug "$lib.pc not found, skipping" + continue + fi done }