forked from qt-creator/qt-creator
PluginManager: Provide helpful output if unit tests cannot be run
We can show the errors directly, rather than asking the user to re-run Creator with different arguments. Change-Id: If8196ba3a496406f5539a91e678d26a9a4801b85 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -354,6 +354,15 @@ bool PluginManager::hasError()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QStringList PluginManager::allErrors()
|
||||||
|
{
|
||||||
|
return Utils::transform<QStringList>(Utils::filtered(plugins(), [](const PluginSpec *spec) {
|
||||||
|
return spec->hasError() && spec->isEffectivelyEnabled();
|
||||||
|
}), [](const PluginSpec *spec) {
|
||||||
|
return spec->name().append(": ").append(spec->errorString());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns all plugins that require \a spec to be loaded. Recurses into dependencies.
|
Returns all plugins that require \a spec to be loaded. Recurses into dependencies.
|
||||||
*/
|
*/
|
||||||
@@ -1120,8 +1129,9 @@ static TestPlan generateCustomTestPlan(IPlugin *plugin,
|
|||||||
void PluginManagerPrivate::startTests()
|
void PluginManagerPrivate::startTests()
|
||||||
{
|
{
|
||||||
if (PluginManager::hasError()) {
|
if (PluginManager::hasError()) {
|
||||||
qWarning("Errors occurred while loading plugins, skipping test run. "
|
qWarning("Errors occurred while loading plugins, skipping test run.");
|
||||||
"For details, start without \"-test\" option.");
|
for (const QString &pluginError : PluginManager::allErrors())
|
||||||
|
qWarning("%s", qPrintable(pluginError));
|
||||||
QTimer::singleShot(1, QCoreApplication::instance(), &QCoreApplication::quit);
|
QTimer::singleShot(1, QCoreApplication::instance(), &QCoreApplication::quit);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -93,6 +93,7 @@ public:
|
|||||||
static const QVector<PluginSpec *> plugins();
|
static const QVector<PluginSpec *> plugins();
|
||||||
static QHash<QString, QVector<PluginSpec *>> pluginCollections();
|
static QHash<QString, QVector<PluginSpec *>> pluginCollections();
|
||||||
static bool hasError();
|
static bool hasError();
|
||||||
|
static const QStringList allErrors();
|
||||||
static QSet<PluginSpec *> pluginsRequiringPlugin(PluginSpec *spec);
|
static QSet<PluginSpec *> pluginsRequiringPlugin(PluginSpec *spec);
|
||||||
static QSet<PluginSpec *> pluginsRequiredByPlugin(PluginSpec *spec);
|
static QSet<PluginSpec *> pluginsRequiredByPlugin(PluginSpec *spec);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user