forked from qt-creator/qt-creator
Tests: Emit coreAboutToClose() before exiting
Now address sanitizer will not show false positives. Change-Id: Ieeb4dc31697920ed1ca542f5647f4cb0b23a29ab Task-number: QTCREATORBUG-14713 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -847,7 +847,6 @@ void PluginManagerPrivate::nextDelayedInitialize()
|
|||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
PluginManagerPrivate::PluginManagerPrivate(PluginManager *pluginManager) :
|
PluginManagerPrivate::PluginManagerPrivate(PluginManager *pluginManager) :
|
||||||
m_failedTests(0),
|
|
||||||
delayedInitializeTimer(0),
|
delayedInitializeTimer(0),
|
||||||
shutdownEventLoop(0),
|
shutdownEventLoop(0),
|
||||||
m_profileElapsedMS(0),
|
m_profileElapsedMS(0),
|
||||||
@@ -1127,6 +1126,7 @@ void PluginManagerPrivate::startTests()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int failedTests = 0;
|
||||||
foreach (const PluginManagerPrivate::TestSpec &testSpec, testSpecs) {
|
foreach (const PluginManagerPrivate::TestSpec &testSpec, testSpecs) {
|
||||||
IPlugin *plugin = testSpec.pluginSpec->plugin();
|
IPlugin *plugin = testSpec.pluginSpec->plugin();
|
||||||
if (!plugin)
|
if (!plugin)
|
||||||
@@ -1144,10 +1144,10 @@ void PluginManagerPrivate::startTests()
|
|||||||
? generateCompleteTestPlan(plugin, testObjects)
|
? generateCompleteTestPlan(plugin, testObjects)
|
||||||
: generateCustomTestPlan(plugin, testObjects, testSpec.testFunctionsOrObjects);
|
: generateCustomTestPlan(plugin, testObjects, testSpec.testFunctionsOrObjects);
|
||||||
|
|
||||||
m_failedTests += executeTestPlan(testPlan);
|
failedTests += executeTestPlan(testPlan);
|
||||||
}
|
}
|
||||||
if (!testSpecs.isEmpty())
|
|
||||||
QTimer::singleShot(1, this, SLOT(exitWithNumberOfFailedTests()));
|
QTimer::singleShot(0, this, [failedTests]() { emit m_instance->testsFinished(failedTests); });
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1270,14 +1270,6 @@ void PluginManagerPrivate::asyncShutdownFinished()
|
|||||||
shutdownEventLoop->exit();
|
shutdownEventLoop->exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\internal
|
|
||||||
*/
|
|
||||||
void PluginManagerPrivate::exitWithNumberOfFailedTests()
|
|
||||||
{
|
|
||||||
QCoreApplication::exit(m_failedTests);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ signals:
|
|||||||
|
|
||||||
void pluginsChanged();
|
void pluginsChanged();
|
||||||
void initializationDone();
|
void initializationDone();
|
||||||
|
void testsFinished(int failedTests);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void remoteArguments(const QString &serializedArguments, QObject *socket);
|
void remoteArguments(const QString &serializedArguments, QObject *socket);
|
||||||
|
|||||||
@@ -102,7 +102,6 @@ public:
|
|||||||
QHash<QString, PluginCollection *> pluginCategories;
|
QHash<QString, PluginCollection *> pluginCategories;
|
||||||
QList<PluginSpec *> pluginSpecs;
|
QList<PluginSpec *> pluginSpecs;
|
||||||
QList<TestSpec> testSpecs;
|
QList<TestSpec> testSpecs;
|
||||||
int m_failedTests;
|
|
||||||
QStringList pluginPaths;
|
QStringList pluginPaths;
|
||||||
QString pluginIID;
|
QString pluginIID;
|
||||||
QList<QObject *> allObjects; // ### make this a QList<QPointer<QObject> > > ?
|
QList<QObject *> allObjects; // ### make this a QList<QPointer<QObject> > > ?
|
||||||
@@ -138,7 +137,6 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void nextDelayedInitialize();
|
void nextDelayedInitialize();
|
||||||
void asyncShutdownFinished();
|
void asyncShutdownFinished();
|
||||||
void exitWithNumberOfFailedTests();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PluginCollection *defaultCollection;
|
PluginCollection *defaultCollection;
|
||||||
|
|||||||
@@ -323,6 +323,10 @@ ICore::ICore(MainWindow *mainwindow)
|
|||||||
// Save settings once after all plugins are initialized:
|
// Save settings once after all plugins are initialized:
|
||||||
connect(PluginManager::instance(), SIGNAL(initializationDone()),
|
connect(PluginManager::instance(), SIGNAL(initializationDone()),
|
||||||
this, SLOT(saveSettings()));
|
this, SLOT(saveSettings()));
|
||||||
|
connect(PluginManager::instance(), &PluginManager::testsFinished, [this] (int failedTests) {
|
||||||
|
emit coreAboutToClose();
|
||||||
|
QCoreApplication::exit(failedTests);
|
||||||
|
});
|
||||||
connect(m_mainwindow, SIGNAL(newItemDialogRunningChanged()),
|
connect(m_mainwindow, SIGNAL(newItemDialogRunningChanged()),
|
||||||
this, SIGNAL(newItemDialogRunningChanged()));
|
this, SIGNAL(newItemDialogRunningChanged()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user