summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-05-06 07:37:28 +0200
committerThomas Haller <thaller@redhat.com>2018-05-11 16:51:20 +0200
commit3934a2c392e8d6c600b211afee871989a338a1fe (patch)
treeefc1be45d6a2a8bfe3f28985313e7e59c47d0bce /tools
parent11fedad5445d8688740563a0fb9fd1162ec9e118 (diff)
downloadNetworkManager-3934a2c392e8d6c600b211afee871989a338a1fe.tar.gz
build: set LD_LIBRARY_PATH and GI_TYPELIB_PATH variables in run-nm-test.sh
With autotools, we use libtool so that the right libraries are automatically found. Still, we won't find the right GI typelib. Add a mechanism so that when make/meson invokes the run-nm-test.sh runner, it passes the build-root directory. Also, try to autodetect when invoked manually.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/run-nm-test.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/run-nm-test.sh b/tools/run-nm-test.sh
index 7f3053ce17..29ac7cd365 100755
--- a/tools/run-nm-test.sh
+++ b/tools/run-nm-test.sh
@@ -34,7 +34,11 @@ else
CALLED_FROM_MAKE=0
fi
+BUILDDIR=
+
if [ "$CALLED_FROM_MAKE" == 1 ]; then
+ BUILDDIR="$1"
+ shift
if [ -n "$1" ]; then
NMTST_LIBTOOL=($1 --mode=execute);
else
@@ -144,6 +148,7 @@ else
;;
esac
done
+
# we support calling the script directly. In this case,
# only pass the path to the test to run.
if test -z "${TEST+x}"; then
@@ -153,6 +158,20 @@ else
NMTST_SUPPRESSIONS="$SCRIPT_PATH/../valgrind.suppressions"
fi
+ if [[ -z "$NMTST_BUILDDIR" ]]; then
+ if [[ "${NMTST_BUILDDIR-x}" == x ]]; then
+ # autodetect
+ BUILDDIR="$(readlink -f "$TEST")"
+ while [[ -n "$BUILDDIR" ]]; do
+ BUILDDIR="$(dirname "$BUILDDIR")"
+ [[ "$BUILDDIR" == / ]] && BUILDDIR=
+ [[ -z "$BUILDDIR" ]] && break
+ [[ -e "$BUILDDIR/libnm/.libs/libnm.so" ]] && break
+ [[ -e "$BUILDDIR/libnm/libnm.so" ]] && break
+ done
+ fi
+ fi
+
fi
if [ "$NMTST_SET_DEBUG" == 1 -a -z "${NMTST_DEBUG+x}" ]; then
@@ -198,6 +217,16 @@ fi
[ -x "$TEST" ] || die "Cannot execute test \"$TEST\""
+if [[ -n "$BUILDDIR" ]]; then
+ if [[ -d "$BUILDDIR/libnm" ]]; then
+ export GI_TYPELIB_PATH="$BUILDDIR/libnm/${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}"
+ if [[ -d "$BUILDDIR/libnm/.libs" ]]; then
+ export LD_LIBRARY_PATH="$BUILDDIR/libnm/.libs${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
+ else
+ export LD_LIBRARY_PATH="$BUILDDIR/libnm${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
+ fi
+ fi
+fi
if ! _is_true "$NMTST_USE_VALGRIND" 0; then
"${NMTST_DBUS_RUN_SESSION[@]}" \