From 41e3fed3815bb144b1dba0314f353a70348aed57 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 21 Nov 2023 11:25:13 +0100 Subject: [PATCH] tests: improve detection of libtool in "run-nm-test.sh" The user can set "$NMTST_LIBTOOL" to empty or the path to libtool. If unset, we want to detect it. However, previously we would always use "$SCRIPT_PATH/../libtool", even if that file doesn't exit. Improve that. For example, when running on Ubuntu with the ".gitlab-ci/debian-install.sh" script, we don't have libtool. Entering such a container and running the "run-nm-test.sh" script will fail as "$SCRIPT_PATH/../libtool" doesn't exist. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1800 --- tools/run-nm-test.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/run-nm-test.sh b/tools/run-nm-test.sh index c88a1bd573..264fc48d01 100755 --- a/tools/run-nm-test.sh +++ b/tools/run-nm-test.sh @@ -135,12 +135,12 @@ else NMTST_USE_VALGRIND=0 fi - if [ -z "${NMTST_LIBTOOL+x}" ]; then - NMTST_LIBTOOL=(sh "$SCRIPT_PATH/../libtool" "--mode=execute") - elif [ -z "$NMTST_LIBTOOL" ]; then - NMTST_LIBTOOL=() - else + if [ -n "$NMTST_LIBTOOL" ] ; then NMTST_LIBTOOL=("$NMTST_LIBTOOL" "--mode=execute") + elif [ -z "${NMTST_LIBTOOL+x}" -a -f "$SCRIPT_PATH/../libtool" ]; then + NMTST_LIBTOOL=(sh "$SCRIPT_PATH/../libtool" "--mode=execute") + else + NMTST_LIBTOOL=() fi TEST_ARGV=() unset TEST