Bug 32550 - servicetest.sync_dbus might not be enough in some cases
Summary: servicetest.sync_dbus might not be enough in some cases
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: gabble (show other bugs)
Version: git master
Hardware: Other All
: medium normal
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL: http://git.collabora.co.uk/?p=user/jo...
Whiteboard: review+
Keywords: patch
Depends on:
Blocks:
 
Reported: 2010-12-21 07:36 UTC by Jonny Lamb
Modified: 2011-01-03 09:23 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Jonny Lamb 2010-12-21 07:36:33 UTC
I was using sync_dbus in a mission-control test to make MC spin its mainloop enough so I could assert one method was not being called before I returned from a call that had previously been made. However, sync_dbus alone was not enough as apparently libdbus returns from Ping calls synchronously so it didn't turn the main loop enough. Calling sync_dbus a few times made it work, but it showed the test was going to be racy. This is what I did:

    # Waste a little time here and there.  We can't call sync_dbus
    # here because it calls Ping and libdbus returns from Ping
    # synchronously and doesn't turn the main loop handle enough.
    call_async(q, cd_props, 'Get', cs.CD_IFACE_OP_LIST, 'DispatchOperations')
    event = q.expect('dbus-return', method='Get')

This works in my case because there was no other Get method call, but it would be bad to replace sync_dbus with this as it could grab the dbus method return from some other call, which is obviously bad.

So, we need a better sync_dbus. Ideas?
Comment 1 Simon McVittie 2011-01-03 03:58:16 UTC
Perhaps make an async call to org.freedesktop.Telepathy.Tests.SyncDBusDummyMethod and expect the error?
Comment 2 Jonny Lamb 2011-01-03 08:01:18 UTC
Neat idea. Here's a patch. make check passes. I'm putting it here because gabble is pretty much the canonical location for servicetest.py.
Comment 3 Simon McVittie 2011-01-03 09:15:30 UTC
Looks good.
Comment 4 Jonny Lamb 2011-01-03 09:23:58 UTC
Thanks.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.