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
This commit is contained in:
Thomas Haller 2023-11-21 11:25:13 +01:00
parent 80839291f8
commit 41e3fed381
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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