summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-09-23 11:28:08 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2011-09-23 11:28:13 +0100
commita669b92559e7017b6381c44959fc077acc72b11f (patch)
treee02bb2b449225f2abe945ae0ac1b768771be283a /tests
parent42cef84969d9f0ac32a90cccaaddc57e221d9950 (diff)
parentc8b1014ebc4ae7ad7fed8810e5ed0a05ebd7d5d9 (diff)
Merge branch 'uncontroversial'
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'tests')
-rw-r--r--tests/twisted/Makefile.am2
-rw-r--r--tests/twisted/account-manager/auto-connect.py2
-rw-r--r--tests/twisted/account-manager/avatar-persist.py2
-rw-r--r--tests/twisted/account-manager/avatar-refresh.py2
-rw-r--r--tests/twisted/account-manager/make-valid.py2
-rw-r--r--tests/twisted/account-storage/libaccounts-sso-storage.py2
-rw-r--r--tests/twisted/crash-recovery/crash-recovery.py2
-rw-r--r--tests/twisted/dispatcher/create-at-startup.py2
-rw-r--r--tests/twisted/mctest.py14
-rw-r--r--tests/twisted/servicetest.py11
-rw-r--r--tests/twisted/tools/with-session-bus.sh41
11 files changed, 56 insertions, 26 deletions
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index d2ed5f10..392dbe05 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -188,7 +188,7 @@ WITH_SESSION_BUS = \
COMBINED_TESTS_ENVIRONMENT = \
$(BASIC_TESTS_ENVIRONMENT) \
- $(PYTHON)
+ $(PYTHON) -u
SEPARATE_TESTS_ENVIRONMENT = \
$(BASIC_TESTS_ENVIRONMENT) \
diff --git a/tests/twisted/account-manager/auto-connect.py b/tests/twisted/account-manager/auto-connect.py
index badcf7fc..9f5803a1 100644
--- a/tests/twisted/account-manager/auto-connect.py
+++ b/tests/twisted/account-manager/auto-connect.py
@@ -79,7 +79,7 @@ def test(q, bus, unused):
'password': r'\\ionstorm\\',
}
- mc = make_mc(bus, q.append)
+ mc = make_mc(bus)
request_conn, prop_changed, _ = q.expect_many(
EventPattern('dbus-method-call', method='RequestConnection',
diff --git a/tests/twisted/account-manager/avatar-persist.py b/tests/twisted/account-manager/avatar-persist.py
index e1334435..b4cd6570 100644
--- a/tests/twisted/account-manager/avatar-persist.py
+++ b/tests/twisted/account-manager/avatar-persist.py
@@ -77,7 +77,7 @@ def test(q, bus, unused):
'password': 'ionstorm',
}
- mc = make_mc(bus, q.append)
+ mc = make_mc(bus)
e, _ = q.expect_many(
EventPattern('dbus-method-call', method='RequestConnection',
diff --git a/tests/twisted/account-manager/avatar-refresh.py b/tests/twisted/account-manager/avatar-refresh.py
index 7cc2d2c8..87895042 100644
--- a/tests/twisted/account-manager/avatar-refresh.py
+++ b/tests/twisted/account-manager/avatar-refresh.py
@@ -77,7 +77,7 @@ def test(q, bus, unused):
'password': 'ionstorm',
}
- mc = make_mc(bus, q.append)
+ mc = make_mc(bus)
e, _ = q.expect_many(
EventPattern('dbus-method-call', method='RequestConnection',
diff --git a/tests/twisted/account-manager/make-valid.py b/tests/twisted/account-manager/make-valid.py
index 17d58049..9853b293 100644
--- a/tests/twisted/account-manager/make-valid.py
+++ b/tests/twisted/account-manager/make-valid.py
@@ -94,7 +94,7 @@ def test(q, bus, unused):
q.forbid_events(events)
# Wait for MC to load
- mc = make_mc(bus, q.append)
+ mc = make_mc(bus)
q.expect_many(
EventPattern('dbus-signal', signal='NameOwnerChanged',
diff --git a/tests/twisted/account-storage/libaccounts-sso-storage.py b/tests/twisted/account-storage/libaccounts-sso-storage.py
index c6b68b6c..af2455e4 100644
--- a/tests/twisted/account-storage/libaccounts-sso-storage.py
+++ b/tests/twisted/account-storage/libaccounts-sso-storage.py
@@ -30,7 +30,7 @@ import dbus.service
from servicetest import EventPattern, tp_name_prefix, tp_path_prefix, \
call_async
from mctest import exec_test, create_fakecm_account, get_account_manager, \
- get_fakecm_account, make_mc
+ get_fakecm_account
import constants as cs
if ('ACCOUNTS' not in os.environ or not os.environ['ACCOUNTS']):
diff --git a/tests/twisted/crash-recovery/crash-recovery.py b/tests/twisted/crash-recovery/crash-recovery.py
index da632949..42963772 100644
--- a/tests/twisted/crash-recovery/crash-recovery.py
+++ b/tests/twisted/crash-recovery/crash-recovery.py
@@ -95,7 +95,7 @@ def test(q, bus, unused):
# Service-activate MC.
# We're told about the other channel as an observer...
- mc = make_mc(bus, q.append)
+ mc = make_mc(bus)
_, _, _, e = q.expect_many(
EventPattern('dbus-signal',
path='/org/freedesktop/DBus',
diff --git a/tests/twisted/dispatcher/create-at-startup.py b/tests/twisted/dispatcher/create-at-startup.py
index ceec48bd..6cacfc23 100644
--- a/tests/twisted/dispatcher/create-at-startup.py
+++ b/tests/twisted/dispatcher/create-at-startup.py
@@ -73,7 +73,7 @@ def test(q, bus, unused):
cs.tp_name_prefix + '.ConnectionManager.fakecm', bus=bus)
# service-activate MC and immediately make a request
- mc = make_mc(bus, q.append)
+ mc = make_mc(bus)
account = bus.get_object(cs.MC,
cs.tp_path_prefix +
diff --git a/tests/twisted/mctest.py b/tests/twisted/mctest.py
index 11fb56f3..c9639479 100644
--- a/tests/twisted/mctest.py
+++ b/tests/twisted/mctest.py
@@ -33,13 +33,7 @@ from twisted.internet import reactor
import dbus
import dbus.service
-def make_mc(bus, event_func, params=None):
- default_params = {
- }
-
- if params:
- default_params.update(params)
-
+def make_mc(bus):
mc = bus.get_object(
cs.tp_name_prefix + '.MissionControl5',
cs.tp_path_prefix + '/MissionControl5',
@@ -77,8 +71,8 @@ def wait_for_name(queue, bus, name):
queue.expect('dbus-signal', signal='NameOwnerChanged',
predicate=lambda e: e.args[0] == name and e.args[2])
-def wait_for_mc(queue, bus, params):
- mc = make_mc(bus, queue.append, params)
+def wait_for_mc(queue, bus):
+ mc = make_mc(bus)
wait_for_name(queue, bus, cs.AM)
wait_for_name(queue, bus, cs.CD)
return mc
@@ -101,7 +95,7 @@ def exec_test_deferred (fun, params, protocol=None, timeout=None,
if preload_mc:
try:
- mc = wait_for_mc(queue, bus, params)
+ mc = wait_for_mc(queue, bus)
except Exception, e:
import traceback
traceback.print_exc()
diff --git a/tests/twisted/servicetest.py b/tests/twisted/servicetest.py
index c1d292cf..c0c63ed3 100644
--- a/tests/twisted/servicetest.py
+++ b/tests/twisted/servicetest.py
@@ -470,9 +470,14 @@ def call_async(test, proxy, method, *args, **kw):
method_proxy(*args, **kw)
def sync_dbus(bus, q, proxy):
- # Dummy D-Bus method call
- call_async(q, dbus.Interface(proxy, dbus.PEER_IFACE), "Ping")
- event = q.expect('dbus-return', method='Ping')
+ # Dummy D-Bus method call. We can't use DBus.Peer.Ping() because libdbus
+ # replies to that message immediately, rather than handing it up to
+ # dbus-glib and thence the application, which means that Ping()ing the
+ # application doesn't ensure that it's processed all D-Bus messages prior
+ # to our ping.
+ call_async(q, dbus.Interface(proxy, 'org.freedesktop.Telepathy.Tests'),
+ 'DummySyncDBus')
+ q.expect('dbus-error', method='DummySyncDBus')
class ProxyWrapper:
def __init__(self, object, default, others):
diff --git a/tests/twisted/tools/with-session-bus.sh b/tests/twisted/tools/with-session-bus.sh
index 320c8e9a..77abb853 100644
--- a/tests/twisted/tools/with-session-bus.sh
+++ b/tests/twisted/tools/with-session-bus.sh
@@ -15,6 +15,7 @@ set -e
me=with-session-bus
dbus_daemon_args="--print-address=5 --print-pid=6 --fork"
+sleep=0
usage ()
{
@@ -29,6 +30,11 @@ usage ()
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
@@ -38,6 +44,10 @@ while test "z$1" != "z--"; do
dbus_daemon_args="$dbus_daemon_args $1"
shift
;;
+ --also-for-system)
+ with_system_bus=1
+ shift
+ ;;
*)
usage
;;
@@ -53,7 +63,9 @@ cleanup ()
{
pid=`head -n1 $me-$$.pid`
if test -n "$pid" ; then
- echo "Killing temporary bus daemon: $pid" >&2
+ if [ -n "$CHECK_TWISTED_VERBOSE" ] || [ -n "$VERBOSE_TESTS" ]; then
+ echo "Killing temporary bus daemon: $pid" >&2
+ fi
kill -INT "$pid"
fi
rm -f $me-$$.address
@@ -63,21 +75,40 @@ cleanup ()
trap cleanup INT HUP TERM
dbus-daemon $dbus_daemon_args
-{ echo -n "Temporary bus daemon is "; cat $me-$$.address; } >&2
-{ echo -n "Temporary bus daemon PID is "; head -n1 $me-$$.pid; } >&2
+if [ -n "$CHECK_TWISTED_VERBOSE" ] || [ -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
DBUS_SESSION_BUS_ADDRESS="`cat $me-$$.address`"
export DBUS_SESSION_BUS_ADDRESS
+if [ -n "$with_system_bus" ] ; then
+ DBUS_SYSTEM_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS"
+ export DBUS_SYSTEM_BUS_ADDRESS
+fi
+
if [ -n "$WITH_SESSION_BUS_FORK_DBUS_MONITOR" ] ; then
- echo "Forking dbus-monitor $WITH_SESSION_BUS_FORK_DBUS_MONITOR_OPT" >&2
+ DBUS_MONITOR_LOG_FILE="$me-$$.dbus-monitor-logs"
+ echo "Running dbus-monitor $WITH_SESSION_BUS_FORK_DBUS_MONITOR_OPT" >&2
+ echo "Its output will be in $DBUS_MONITOR_LOG_FILE" >&2
dbus-monitor $WITH_SESSION_BUS_FORK_DBUS_MONITOR_OPT \
- > $me-$$.dbus-monitor-logs 2>&1 &
+ > $DBUS_MONITOR_LOG_FILE 2>&1 &
+fi
+
+if [ -n "$GABBLE_TEST_BUSTLE" ]; then
+ BUSTLE_LOG_FILE="tools/$me-$$.bustle-logs"
+ echo "Running bustle-dbus-monitor; log file $BUSTLE_LOG_FILE" >&2
+ bustle-dbus-monitor > $BUSTLE_LOG_FILE 2>&1 &
fi
"$@" || e=$?
+if test $sleep != 0; then
+ sleep $sleep
+fi
+
trap - INT HUP TERM
cleanup