forked from qt-creator/qt-creator
AutoTest: Add optional verbosity for Qt tests
Add options allowing verbose benchmarks and logging of signals and slots inside Qt tests. Beside this fixing a typo (recognition of results of type info) inside the plain text reader. Change-Id: Iaba7112c55bf30213584e56858d096c8f78307d0 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -67,6 +67,12 @@ QStringList QtTestConfiguration::argumentsForTestRunner() const
|
|||||||
if (!metricsOption.isEmpty())
|
if (!metricsOption.isEmpty())
|
||||||
arguments << metricsOption;
|
arguments << metricsOption;
|
||||||
|
|
||||||
|
if (qtSettings->verboseBench)
|
||||||
|
arguments << "-vb";
|
||||||
|
|
||||||
|
if (qtSettings->logSignalsSlots)
|
||||||
|
arguments << "-vs";
|
||||||
|
|
||||||
if (runMode() == DebuggableTestConfiguration::Debug) {
|
if (runMode() == DebuggableTestConfiguration::Debug) {
|
||||||
if (qtSettings->noCrashHandler)
|
if (qtSettings->noCrashHandler)
|
||||||
arguments << "-nocrashhandler";
|
arguments << "-nocrashhandler";
|
||||||
|
@@ -319,7 +319,7 @@ void QtTestOutputReader::processPlainTextOutput(const QByteArray &outputLine)
|
|||||||
static QRegExp finish("^[*]{9} Finished testing of (.*) [*]{9}$");
|
static QRegExp finish("^[*]{9} Finished testing of (.*) [*]{9}$");
|
||||||
|
|
||||||
static QRegExp result("^(PASS |FAIL! |XFAIL |XPASS |SKIP |BPASS |BFAIL |RESULT "
|
static QRegExp result("^(PASS |FAIL! |XFAIL |XPASS |SKIP |BPASS |BFAIL |RESULT "
|
||||||
"|INFO |QWARN |WARNING|QDEBUG ): (.*)$");
|
"|INFO |QWARN |WARNING|QDEBUG ): (.*)$");
|
||||||
|
|
||||||
static QRegExp benchDetails("^\\s+([\\d,.]+ .* per iteration \\(total: [\\d,.]+, iterations: \\d+\\))$");
|
static QRegExp benchDetails("^\\s+([\\d,.]+ .* per iteration \\(total: [\\d,.]+, iterations: \\d+\\))$");
|
||||||
static QRegExp locationUnix("^ Loc: \\[(.*)\\]$");
|
static QRegExp locationUnix("^ Loc: \\[(.*)\\]$");
|
||||||
|
@@ -31,6 +31,8 @@ namespace Internal {
|
|||||||
static const char metricsKey[] = "Metrics";
|
static const char metricsKey[] = "Metrics";
|
||||||
static const char noCrashhandlerKey[] = "NoCrashhandlerOnDebug";
|
static const char noCrashhandlerKey[] = "NoCrashhandlerOnDebug";
|
||||||
static const char useXMLOutputKey[] = "UseXMLOutput";
|
static const char useXMLOutputKey[] = "UseXMLOutput";
|
||||||
|
static const char verboseBenchKey[] = "VerboseBench";
|
||||||
|
static const char logSignalsSlotsKey[] = "LogSignalsSlots";
|
||||||
|
|
||||||
static MetricsType intToMetrics(int value)
|
static MetricsType intToMetrics(int value)
|
||||||
{
|
{
|
||||||
@@ -60,6 +62,8 @@ void QtTestSettings::fromFrameworkSettings(const QSettings *s)
|
|||||||
metrics = intToMetrics(s->value(metricsKey, Walltime).toInt());
|
metrics = intToMetrics(s->value(metricsKey, Walltime).toInt());
|
||||||
noCrashHandler = s->value(noCrashhandlerKey, true).toBool();
|
noCrashHandler = s->value(noCrashhandlerKey, true).toBool();
|
||||||
useXMLOutput = s->value(useXMLOutputKey, true).toBool();
|
useXMLOutput = s->value(useXMLOutputKey, true).toBool();
|
||||||
|
verboseBench = s->value(verboseBenchKey, false).toBool();
|
||||||
|
logSignalsSlots = s->value(logSignalsSlotsKey, false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtTestSettings::toFrameworkSettings(QSettings *s) const
|
void QtTestSettings::toFrameworkSettings(QSettings *s) const
|
||||||
@@ -67,6 +71,8 @@ void QtTestSettings::toFrameworkSettings(QSettings *s) const
|
|||||||
s->setValue(metricsKey, metrics);
|
s->setValue(metricsKey, metrics);
|
||||||
s->setValue(noCrashhandlerKey, noCrashHandler);
|
s->setValue(noCrashhandlerKey, noCrashHandler);
|
||||||
s->setValue(useXMLOutputKey, useXMLOutput);
|
s->setValue(useXMLOutputKey, useXMLOutput);
|
||||||
|
s->setValue(verboseBenchKey, verboseBench);
|
||||||
|
s->setValue(logSignalsSlotsKey, logSignalsSlots);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QtTestSettings::metricsTypeToOption(const MetricsType type)
|
QString QtTestSettings::metricsTypeToOption(const MetricsType type)
|
||||||
|
@@ -49,6 +49,8 @@ public:
|
|||||||
MetricsType metrics = Walltime;
|
MetricsType metrics = Walltime;
|
||||||
bool noCrashHandler = true;
|
bool noCrashHandler = true;
|
||||||
bool useXMLOutput = true;
|
bool useXMLOutput = true;
|
||||||
|
bool verboseBench = false;
|
||||||
|
bool logSignalsSlots = false;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void fromFrameworkSettings(const QSettings *s) override;
|
void fromFrameworkSettings(const QSettings *s) override;
|
||||||
|
@@ -47,6 +47,8 @@ void QtTestSettingsWidget::setSettings(const QtTestSettings &settings)
|
|||||||
{
|
{
|
||||||
m_ui.disableCrashhandlerCB->setChecked(settings.noCrashHandler);
|
m_ui.disableCrashhandlerCB->setChecked(settings.noCrashHandler);
|
||||||
m_ui.useXMLOutputCB->setChecked(settings.useXMLOutput);
|
m_ui.useXMLOutputCB->setChecked(settings.useXMLOutput);
|
||||||
|
m_ui.verboseBenchmarksCB->setChecked(settings.verboseBench);
|
||||||
|
m_ui.logSignalsAndSlotsCB->setChecked(settings.logSignalsSlots);
|
||||||
switch (settings.metrics) {
|
switch (settings.metrics) {
|
||||||
case MetricsType::Walltime:
|
case MetricsType::Walltime:
|
||||||
m_ui.walltimeRB->setChecked(true);
|
m_ui.walltimeRB->setChecked(true);
|
||||||
@@ -74,6 +76,8 @@ QtTestSettings QtTestSettingsWidget::settings() const
|
|||||||
|
|
||||||
result.noCrashHandler = m_ui.disableCrashhandlerCB->isChecked();
|
result.noCrashHandler = m_ui.disableCrashhandlerCB->isChecked();
|
||||||
result.useXMLOutput = m_ui.useXMLOutputCB->isChecked();
|
result.useXMLOutput = m_ui.useXMLOutputCB->isChecked();
|
||||||
|
result.verboseBench = m_ui.verboseBenchmarksCB->isChecked();
|
||||||
|
result.logSignalsSlots = m_ui.logSignalsAndSlotsCB->isChecked();
|
||||||
if (m_ui.walltimeRB->isChecked())
|
if (m_ui.walltimeRB->isChecked())
|
||||||
result.metrics = MetricsType::Walltime;
|
result.metrics = MetricsType::Walltime;
|
||||||
else if (m_ui.tickcounterRB->isChecked())
|
else if (m_ui.tickcounterRB->isChecked())
|
||||||
|
@@ -46,6 +46,23 @@ Warning: Plain text output is missing some information (e.g. duration)</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="verboseBenchmarksCB">
|
||||||
|
<property name="text">
|
||||||
|
<string>Verbose benchmarks</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="logSignalsAndSlotsCB">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Log every signal emission and resulting slot invocations.</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Log signals and slots</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
Reference in New Issue
Block a user