summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-09-12 14:11:17 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-09-12 14:35:53 +0200
commit52e3df63bb1f985637a53e73b892f55387043cea (patch)
tree77d8e0d5b33f55f0d2551799417e67cf8bd41285 /tests
parent8fbc5939d539754f2a6c4d55e847ccca07119728 (diff)
move tests tools to tests/twisted/tools
Other CMs store these files there. https://bugs.freedesktop.org/show_bug.cgi?id=69269
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am29
-rw-r--r--tests/haze.service.in3
-rw-r--r--tests/twisted/Makefile.am6
-rw-r--r--tests/twisted/tools/Makefile.am24
-rwxr-xr-xtests/twisted/tools/exec-with-log.sh (renamed from tests/exec-with-log.sh)0
-rw-r--r--tests/twisted/tools/haze.service.in3
-rw-r--r--tests/twisted/tools/tmp-session-bus.conf.in (renamed from tests/tmp-session-bus.conf.in)2
-rw-r--r--tests/twisted/tools/with-session-bus.sh106
8 files changed, 138 insertions, 35 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index edb1084..0677b8f 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,32 +3,3 @@ SUBDIRS = .
if WANT_TWISTED_TESTS
SUBDIRS += twisted
endif
-
-%.conf: %.conf.in
- $(AM_V_GEN)sed -e "s|[@]abs_top_builddir[@]|@abs_top_builddir@|g" $< > $@
-
-# We don't use the full filename for the .in because > 99 character filenames
-# in tarballs are non-portable (and automake 1.8 doesn't let us build
-# non-archaic tarballs)
-org.freedesktop.Telepathy.ConnectionManager.%.service: %.service.in
- $(AM_V_GEN)sed -e "s|[@]abs_top_builddir[@]|@abs_top_builddir@|g" \
- -e "s|[@]abs_top_srcdir[@]|@abs_top_srcdir@|g" $< > $@
-
-# D-Bus service file for testing
-service_in_files = haze.service.in
-service_files = org.freedesktop.Telepathy.ConnectionManager.haze.service
-
-# D-Bus config file for testing
-conf_in_files = tmp-session-bus.conf.in
-conf_files = $(conf_in_files:.conf.in=.conf)
-
-BUILT_SOURCES = $(service_files) $(conf_files)
-
-EXTRA_DIST = \
- $(service_in_files) \
- $(conf_in_files) \
- exec-with-log.sh
-
-CLEANFILES = \
- $(BUILT_SOURCES) \
- haze-testing.log
diff --git a/tests/haze.service.in b/tests/haze.service.in
deleted file mode 100644
index 976f8af..0000000
--- a/tests/haze.service.in
+++ /dev/null
@@ -1,3 +0,0 @@
-[D-BUS Service]
-Name=org.freedesktop.Telepathy.ConnectionManager.haze
-Exec=@abs_top_srcdir@/tests/exec-with-log.sh @abs_top_srcdir@ @abs_top_builddir@
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index ec838bb..89b9c14 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -1,3 +1,5 @@
+SUBDIRS = tools
+
TWISTED_TESTS = \
avatar-requirements.py \
simple-caps.py \
@@ -32,8 +34,8 @@ check-local: check-twisted
check-twisted:
rm -f ../haze-testing.log
- sh $(top_srcdir)/tools/with-session-bus.sh \
- --config-file=$(top_builddir)/tests/tmp-session-bus.conf \
+ sh $(top_srcdir)/tests/twisted/tools/with-session-bus.sh \
+ --config-file=$(top_builddir)/tests/twisted/tools/tmp-session-bus.conf \
-- $(MAKE) check-TESTS \
TESTS="$(TWISTED_TESTS)" \
TESTS_ENVIRONMENT="$(TESTS_ENVIRONMENT) $(TEST_PYTHON)"
diff --git a/tests/twisted/tools/Makefile.am b/tests/twisted/tools/Makefile.am
new file mode 100644
index 0000000..db691a5
--- /dev/null
+++ b/tests/twisted/tools/Makefile.am
@@ -0,0 +1,24 @@
+%.conf: %.conf.in
+ $(AM_V_GEN)sed -e "s|[@]abs_top_builddir[@]|@abs_top_builddir@|g" $< > $@
+
+# We don't use the full filename for the .in because > 99 character filenames
+# in tarballs are non-portable (and automake 1.8 doesn't let us build
+# non-archaic tarballs)
+org.freedesktop.Telepathy.ConnectionManager.%.service: %.service.in
+ $(AM_V_GEN)sed -e "s|[@]abs_top_builddir[@]|@abs_top_builddir@|g" \
+ -e "s|[@]abs_top_srcdir[@]|@abs_top_srcdir@|g" $< > $@
+
+# D-Bus service file for testing
+service_in_files = haze.service.in
+service_files = org.freedesktop.Telepathy.ConnectionManager.haze.service
+
+# D-Bus config file for testing
+conf_in_files = tmp-session-bus.conf.in
+conf_files = $(conf_in_files:.conf.in=.conf)
+
+BUILT_SOURCES = $(service_files) $(conf_files)
+
+EXTRA_DIST = \
+ $(service_in_files) \
+ $(conf_in_files) \
+ exec-with-log.sh
diff --git a/tests/exec-with-log.sh b/tests/twisted/tools/exec-with-log.sh
index 54abf29..54abf29 100755
--- a/tests/exec-with-log.sh
+++ b/tests/twisted/tools/exec-with-log.sh
diff --git a/tests/twisted/tools/haze.service.in b/tests/twisted/tools/haze.service.in
new file mode 100644
index 0000000..8ee3f3a
--- /dev/null
+++ b/tests/twisted/tools/haze.service.in
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.freedesktop.Telepathy.ConnectionManager.haze
+Exec=@abs_top_srcdir@/tests/twisted/tools/exec-with-log.sh @abs_top_srcdir@ @abs_top_builddir@
diff --git a/tests/tmp-session-bus.conf.in b/tests/twisted/tools/tmp-session-bus.conf.in
index c73caac..84d8d65 100644
--- a/tests/tmp-session-bus.conf.in
+++ b/tests/twisted/tools/tmp-session-bus.conf.in
@@ -10,7 +10,7 @@
<listen>unix:tmpdir=/tmp</listen>
- <servicedir>@abs_top_builddir@/tests</servicedir>
+ <servicedir>@abs_top_builddir@/tests/twisted/tools</servicedir>
<policy context="default">
<!-- Allow everything to be sent -->
diff --git a/tests/twisted/tools/with-session-bus.sh b/tests/twisted/tools/with-session-bus.sh
new file mode 100644
index 0000000..0afa593
--- /dev/null
+++ b/tests/twisted/tools/with-session-bus.sh
@@ -0,0 +1,106 @@
+#!/bin/sh
+# with-session-bus.sh - run a program with a temporary D-Bus session daemon
+#
+# The canonical location of this program is the telepathy-glib tools/
+# directory, please synchronize any changes with that copy.
+#
+# Copyright (C) 2007-2008 Collabora Ltd. <http://www.collabora.co.uk/>
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+
+set -e
+
+me=with-session-bus
+
+dbus_daemon_args="--print-address=5 --print-pid=6 --fork"
+sleep=0
+
+usage ()
+{
+ echo "usage: $me [options] -- program [program_options]" >&2
+ echo "Requires write access to the current directory." >&2
+ echo "" >&2
+ echo "If \$WITH_SESSION_BUS_FORK_DBUS_MONITOR is set, fork dbus-monitor" >&2
+ echo "with the arguments in \$WITH_SESSION_BUS_FORK_DBUS_MONITOR_OPT." >&2
+ echo "The output of dbus-monitor is saved in $me-<pid>.dbus-monitor-logs" >&2
+ exit 2
+}
+
+while test "z$1" != "z--"; do
+ case "$1" in
+ --sleep=*)
+ sleep="$1"
+ sleep="${sleep#--sleep=}"
+ shift
+ ;;
+ --session)
+ dbus_daemon_args="$dbus_daemon_args --session"
+ shift
+ ;;
+ --config-file=*)
+ # FIXME: assumes config file doesn't contain any special characters
+ dbus_daemon_args="$dbus_daemon_args $1"
+ shift
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done
+shift
+if test "z$1" = "z"; then usage; fi
+
+exec 5> $me-$$.address
+exec 6> $me-$$.pid
+
+cleanup ()
+{
+ pid=`head -n1 $me-$$.pid`
+ if test -n "$pid" ; then
+ if [ -n "$VERBOSE_TESTS" ]; then
+ echo "Killing temporary bus daemon: $pid" >&2
+ fi
+ kill -INT "$pid"
+ fi
+ rm -f $me-$$.address
+ rm -f $me-$$.pid
+}
+
+trap cleanup INT HUP TERM
+dbus-daemon $dbus_daemon_args
+
+if [ -n "$VERBOSE_TESTS" ]; then
+ { echo -n "Temporary bus daemon is "; cat $me-$$.address; } >&2
+ { echo -n "Temporary bus daemon PID is "; head -n1 $me-$$.pid; } >&2
+fi
+
+e=0
+
+# These might be non-null when run from e.g. gnome-terminal 3.8, which uses
+# an activatable service for its windows; we don't want to inherit them either
+unset DBUS_STARTER_ADDRESS
+unset DBUS_STARTER_BUS_TYPE
+
+DBUS_SESSION_BUS_ADDRESS="`cat $me-$$.address`"
+export DBUS_SESSION_BUS_ADDRESS
+DBUS_SESSION_BUS_PID="`cat $me-$$.pid`"
+export DBUS_SESSION_BUS_PID
+
+if [ -n "$WITH_SESSION_BUS_FORK_DBUS_MONITOR" ] ; then
+ echo -n "Forking dbus-monitor $WITH_SESSION_BUS_FORK_DBUS_MONITOR_OPT" >&2
+ dbus-monitor $WITH_SESSION_BUS_FORK_DBUS_MONITOR_OPT \
+ > $me-$$.dbus-monitor-logs 2>&1 &
+fi
+
+"$@" || e=$?
+
+if test $sleep != 0; then
+ sleep $sleep
+fi
+
+trap - INT HUP TERM
+cleanup
+
+exit $e