Commit 1e21cc86 authored by Simon McVittie's avatar Simon McVittie
Browse files

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
Reviewed-by: Philip Withnall
parent ee032f5a
...@@ -1816,6 +1816,7 @@ echo " ...@@ -1816,6 +1816,7 @@ echo "
Building modular tests: ${enable_modular_tests} Building modular tests: ${enable_modular_tests}
- with GLib: ${with_glib} - with GLib: ${with_glib}
- with dbus-glib: ${with_dbus_glib} - with dbus-glib: ${with_dbus_glib}
Installing tests: ${enable_installed_tests}
Building verbose mode: ${enable_verbose_mode} Building verbose mode: ${enable_verbose_mode}
Building assertions: ${enable_asserts} Building assertions: ${enable_asserts}
Building checks: ${enable_checks} Building checks: ${enable_checks}
......
...@@ -136,9 +136,11 @@ manual_tcp_LDADD = $(top_builddir)/dbus/libdbus-internal.la ...@@ -136,9 +136,11 @@ manual_tcp_LDADD = $(top_builddir)/dbus/libdbus-internal.la
EXTRA_DIST = dbus-test-runner EXTRA_DIST = dbus-test-runner
testexecdir = $(libdir)/dbus-1.0/test testexecdir = $(libexecdir)/installed-tests/dbus
testmetadir = $(datadir)/installed-tests/dbus
testexec_PROGRAMS = testexec_PROGRAMS =
testmeta_DATA =
installable_tests = \ installable_tests = \
test-shell \ test-shell \
...@@ -166,6 +168,9 @@ installable_manual_tests += \ ...@@ -166,6 +168,9 @@ installable_manual_tests += \
$(NULL) $(NULL)
endif DBUS_WITH_GLIB endif DBUS_WITH_GLIB
installable_test_meta = $(installable_tests:=.test)
installable_test_meta_with_config = $(installable_tests:=_with_config.test)
installcheck_tests = installcheck_tests =
installcheck_environment = \ installcheck_environment = \
XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR \ XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR \
...@@ -241,6 +246,9 @@ installcheck_tests += $(installable_tests) ...@@ -241,6 +246,9 @@ installcheck_tests += $(installable_tests)
if DBUS_ENABLE_INSTALLED_TESTS if DBUS_ENABLE_INSTALLED_TESTS
testexec_PROGRAMS += $(installable_tests) $(installable_manual_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 else !DBUS_ENABLE_INSTALLED_TESTS
noinst_PROGRAMS += $(installable_tests) $(installable_manual_tests) noinst_PROGRAMS += $(installable_tests) $(installable_manual_tests)
endif !DBUS_ENABLE_INSTALLED_TESTS endif !DBUS_ENABLE_INSTALLED_TESTS
...@@ -414,14 +422,19 @@ install-data-local: install-config-local ...@@ -414,14 +422,19 @@ install-data-local: install-config-local
install-config-local: installable-config-local install-config-local: installable-config-local
if DBUS_ENABLE_INSTALLED_TESTS if DBUS_ENABLE_INSTALLED_TESTS
$(AM_V_gen)set -e; \ $(AM_V_GEN)set -e; \
for F in $(static_data); do \ for F in $(static_data); do \
install -m644 "$(srcdir)/$$F" "$(testexecdir)/$$F"; \ install -d "$(DESTDIR)$(testexecdir)/$${F%/*}"; \
done install -m644 "$(srcdir)/$$F" "$(DESTDIR)$(testexecdir)/$$F"; \
done; \
for F in $(in_data); do \ for F in $(in_data); do \
install -d "$${F%/*}"; install -d "$(DESTDIR)$(testexecdir)/$${F%/*}"; \
install -m644 "installable/$${F%.in}" "$(testexecdir)/$${F%.in}"; \ install -m644 "installable/$${F%.in}" "$(DESTDIR)$(testexecdir)/$${F%.in}"; \
done 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 else
@: @:
endif endif
...@@ -452,3 +465,17 @@ CLEANFILES = \ ...@@ -452,3 +465,17 @@ CLEANFILES = \
$(imported_data): data/valid-config-files/%.conf: $(top_builddir)/bus/%.conf $(imported_data): data/valid-config-files/%.conf: $(top_builddir)/bus/%.conf
$(AM_V_at)$(MKDIR_P) data/valid-config-files $(AM_V_at)$(MKDIR_P) data/valid-config-files
$(AM_V_GEN)cp $< $@ $(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 $@
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