[next] telepathy-salut: Add GNOME InstalledTests metadata for installed tests

Simon McVittie smcv at kemper.freedesktop.org
Mon May 12 03:56:46 PDT 2014


Module: telepathy-salut
Branch: next
Commit: 24564f4b206bde40dea53c06177240bf3fe7cc58
URL:    http://cgit.freedesktop.org/telepathy/telepathy-salut/commit/?id=24564f4b206bde40dea53c06177240bf3fe7cc58

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Mon May 12 11:11:21 2014 +0100

Add GNOME InstalledTests metadata for installed tests

This is a little more complicated than in the other CMs because it
does each test once with the mock Avahi, and once with the real one.

---

 tests/twisted/Makefile.am       |   27 ++++++++++++++++++++++++++-
 tests/twisted/run-test.sh.in    |    4 +++-
 tests/twisted/tools/Makefile.am |    2 +-
 3 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index d764afe..f83cc64 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -124,7 +124,7 @@ dist_test_data = \
 	avahimock.py \
 	avahitest.py \
 	constants.py \
-	ipv6.py
+	ipv6.py \
 	ns.py \
 	saluttest.py \
 	servicetest.py \
@@ -158,3 +158,28 @@ check_misc_sources = $(TESTS)
 include $(top_srcdir)/tools/check-coding-style.mk
 
 SUBDIRS = tools
+
+real-avahi/%.test: Makefile
+	@$(MKDIR_P) $(dir $@)
+	$(AM_V_GEN)( echo '[Test]'; \
+		echo 'Exec=env SALUT_TEST_REAL_AVAHI=1 ${twistedtestsdir}/run-test.sh $*.py'; \
+		echo 'Type=session'; \
+		echo 'Output=TAP' ) > $@.tmp
+	@mv $@.tmp $@
+
+mock-avahi/%.test: Makefile
+	@$(MKDIR_P) $(dir $@)
+	$(AM_V_GEN)( echo '[Test]'; \
+		echo 'Exec=env -u SALUT_TEST_REAL_AVAHI ${twistedtestsdir}/run-test.sh $*.py'; \
+		echo 'Type=session'; \
+		echo 'Output=TAP' ) > $@.tmp
+	@mv $@.tmp $@
+
+insttestdir = ${datadir}/installed-tests/telepathy-salut-1
+
+if ENABLE_INSTALLED_TESTS
+nobase_nodist_insttest_DATA = \
+	$(patsubst %.py,mock-avahi/%.test,$(TWISTED_TESTS)) \
+	$(patsubst %.py,real-avahi/%.test,$(TWISTED_TESTS)) \
+	$(NULL)
+endif
diff --git a/tests/twisted/run-test.sh.in b/tests/twisted/run-test.sh.in
index a33735e..e3c7bde 100644
--- a/tests/twisted/run-test.sh.in
+++ b/tests/twisted/run-test.sh.in
@@ -67,7 +67,9 @@ fi
 
 if [ -z "$SALUT_TEST_REAL_AVAHI" ]; then
   also_for_system="--also-for-system";
-  config_file="${G_TEST_BUILDDIR}/tools/mock-avahi/tmp-session-bus.conf"
+  if [ "x$CHECK_TWISTED_UNINSTALLED" = x ]; then
+    config_file="${G_TEST_BUILDDIR}/tools/mock-avahi/tmp-session-bus.conf"
+  fi
 fi
 
 n=0
diff --git a/tests/twisted/tools/Makefile.am b/tests/twisted/tools/Makefile.am
index dfe1dee..e797e13 100644
--- a/tests/twisted/tools/Makefile.am
+++ b/tests/twisted/tools/Makefile.am
@@ -2,7 +2,7 @@ exec-with-log.sh: exec-with-log.sh.in
 	$(AM_V_GEN)sed -e "s|[@]abs_top_builddir[@]|@abs_top_builddir@|g" $< > $@
 	@chmod +x $@
 
-%.conf: %.conf.in
+tmp-session-bus.conf: tmp-session-bus.conf.in
 	$(AM_V_GEN)sed -e "s|[@]servicedir[@]|@abs_top_builddir@/tests/twisted/tools|g" $< > $@
 
 servicedir = $(datadir)/dbus-1/services



More information about the telepathy-commits mailing list