From 7623cf03a68d5c071b06cf50d23e393a37265d95 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 8 Nov 2009 17:35:00 +0100 Subject: Autotest: prevent race-condition from causing a test failure. The test requires receiving the NameOwnerChanged signal from the bus before the voidSignal we emit ourselves. For whatever reason, the bus apparently delays the emission of that signal, which could cause our signal to be received first. We should actually wait for the signal, but a simple processEvents is enough in my tests. --- tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp index 91050f5..a2c4758 100644 --- a/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp +++ b/tests/auto/qdbusabstractinterface/tst_qdbusabstractinterface.cpp @@ -133,7 +133,7 @@ tst_QDBusAbstractInterface::tst_QDBusAbstractInterface() void tst_QDBusAbstractInterface::initTestCase() { // enable debugging temporarily: - putenv("QDBUS_DEBUG=1"); + //putenv("QDBUS_DEBUG=1"); // register the object QDBusConnection con = QDBusConnection::sessionBus(); @@ -465,6 +465,7 @@ void tst_QDBusAbstractInterface::followSignal() QDBusConnectionInterface::DontAllowReplacement); QVERIFY(r.isValid() && r.value() == QDBusConnectionInterface::ServiceRegistered); QVERIFY(con.interface()->isServiceRegistered(serviceToFollow)); + QCoreApplication::instance()->processEvents(); // emit the signal again: emit targetObj.voidSignal(); -- cgit v0.12