diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2015-01-26 18:55:08 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2015-02-03 16:19:00 +0000 |
commit | ee032f5a119a9c8a36cfb6c6ff8762b16f640278 (patch) | |
tree | 89a6ff63c30e412112f68e64ec46d982a8177eba | |
parent | 8b238f3f0dee18395769f9f009e98623cdce951c (diff) | |
download | dbus-ee032f5a119a9c8a36cfb6c6ff8762b16f640278.tar.gz |
Generate test configuration files via build-time sed, not configure
This means we can generate a version that works when installed,
from the same source files.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=88810
Reviewed-by: Philip Withnall
-rw-r--r-- | configure.ac | 19 | ||||
-rw-r--r-- | test/Makefile.am | 70 |
2 files changed, 64 insertions, 25 deletions
diff --git a/configure.ac b/configure.ac index 8bddc95c..c7616a90 100644 --- a/configure.ac +++ b/configure.ac @@ -1782,25 +1782,6 @@ doc/dbus-send.1.xml doc/dbus-uuidgen.1.xml dbus-1.pc dbus-1-uninstalled.pc -test/data/valid-config-files/debug-allow-all.conf -test/data/valid-config-files/debug-allow-all-sha1.conf -test/data/valid-config-files/finite-timeout.conf -test/data/valid-config-files/incoming-limit.conf -test/data/valid-config-files-system/debug-allow-all-pass.conf -test/data/valid-config-files-system/debug-allow-all-fail.conf -test/data/valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service -test/data/valid-service-files/org.freedesktop.DBus.TestSuiteEchoService.service -test/data/valid-service-files/org.freedesktop.DBus.TestSuiteForkingEchoService.service -test/data/valid-service-files/org.freedesktop.DBus.TestSuiteSegfaultService.service -test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service -test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service -test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service -test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service -test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service -test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service -test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoExec.service -test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service -test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service ]) AC_OUTPUT diff --git a/test/Makefile.am b/test/Makefile.am index 667ed2c5..294291bb 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -362,25 +362,79 @@ EXTRA_DIST += $(static_data) ## copy tests to builddir so that generated tests and static tests ## are all in one place. -all-local: +all-local: copy-config-local uninstalled-config-local + @: + +copy-config-local: $(AM_V_at)$(MKDIR_P) data/valid-config-files/session.d - $(AM_V_at)set -e && \ + $(AM_V_GEN)set -e; \ if test $(srcdir) = . || test $(srcdir) -ef .; then \ echo '-- No need to copy test data as srcdir = builddir'; \ else \ for F in $(static_data); do \ - $(MKDIR_P) $${F%/*}; \ - rm -f $$F; \ - cp $(srcdir)/$$F $$F; \ + $(MKDIR_P) "$${F%/*}"; \ + rm -f "$$F"; \ + cp $(srcdir)/"$$F" "$$F"; \ done; \ fi +uninstalled-config-local: + $(AM_V_GEN)set -e; \ + for F in $(in_data); do \ + $(MKDIR_P) "$${F%/*}"; \ + sed \ + -e 's,[@]DBUS_TEST_DATA[@],@abs_builddir@/data,' \ + -e 's,[@]DBUS_TEST_EXEC[@],@abs_builddir@,' \ + -e 's,[@]EXEEXT[@],$(EXEEXT),' \ + -e 's,[@]TEST_LAUNCH_HELPER_BINARY[@],@abs_top_builddir@/bus/dbus-daemon-launch-helper-test$(EXEEXT),' \ + -e 's,[@]TEST_LISTEN[@],$(TEST_LISTEN),' \ + < $(srcdir)/"$$F" > "$${F%.in}"; \ + done + +installable-config-local: +if DBUS_ENABLE_INSTALLED_TESTS + $(AM_V_GEN)set -e; \ + for F in $(in_data); do \ + $(MKDIR_P) "installable/$${F%/*}"; \ + sed \ + -e 's,[@]DBUS_TEST_DATA[@],$(testexecdir)/data,' \ + -e 's,[@]DBUS_TEST_EXEC[@],$(testexecdir),' \ + -e 's,[@]EXEEXT[@],$(EXEEXT),' \ + -e 's,[@]TEST_LAUNCH_HELPER_BINARY[@],/bin/false,' \ + -e 's,[@]TEST_LISTEN[@],$(TEST_LISTEN),' \ + < $(srcdir)/"$$F" > "installable/$${F%.in}"; \ + done +else + @: +endif + + +install-data-local: install-config-local + @: + +install-config-local: installable-config-local +if DBUS_ENABLE_INSTALLED_TESTS + $(AM_V_gen)set -e; \ + for F in $(static_data); do \ + install -m644 "$(srcdir)/$$F" "$(testexecdir)/$$F"; \ + done + for F in $(in_data); do \ + install -d "$${F%/*}"; + install -m644 "installable/$${F%.in}" "$(testexecdir)/$${F%.in}"; \ + done +else + @: +endif + ## this doesn't clean most copied test data files when srcdir=builddir clean-local: $(AM_V_at)if test $(srcdir) = . || test $(srcdir) -ef .; then \ echo '-- No need to clean test data as srcdir = builddir'; \ else \ rm -f $(static_data); \ + for F in $(in_data); do \ + rm -f "$${F%.in}"; \ + done; \ fi imported_data = \ @@ -389,7 +443,11 @@ imported_data = \ $(NULL) noinst_DATA = $(imported_data) -CLEANFILES = $(noinst_DATA) XDG_RUNTIME_DIR +CLEANFILES = \ + $(noinst_DATA) \ + XDG_RUNTIME_DIR \ + installable \ + $(NULL) $(imported_data): data/valid-config-files/%.conf: $(top_builddir)/bus/%.conf $(AM_V_at)$(MKDIR_P) data/valid-config-files |