Autotest: Be nicer when asking the sub-processes to exit
Instead of killing them outright (and note that terminate() doesn't work on Windows), ask them nicely to exit on their own. This way, if we run them in valgrind, valgrind gets a chance to print the leak check output and summary. Change-Id: Ib6cc8d4560ff0bf255f94980eb220e97592c00f0 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
This commit is contained in:
parent
5fefec9136
commit
6d3558b449
@ -133,6 +133,11 @@ public slots:
|
||||
valueSpy.clear();
|
||||
}
|
||||
|
||||
void quit()
|
||||
{
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
signals:
|
||||
Q_SCRIPTABLE void syncReceived(const QString &sequence);
|
||||
|
||||
|
@ -521,8 +521,10 @@ void tst_QDBusAbstractAdaptor::initTestCase()
|
||||
|
||||
void tst_QDBusAbstractAdaptor::cleanupTestCase()
|
||||
{
|
||||
QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit");
|
||||
QDBusConnection::sessionBus().call(msg);
|
||||
proc.waitForFinished(200);
|
||||
proc.close();
|
||||
proc.kill();
|
||||
}
|
||||
|
||||
void tst_QDBusAbstractAdaptor::methodCalls_data()
|
||||
|
@ -87,6 +87,11 @@ public slots:
|
||||
emit targetObj.complexSignal(reg);
|
||||
}
|
||||
|
||||
void quit()
|
||||
{
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
private slots:
|
||||
void handleConnection(const QDBusConnection& con)
|
||||
{
|
||||
|
@ -252,19 +252,10 @@ void tst_QDBusAbstractInterface::initTestCase()
|
||||
|
||||
void tst_QDBusAbstractInterface::cleanupTestCase()
|
||||
{
|
||||
// Kill peer, resetting the object exported by a separate process
|
||||
#ifdef Q_OS_WIN
|
||||
proc.kill(); // non-GUI processes don't respond to QProcess::terminate()
|
||||
#else
|
||||
proc.terminate();
|
||||
#endif
|
||||
QVERIFY(proc.waitForFinished() || proc.state() == QProcess::NotRunning);
|
||||
|
||||
// Wait until the service is certainly not registered
|
||||
QDBusConnection con = QDBusConnection::sessionBus();
|
||||
if (con.isConnected()) {
|
||||
QTRY_VERIFY(!con.interface()->isServiceRegistered(serviceName));
|
||||
}
|
||||
QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit");
|
||||
QDBusConnection::sessionBus().call(msg);
|
||||
proc.waitForFinished(200);
|
||||
proc.close();
|
||||
}
|
||||
|
||||
void tst_QDBusAbstractInterface::init()
|
||||
|
@ -112,6 +112,10 @@ public slots:
|
||||
return obj.m_complexProp;
|
||||
}
|
||||
|
||||
void quit()
|
||||
{
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
private slots:
|
||||
void handleConnection(const QDBusConnection& con)
|
||||
|
@ -297,8 +297,10 @@ void tst_QDBusInterface::initTestCase()
|
||||
|
||||
void tst_QDBusInterface::cleanupTestCase()
|
||||
{
|
||||
QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit");
|
||||
QDBusConnection::sessionBus().call(msg);
|
||||
proc.waitForFinished(200);
|
||||
proc.close();
|
||||
proc.kill();
|
||||
}
|
||||
|
||||
void tst_QDBusInterface::notConnected()
|
||||
|
@ -49,6 +49,11 @@ public slots:
|
||||
if (!QDBusConnection::sessionBus().send(msg.createReply(msg.arguments())))
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void quit()
|
||||
{
|
||||
qApp->quit();
|
||||
}
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
@ -143,9 +143,10 @@ void tst_QDBusMarshall::initTestCase()
|
||||
|
||||
void tst_QDBusMarshall::cleanupTestCase()
|
||||
{
|
||||
proc.close();
|
||||
proc.terminate();
|
||||
QDBusMessage msg = QDBusMessage::createMethodCall(serviceName, objectPath, interfaceName, "quit");
|
||||
QDBusConnection::sessionBus().call(msg);
|
||||
proc.waitForFinished(200);
|
||||
proc.close();
|
||||
}
|
||||
|
||||
int tst_QDBusMarshall::fileDescriptorForTest()
|
||||
|
Loading…
Reference in New Issue
Block a user