libnm/tests: enable valgrind for libnm tests

This commit is contained in:
Thomas Haller 2015-02-08 11:52:22 +01:00
parent bf68917ca3
commit e7356ef0a6
4 changed files with 19 additions and 7 deletions

View file

@ -891,6 +891,7 @@ AM_CONDITIONAL(REQUIRE_ROOT_TESTS, test "$enable_tests" == "root")
AS_IF([test "$with_valgrind" != "no"],
AC_SUBST(VALGRIND_RULES, 'TESTS_ENVIRONMENT = "$(top_srcdir)/tools/run-test-valgrind.sh" "$(LIBTOOL)" "$(with_valgrind)" "$(top_srcdir)/valgrind.suppressions"'),
AC_SUBST(VALGRIND_RULES, []))
AM_CONDITIONAL(WITH_VALGRIND, test "${with_valgrind}" != "no")
GTK_DOC_CHECK(1.0)

View file

@ -12,7 +12,11 @@ AM_CPPFLAGS = \
noinst_PROGRAMS = $(TESTS)
#@VALGRIND_RULES@
if WITH_VALGRIND
@VALGRIND_RULES@ --launch-dbus
else
TESTS_ENVIRONMENT = $(srcdir)/libnm-test-launch.sh
endif
TESTS = test-nm-client test-remote-settings-client
####### NMClient and non-settings tests #######
@ -43,8 +47,6 @@ test_remote_settings_client_LDADD = \
###########################################
TESTS_ENVIRONMENT = $(srcdir)/libnm-glib-test-launch.sh
endif
EXTRA_DIST = libnm-glib-test-launch.sh

View file

@ -17,7 +17,11 @@ LDADD = \
noinst_PROGRAMS = $(TESTS)
#@VALGRIND_RULES@
if WITH_VALGRIND
@VALGRIND_RULES@ --launch-dbus
else
TESTS_ENVIRONMENT = $(srcdir)/libnm-test-launch.sh
endif
TESTS = test-nm-client test-remote-settings-client test-secret-agent
test_nm_client_SOURCES = \
@ -34,9 +38,6 @@ test_secret_agent_SOURCES = \
common.c \
common.h \
test-secret-agent.c
TESTS_ENVIRONMENT = $(srcdir)/libnm-test-launch.sh
endif
EXTRA_DIST = libnm-test-launch.sh

View file

@ -3,6 +3,14 @@
LIBTOOL="$1"; shift
VALGRIND="$1"; shift
SUPPRESSIONS="$1"; shift
if [ "$1" = "--launch-dbus" ]; then
# Spawn DBus if there's none
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
eval `dbus-launch --sh-syntax`
trap "kill $DBUS_SESSION_BUS_PID" EXIT
fi
shift
fi
TEST="$1"; shift
LOGFILE="valgrind-`echo "$TEST" | tr -cd '[:alpha:]-'`.log"