From 504dd29ca33904695a76d02f59c5e18a1adc6980 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 26 Jan 2015 15:47:22 +0000 Subject: [PATCH 3/6] test: implement GLib-style "installed tests" We run each test twice: * once with the system's session.conf, as an integration test (test-cases that need a special configuration are automatically skipped) * once with our special test configuration files, which provide better coverage Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810 --- configure.ac | 1 + test/Makefile.am | 39 +++++++++++++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index b9fa3ba..84f44b4 100644 --- a/configure.ac +++ b/configure.ac @@ -1816,6 +1816,7 @@ echo " Building modular tests: ${enable_modular_tests} - with GLib: ${with_glib} - with dbus-glib: ${with_dbus_glib} + Installing tests: ${enable_installed_tests} Building verbose mode: ${enable_verbose_mode} Building assertions: ${enable_asserts} Building checks: ${enable_checks} diff --git a/test/Makefile.am b/test/Makefile.am index b0be211..763fe20 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -132,9 +132,11 @@ manual_dir_iter_LDADD = $(top_builddir)/dbus/libdbus-internal.la EXTRA_DIST = dbus-test-runner -testexecdir = $(libdir)/dbus-1.0/test +testexecdir = $(libexecdir)/installed-tests/dbus +testmetadir = $(datadir)/installed-tests/dbus testexec_PROGRAMS = +testmeta_DATA = installable_tests = \ test-shell \ @@ -161,6 +163,9 @@ installable_manual_tests += \ $(NULL) endif DBUS_WITH_GLIB +installable_test_meta = $(installable_tests:=.test) +installable_test_meta_with_config = $(installable_tests:=_with_config.test) + installcheck_tests = installcheck_environment = \ XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR \ @@ -236,6 +241,9 @@ installcheck_tests += $(installable_tests) if DBUS_ENABLE_INSTALLED_TESTS testexec_PROGRAMS += $(installable_tests) $(installable_manual_tests) + + testmeta_DATA += $(installable_test_meta) + testmeta_DATA += $(installable_test_meta_with_config) else !DBUS_ENABLE_INSTALLED_TESTS noinst_PROGRAMS += $(installable_tests) $(installable_manual_tests) endif !DBUS_ENABLE_INSTALLED_TESTS @@ -409,14 +417,19 @@ install-data-local: install-config-local install-config-local: installable-config-local if DBUS_ENABLE_INSTALLED_TESTS - $(AM_V_gen)set -e; \ + $(AM_V_GEN)set -e; \ for F in $(static_data); do \ - install -m644 "$(srcdir)/$$F" "$(testexecdir)/$$F"; \ - done + install -d "$(DESTDIR)$(testexecdir)/$${F%/*}"; \ + install -m644 "$(srcdir)/$$F" "$(DESTDIR)$(testexecdir)/$$F"; \ + done; \ for F in $(in_data); do \ - install -d "$${F%/*}"; - install -m644 "installable/$${F%.in}" "$(testexecdir)/$${F%.in}"; \ + install -d "$(DESTDIR)$(testexecdir)/$${F%/*}"; \ + install -m644 "installable/$${F%.in}" "$(DESTDIR)$(testexecdir)/$${F%.in}"; \ done + ln -nfs $(sysconfdir)/dbus-1/session.conf $(DESTDIR)$(testexecdir)/data/valid-config-files/session.conf + ln -nfs $(sysconfdir)/dbus-1/session.d $(DESTDIR)$(testexecdir)/data/valid-config-files/session.d + ln -nfs $(sysconfdir)/dbus-1/system.conf $(DESTDIR)$(testexecdir)/data/valid-config-files/system.conf + ln -nfs $(sysconfdir)/dbus-1/system.d $(DESTDIR)$(testexecdir)/data/valid-config-files/system.d else @: endif @@ -440,3 +453,17 @@ CLEANFILES = $(noinst_DATA) XDG_RUNTIME_DIR $(imported_data): data/valid-config-files/%.conf: $(top_builddir)/bus/%.conf $(AM_V_at)$(MKDIR_P) data/valid-config-files $(AM_V_GEN)cp $< $@ + +$(installable_test_meta): %.test: % Makefile + $(AM_V_GEN) ( \ + echo '[Test]'; \ + echo 'Type=session'; \ + echo 'Exec=env DBUS_TEST_HOME=$$(pwd)/home.tmp $(testexecdir)/$*'; \ + ) > $@.tmp && mv $@.tmp $@ + +$(installable_test_meta_with_config): %_with_config.test: % Makefile + $(AM_V_GEN) ( \ + echo '[Test]'; \ + echo 'Type=session'; \ + echo 'Exec=env DBUS_TEST_HOME=$$(pwd)/home.tmp DBUS_TEST_DATA=$(testexecdir)/data $(testexecdir)/$*'; \ + ) > $@.tmp && mv $@.tmp $@ -- 2.1.4