Commit 3934a2c3 authored by Thomas Haller's avatar Thomas Haller

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.
parent 11fedad5
......@@ -1228,7 +1228,7 @@ else
with_valgrind_suppressions='$(top_srcdir)/valgrind.suppressions'
fi
fi
AC_SUBST(NM_LOG_COMPILER, 'LOG_COMPILER = "$(top_srcdir)/tools/run-nm-test.sh" --called-from-make "$(LIBTOOL)" "$(with_valgrind)" "'"$with_valgrind_suppressions"'" --launch-dbus=auto')
AC_SUBST(NM_LOG_COMPILER, 'LOG_COMPILER = "$(top_srcdir)/tools/run-nm-test.sh" --called-from-make "$(abs_top_builddir)" "$(LIBTOOL)" "$(with_valgrind)" "'"$with_valgrind_suppressions"'" --launch-dbus=auto')
AM_PATH_PYTHON([], [], [PYTHON=python])
AC_SUBST(PYTHON, [$PYTHON])
......
......@@ -741,15 +741,13 @@ endif
test_args = [
'--called-from-make',
meson.build_root(),
'',
enable_valgrind ? valgrind.path() : '',
enable_valgrind ? valgrind_suppressions_path : '',
'--launch-dbus=auto'
]
# FIXME
#AC_SUBST(NM_LOG_COMPILER, 'LOG_COMPILER = "$(top_srcdir)/tools/run-nm-test.sh" --called-from-make "$(LIBTOOL)" "$(with_valgrind)" "'"$with_valgrind_suppressions"'" --launch-dbus=auto')
py3 = import('python3')
python = py3.find_python()
......
......@@ -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[@]}" \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment