Commit 422b5790 authored by Nikolai Kosjar's avatar Nikolai Kosjar

Plugin Tests: Exit code returns number of failures

...as it's done in e.g. QTEST_MAIN.

Change-Id: I7056f3204d0ed76d21f09e5c1f3dc79e83c6cd48
Reviewed-by: default avatarChristian Stenger <christian.stenger@theqtcompany.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent ad323e4c
......@@ -792,6 +792,7 @@ void PluginManagerPrivate::nextDelayedInitialize()
\internal
*/
PluginManagerPrivate::PluginManagerPrivate(PluginManager *pluginManager) :
m_failedTests(0),
delayedInitializeTimer(0),
shutdownEventLoop(0),
m_profileElapsedMS(0),
......@@ -953,11 +954,11 @@ void PluginManagerPrivate::startTests()
<< QLatin1String("arg0") // fake application name
<< QLatin1String("-maxwarnings") << QLatin1String("0"); // unlimit output
qExecArguments << testFunctionsToExecute;
QTest::qExec(pluginSpec->plugin(), qExecArguments);
m_failedTests += QTest::qExec(pluginSpec->plugin(), qExecArguments);
}
}
if (!testSpecs.isEmpty())
QTimer::singleShot(1, QCoreApplication::instance(), SLOT(quit()));
QTimer::singleShot(1, this, SLOT(exitWithNumberOfFailedTests()));
#endif
}
......@@ -1072,6 +1073,14 @@ void PluginManagerPrivate::asyncShutdownFinished()
shutdownEventLoop->exit();
}
/*!
\internal
*/
void PluginManagerPrivate::exitWithNumberOfFailedTests()
{
QCoreApplication::exit(m_failedTests);
}
/*!
\internal
*/
......
......@@ -102,6 +102,7 @@ public:
QHash<QString, PluginCollection *> pluginCategories;
QList<PluginSpec *> pluginSpecs;
QList<TestSpec> testSpecs;
int m_failedTests;
QStringList pluginPaths;
QString pluginIID;
QList<QObject *> allObjects; // ### make this a QList<QPointer<QObject> > > ?
......@@ -137,6 +138,7 @@ public:
private slots:
void nextDelayedInitialize();
void asyncShutdownFinished();
void exitWithNumberOfFailedTests();
private:
PluginCollection *defaultCollection;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment