From 5b315d088a8884e11ea90721c54cf3923213cd81 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 9 Dec 2008 09:15:06 -0500 Subject: Bug 18229: Allow signals Our previous fix went too far towards lockdown; many things rely on signals to work, and there's no really good reason to restrict which signals can be emitted on the bus because we can't tie them to a particular sender. --- bus/system.conf.in | 2 ++ test/name-test/Makefile.am | 2 +- test/name-test/run-test-systemserver.sh | 9 +++++++ test/name-test/test-wait-for-echo.py | 41 +++++++++++++++++++++++++++++ test/name-test/tmp-session-like-system.conf | 7 +++++ 5 files changed, 60 insertions(+), 1 deletion(-) create mode 100755 test/name-test/test-wait-for-echo.py diff --git a/bus/system.conf.in b/bus/system.conf.in index a96dd251..db412327 100644 --- a/bus/system.conf.in +++ b/bus/system.conf.in @@ -44,6 +44,8 @@ even if they aren't in here --> + + diff --git a/test/name-test/Makefile.am b/test/name-test/Makefile.am index fa037ae8..64d3a757 100644 --- a/test/name-test/Makefile.am +++ b/test/name-test/Makefile.am @@ -10,7 +10,7 @@ else TESTS= endif -EXTRA_DIST=run-test.sh +EXTRA_DIST=run-test.sh run-test-systemserver.sh test-wait-for-echo.py if DBUS_BUILD_TESTS diff --git a/test/name-test/run-test-systemserver.sh b/test/name-test/run-test-systemserver.sh index fd82326c..34dd6487 100755 --- a/test/name-test/run-test-systemserver.sh +++ b/test/name-test/run-test-systemserver.sh @@ -39,3 +39,12 @@ if ! grep -q 'DBus.Error' echo-error-output.tmp; then echo "=====" exit 1 fi + +echo "running test echo signal" +if ! python ./test-wait-for-echo.py; then + echo "Failed test-wait-for-echo" + exit 1 +fi + + +exit 0 diff --git a/test/name-test/test-wait-for-echo.py b/test/name-test/test-wait-for-echo.py new file mode 100755 index 00000000..bd09e459 --- /dev/null +++ b/test/name-test/test-wait-for-echo.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +import os,sys + +try: + import gobject + import dbus + import dbus.mainloop.glib +except: + print "Failed import, aborting test" + sys.exit(0) + +dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) +loop = gobject.MainLoop() + +exitcode = 0 + +def handle_noreceipt(): + print "Failed to get signal" + global exitcode + exitcode = 1 + loop.quit() + +gobject.timeout_add(7000, handle_noreceipt) + +bus = dbus.SessionBus() + +def sighandler(*args, **kwargs): + print "got signal" + loop.quit() + +bus.add_signal_receiver(sighandler, dbus_interface='org.freedesktop.TestSuite', signal_name='Foo') + +o = bus.get_object('org.freedesktop.DBus.TestSuiteEchoService', '/org/freedesktop/TestSuite') +i = dbus.Interface(o, 'org.freedesktop.TestSuite') +def nullhandler(*args, **kwargs): + pass +i.EmitFoo(reply_handler=nullhandler, error_handler=nullhandler) + +loop.run() +sys.exit(exitcode) diff --git a/test/name-test/tmp-session-like-system.conf b/test/name-test/tmp-session-like-system.conf index 1cbc95c5..b4e43960 100644 --- a/test/name-test/tmp-session-like-system.conf +++ b/test/name-test/tmp-session-like-system.conf @@ -25,6 +25,8 @@ even if they aren't in here --> + + @@ -37,6 +39,11 @@ + +