forked from qt-creator/qt-creator
AutoTest: Allow handling of maximum warnings for QtTest
If the maximum number of warnings is reached the test will be canceled automatically. Allow to handle this from the user side in case it might be needed. Fixes: QTCREATORBUG-26637 Change-Id: I239eca280cdc2ce46f6d64cd53b8f3ad0205f7f2 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -470,6 +470,11 @@
|
||||
To record information about signals and slots in the test log, select the
|
||||
\uicontrol {Log signals and slots} check box.
|
||||
|
||||
To explicitly limit the maximum number of warnings in the test log, select
|
||||
the \uicontrol {Limit warnings} check box and specify the intended number
|
||||
inside the spin box next to it. Set the number to 0 if you want no limit
|
||||
at all. The default number is 2000.
|
||||
|
||||
\section2 Specifying Settings for Running Google Tests
|
||||
|
||||
To specify settings for running Google tests, select \uicontrol Tools >
|
||||
|
@@ -98,9 +98,9 @@ QStringList filterInterfering(const QStringList &provided, QStringList *omitted,
|
||||
"-functions", "-datatags", "-nocrashhandler", "-callgrind", "-perf", "-perfcounterlist",
|
||||
"-tickcounter", "-eventcounter", "-help"
|
||||
};
|
||||
static const QSet<QString> knownInterferingOptionWithParameter = { "-o" };
|
||||
static const QSet<QString> knownInterferingOptionWithParameter = { "-o", "-maxwarnings" };
|
||||
static const QSet<QString> knownAllowedOptionsWithParameter {
|
||||
"-eventdelay", "-keydelay", "-mousedelay", "-maxwarnings", "-perfcounter",
|
||||
"-eventdelay", "-keydelay", "-mousedelay", "-perfcounter",
|
||||
"-minimumvalue", "-minimumtotal", "-iterations", "-median"
|
||||
};
|
||||
|
||||
|
@@ -76,6 +76,9 @@ QStringList QtTestConfiguration::argumentsForTestRunner(QStringList *omitted) co
|
||||
if (isDebugRunMode() && qtSettings->noCrashHandler.value())
|
||||
arguments << "-nocrashhandler";
|
||||
|
||||
if (qtSettings->limitWarnings.value() && qtSettings->maxWarnings.value() != 2000)
|
||||
arguments << "-maxwarnings" << QString::number(qtSettings->maxWarnings.value());
|
||||
|
||||
return arguments;
|
||||
}
|
||||
|
||||
|
@@ -79,6 +79,19 @@ QtTestSettings::QtTestSettings()
|
||||
logSignalsSlots.setSettingsKey("LogSignalsSlots");
|
||||
logSignalsSlots.setLabelText(tr("Log signals and slots"));
|
||||
logSignalsSlots.setToolTip(tr("Log every signal emission and resulting slot invocations."));
|
||||
|
||||
registerAspect(&limitWarnings);
|
||||
limitWarnings.setSettingsKey("LimitWarnings");
|
||||
limitWarnings.setLabelText(tr("Limit warnings"));
|
||||
limitWarnings.setToolTip(tr("Set the maximum number of warnings. 0 means that the number "
|
||||
"is not limited."));
|
||||
|
||||
registerAspect(&maxWarnings);
|
||||
maxWarnings.setSettingsKey("MaxWarnings");
|
||||
maxWarnings.setRange(0, 10000);
|
||||
maxWarnings.setDefaultValue(2000);
|
||||
maxWarnings.setSpecialValueText(tr("Unlimited"));
|
||||
maxWarnings.setEnabler(&limitWarnings);
|
||||
}
|
||||
|
||||
QString QtTestSettings::metricsTypeToOption(const MetricsType type)
|
||||
@@ -115,6 +128,9 @@ QtTestSettingsPage::QtTestSettingsPage(QtTestSettings *settings, Id settingsId)
|
||||
s.useXMLOutput,
|
||||
s.verboseBench,
|
||||
s.logSignalsSlots,
|
||||
Row {
|
||||
s.limitWarnings, s.maxWarnings
|
||||
},
|
||||
Group {
|
||||
Title(QtTestSettings::tr("Benchmark Metrics")),
|
||||
s.metrics
|
||||
|
@@ -54,6 +54,8 @@ public:
|
||||
Utils::BoolAspect useXMLOutput;
|
||||
Utils::BoolAspect verboseBench;
|
||||
Utils::BoolAspect logSignalsSlots;
|
||||
Utils::BoolAspect limitWarnings;
|
||||
Utils::IntegerAspect maxWarnings;
|
||||
};
|
||||
|
||||
class QtTestSettingsPage final : public Core::IOptionsPage
|
||||
|
@@ -79,6 +79,10 @@ QStringList QuickTestConfiguration::argumentsForTestRunner(QStringList *omitted)
|
||||
if (qtSettings->noCrashHandler.value())
|
||||
arguments << "-nocrashhandler";
|
||||
}
|
||||
|
||||
if (qtSettings->limitWarnings.value() && qtSettings->maxWarnings.value() != 2000)
|
||||
arguments << "-maxwarnings" << QString::number(qtSettings->maxWarnings.value());
|
||||
|
||||
return arguments;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user