From 255507c963bd4860fb25369cec3fd7b5e4a8898c Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 26 Jan 2015 18:55:08 +0000 Subject: [PATCH 2/6] 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 --- configure.ac | 19 ------------------ test/Makefile.am | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 56 insertions(+), 24 deletions(-) diff --git a/configure.ac b/configure.ac index b4bacba..b9fa3ba 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 75810b1..b0be211 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -357,19 +357,70 @@ 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 \ -- 2.1.4