On Mo, 2011-05-09 at 12:57 +0100, Patrick Ohly wrote:
> It's probably just my ignorance of the Qt testing framework. I was
> looking for a way to run individual tests, because right now the first
> one hangs for me:
> 
> # bin/tests           
> ********* Start testing of BasicTest *********
> Config: Using QTest library 4.7.2, Qt 4.7.2
> PASS   : BasicTest::initTestCase()
> FAIL!  : BasicTest::testAddContactUpdateTimeStamp() '!
> timestamp.isEmpty()' returned FALSE. ()
>    Loc: [ut_basic/basictest.cpp(48)]
> 
> (process:20224): libebook-CRITICAL **: file e-book.c: line 1534
> (e_book_remove_contact_async): assertion `E_IS_CONTACT (contact)' failed
> ^CQFATAL : BasicTest::testRemoveContact() Received signal 2
> FAIL!  : BasicTest::testRemoveContact() Received a fatal error.
>    Loc: [Unknown file(0)]
> Totals: 1 passed, 2 failed, 0 skipped
> ********* Finished testing of BasicTest *********
> Aborted

After looking at this some more I believe that there is a race condition
in the test and/or the QtMobility API: a contact is added and removed
quickly. A "contact added" signal is emitted, followed by a "contact
deleted". Hypothesis: these signals are processed by their recipient
after the contact was already removed. The D-Bus log below supports that
hypothesis. I haven't verified it by looking at the test source code and
adding printfs.

Reason: EDS delays sending updates, as discussed elsewhere.

Is that a valid implementation of the QtMobility API? I think so. The
API doesn't make any guarantees about timing. In a concurrent system
there is no guarantee either that a contact still exists, even if was
just added recently.

The test therefore has to delay the removal of the contact long enough
for the "contact added" to be propagated, either with sleep() (not so
nice) or waiting for the change (but needs a timeout, in case that
sending the change fails and never occurs). Chris, does that make sense?

method call sender=:1.81 -> dest=:1.78 serial=32
path=/org/gnome/evolution/dataserver/addressbook/502/2; interface=or
g.gnome.evolution.dataserver.addressbook.Book; member=addContact
   string "BEGIN:VCARD
VERSION:3.0
N:;;;;
FN:
END:VCARD"
signal sender=:1.78 -> dest=(null destination) serial=24
path=/org/gnome/evolution/dataserver/addressbook/BookView/50
2/1; interface=org.gnome.evolution.dataserver.addressbook.BookView;
member=ContactsAdded
   array [
      string "BEGIN:VCARD
VERSION:3.0
N:;;;;
FN:
UID:pas-id-0003
REV:2011-05-11T07:22:11Z
END:VCARD"
   ]
signal sender=:1.78 -> dest=(null destination) serial=25
path=/org/gnome/evolution/dataserver/addressbook/BookView/502/1;
interface=org.gnome.evolution.dataserver.addressbook.BookView;
member=Complete
   uint32 0
   string ""
method return sender=:1.78 -> dest=:1.81 reply_serial=32
   string "pas-id-0003"
method call sender=:1.81 -> dest=:1.78 serial=33
path=/org/gnome/evolution/dataserver/addressbook/502/2;
interface=org.gnome.evolution.dataserver.addressbook.Book;
member=getContact
   string "pas-id-0003"
method return sender=:1.78 -> dest=:1.81 reply_serial=33
   string "BEGIN:VCARD
VERSION:3.0
N:;;;;
FN:
UID:pas-id-0003
REV:2011-05-11T07:22:11Z
END:VCARD"
method call sender=:1.81 -> dest=:1.78 serial=34
path=/org/gnome/evolution/dataserver/addressbook/502/2;
interface=org.gnome.evolution.dataserver.addressbook.Book;
member=removeContacts
   array [
      string "pas-id-0003"
   ]
signal sender=:1.78 -> dest=(null destination) serial=28
path=/org/gnome/evolution/dataserver/addressbook/BookView/502/1;
interface=org.gnome.evolution.dataserver.addressbook.BookView;
member=ContactsRemoved
   array [
      string "pas-id-0003"
   ]
signal sender=:1.78 -> dest=(null destination) serial=29
path=/org/gnome/evolution/dataserver/addressbook/BookView/502/1;
interface=org.gnome.evolution.dataserver.addressbook.BookView;
member=Complete
   uint32 0
   string ""
method return sender=:1.78 -> dest=:1.81 reply_serial=34
method call sender=:1.81 -> dest=:1.78 serial=35
path=/org/gnome/evolution/dataserver/addressbook/502/2;
interface=org.gnome.evolution.dataserver.addressbook.Book;
member=getContact
   string "pas-id-0003"
error sender=:1.78 -> dest=:1.81
error_name=org.gnome.evolution.dataserver.addressbook.Book.ContactNotFound 
reply_serial=35
   string "Cannot get contact: Contact not found"


-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.


_______________________________________________
MeeGo-dev mailing list
MeeGo-dev@meego.com
http://lists.meego.com/listinfo/meego-dev
http://wiki.meego.com/Mailing_list_guidelines

Reply via email to