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.

(cherry picked from commit ade4f2e84e)
This commit is contained in:
Dan Winship 2014-07-30 17:32:35 -04:00
parent b2e65b2a1f
commit edf0317dff
2 changed files with 14 additions and 12 deletions

View file

@ -12,7 +12,11 @@ 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
TESTS_ENVIRONMENT = $(srcdir)/libnm-glib-test-launch.sh
####### NMClient and non-settings tests #######
@ -38,15 +42,6 @@ test_remote_settings_client_LDADD = \
###########################################
EXTRA_DIST = test-fake-nm.py test-remote-settings-service.py
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;
endif
EXTRA_DIST = test-fake-nm.py test-remote-settings-service.py 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