libnm-glib: use automake test infrastructure for test programs

Use "TESTS = tests-nm-client test-remote-settings-client" rather than
overriding "check-local".

Add a script "libnm-test-launch.sh" that will handle redirecting the
test via dbus-launch if needed.
This commit is contained in:
Dan Winship 2014-07-30 17:32:35 -04:00
parent 4f7e9bd336
commit ade4f2e84e
2 changed files with 13 additions and 9 deletions

View file

@ -10,7 +10,9 @@ AM_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(DBUS_CFLAGS)
noinst_PROGRAMS = test-nm-client test-remote-settings-client
noinst_PROGRAMS = $(TESTS)
TESTS = test-nm-client test-remote-settings-client
####### NMClient and non-settings tests #######
@ -36,13 +38,8 @@ test_remote_settings_client_LDADD = \
###########################################
check-local: test-nm-client test-remote-settings-client
if test -z "$$DBUS_SESSION_BUS_ADDRESS" ; then \
dbus-launch --exit-with-session $(abs_builddir)/test-nm-client; \
dbus-launch --exit-with-session $(abs_builddir)/test-remote-settings-client; \
else \
$(abs_builddir)/test-nm-client; \
$(abs_builddir)/test-remote-settings-client; \
fi;
TESTS_ENVIRONMENT = $(srcdir)/libnm-glib-test-launch.sh
endif
EXTRA_DIST = libnm-glib-test-launch.sh

View file

@ -0,0 +1,7 @@
#!/bin/sh
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
exec dbus-launch --exit-with-session "$@"
else
exec "$@"
fi