Autotest: Make the peer executables report error if they failed

QDBusServer::address() will return an empty QString, which caused the
tests to fail later with no apparent reason.

Change-Id: I86f448dfc67a6cdb27ecda2d490f335766cfaf4f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
bb10
Thiago Macieira 2014-12-11 14:39:22 -08:00
parent 7b6ab50c68
commit 91fe8129fa
3 changed files with 9 additions and 3 deletions

View File

@ -44,7 +44,7 @@ QString valueSpy;
Q_DECLARE_METATYPE(QDBusConnection::RegisterOptions)
class MyServer : public QDBusServer
class MyServer : public QDBusServer, protected QDBusContext
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.qtproject.autotests.qmyserver")
@ -67,6 +67,8 @@ public:
public slots:
QString address() const
{
if (!QDBusServer::isConnected())
sendErrorReply(QDBusServer::lastError().name(), QDBusServer::lastError().message());
return QDBusServer::address();
}

View File

@ -38,7 +38,7 @@ static const char serviceName[] = "org.qtproject.autotests.qpinger";
static const char objectPath[] = "/org/qtproject/qpinger";
//static const char *interfaceName = serviceName;
class PingerServer : public QDBusServer
class PingerServer : public QDBusServer, protected QDBusContext
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.qtproject.autotests.qpinger")
@ -54,6 +54,8 @@ public:
public slots:
QString address() const
{
if (!QDBusServer::isConnected())
sendErrorReply(QDBusServer::lastError().name(), QDBusServer::lastError().message());
return QDBusServer::address();
}

View File

@ -42,7 +42,7 @@ static const char objectPath[] = "/org/qtproject/qmyserver";
int MyObject::callCount = 0;
QVariantList MyObject::callArgs;
class MyServer : public QDBusServer
class MyServer : public QDBusServer, protected QDBusContext
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.qtproject.autotests.qmyserver")
@ -58,6 +58,8 @@ public:
public slots:
QString address() const
{
if (!QDBusServer::isConnected())
sendErrorReply(QDBusServer::lastError().name(), QDBusServer::lastError().message());
return QDBusServer::address();
}