diff --git a/src/app/main.cpp b/src/app/main.cpp index 40b95a3c4be..471dd7bba81 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -354,8 +354,11 @@ int main(int argc, char **argv) // shutdown plugin manager on the exit QObject::connect(&app, SIGNAL(aboutToQuit()), &pluginManager, SLOT(shutdown())); +#ifdef WITH_TESTS // Do this after the event loop has started - // QTimer::singleShot(100, &pluginManager, SLOT(startTests())); + if(pluginManager.runningTests()) + QTimer::singleShot(100, &pluginManager, SLOT(startTests())); +#endif return app.exec(); } diff --git a/src/libs/extensionsystem/pluginmanager.cpp b/src/libs/extensionsystem/pluginmanager.cpp index c0d2f6a43bb..42c4d680289 100644 --- a/src/libs/extensionsystem/pluginmanager.cpp +++ b/src/libs/extensionsystem/pluginmanager.cpp @@ -641,6 +641,8 @@ void PluginManager::startTests() } QTest::qExec(pluginSpec->plugin(), methods); } + if(!d->testSpecs.isEmpty()) + QTimer::singleShot(1, QCoreApplication::instance(), SLOT(quit())); #endif }