forked from qt-creator/qt-creator
AutoTest: Separate settings
This is a preparation for providing a way to let a framework define its own settings. This patch breaks old (framework) settings as some options have been renamed and/or moved into sub groups. Change-Id: If43678bcf75f6153adba52ebdfb12cd7c043ad25 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -31,6 +31,7 @@ SOURCES += \
|
||||
gtest/gtestoutputreader.cpp \
|
||||
gtest/gtestvisitors.cpp \
|
||||
gtest/gtestframework.cpp \
|
||||
gtest/gtestsettings.cpp \
|
||||
qtest/qttesttreeitem.cpp \
|
||||
qtest/qttestvisitors.cpp \
|
||||
qtest/qttestconfiguration.cpp \
|
||||
@@ -38,6 +39,7 @@ SOURCES += \
|
||||
qtest/qttestresult.cpp \
|
||||
qtest/qttestparser.cpp \
|
||||
qtest/qttestframework.cpp \
|
||||
qtest/qttestsettings.cpp \
|
||||
quick/quicktestconfiguration.cpp \
|
||||
quick/quicktestparser.cpp \
|
||||
quick/quicktesttreeitem.cpp \
|
||||
@@ -77,6 +79,7 @@ HEADERS += \
|
||||
gtest/gtest_utils.h \
|
||||
gtest/gtestvisitors.h \
|
||||
gtest/gtestframework.h \
|
||||
gtest/gtestsettings.h \
|
||||
qtest/qttesttreeitem.h \
|
||||
qtest/qttest_utils.h \
|
||||
qtest/qttestresult.h \
|
||||
@@ -85,6 +88,7 @@ HEADERS += \
|
||||
qtest/qttestoutputreader.h \
|
||||
qtest/qttestparser.h \
|
||||
qtest/qttestframework.h \
|
||||
qtest/qttestsettings.h \
|
||||
quick/quicktestconfiguration.h \
|
||||
quick/quicktestparser.h \
|
||||
quick/quicktesttreeitem.h \
|
||||
|
||||
@@ -42,19 +42,19 @@ QStringList GTestConfiguration::argumentsForTestRunner(const TestSettings &setti
|
||||
const QStringList &testSets = testCases();
|
||||
if (testSets.size())
|
||||
arguments << QLatin1String("--gtest_filter=") + testSets.join(QLatin1Char(':'));
|
||||
if (settings.gtestRunDisabled)
|
||||
if (settings.gTestSettings.runDisabled)
|
||||
arguments << QLatin1String("--gtest_also_run_disabled_tests");
|
||||
if (settings.gtestRepeat)
|
||||
arguments << QString::fromLatin1("--gtest_repeat=%1").arg(settings.gtestIterations);
|
||||
if (settings.gtestShuffle) {
|
||||
if (settings.gTestSettings.repeat)
|
||||
arguments << QString::fromLatin1("--gtest_repeat=%1").arg(settings.gTestSettings.iterations);
|
||||
if (settings.gTestSettings.shuffle) {
|
||||
arguments << QLatin1String("--gtest_shuffle")
|
||||
<< QString::fromLatin1("--gtest_random_seed=%1").arg(settings.gtestSeed);
|
||||
<< QString::fromLatin1("--gtest_random_seed=%1").arg(settings.gTestSettings.seed);
|
||||
}
|
||||
if (settings.gtestThrowOnFailure)
|
||||
if (settings.gTestSettings.throwOnFailure)
|
||||
arguments << "--gtest_throw_on_failure";
|
||||
|
||||
if (runMode() == DebuggableTestConfiguration::Debug) {
|
||||
if (settings.gtestBreakOnFailure)
|
||||
if (settings.gTestSettings.breakOnFailure)
|
||||
arguments << "--gtest_break_on_failure";
|
||||
}
|
||||
return arguments;
|
||||
|
||||
62
src/plugins/autotest/gtest/gtestsettings.cpp
Normal file
62
src/plugins/autotest/gtest/gtestsettings.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "gtestsettings.h"
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
static const char breakOnFailureKey[] = "BreakOnFailure";
|
||||
static const char iterationsKey[] = "Iterations";
|
||||
static const char repeatKey[] = "Repeat";
|
||||
static const char runDisabledKey[] = "RunDisabled";
|
||||
static const char seedKey[] = "Seed";
|
||||
static const char shuffleKey[] = "Shuffle";
|
||||
static const char throwOnFailureKey[] = "ThrowOnFailure";
|
||||
|
||||
void GTestSettings::fromSettings(const QSettings *s)
|
||||
{
|
||||
runDisabled = s->value(QLatin1String(runDisabledKey), false).toBool();
|
||||
repeat = s->value(QLatin1String(repeatKey), false).toBool();
|
||||
shuffle = s->value(QLatin1String(shuffleKey), false).toBool();
|
||||
iterations = s->value(QLatin1String(iterationsKey), 1).toInt();
|
||||
seed = s->value(QLatin1String(seedKey), 0).toInt();
|
||||
breakOnFailure = s->value(QLatin1String(breakOnFailureKey), true).toBool();
|
||||
throwOnFailure = s->value(QLatin1String(throwOnFailureKey), false).toBool();
|
||||
}
|
||||
|
||||
void GTestSettings::toSettings(QSettings *s) const
|
||||
{
|
||||
s->setValue(QLatin1String(runDisabledKey), runDisabled);
|
||||
s->setValue(QLatin1String(repeatKey), repeat);
|
||||
s->setValue(QLatin1String(shuffleKey), shuffle);
|
||||
s->setValue(QLatin1String(iterationsKey), iterations);
|
||||
s->setValue(QLatin1String(seedKey), seed);
|
||||
s->setValue(QLatin1String(breakOnFailureKey), breakOnFailure);
|
||||
s->setValue(QLatin1String(throwOnFailureKey), throwOnFailure);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Autotest
|
||||
50
src/plugins/autotest/gtest/gtestsettings.h
Normal file
50
src/plugins/autotest/gtest/gtestsettings.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
class GTestSettings
|
||||
{
|
||||
public:
|
||||
GTestSettings() {}
|
||||
void fromSettings(const QSettings *s);
|
||||
void toSettings(QSettings *s) const;
|
||||
|
||||
int iterations = 1;
|
||||
int seed = 0;
|
||||
bool runDisabled = false;
|
||||
bool shuffle = false;
|
||||
bool repeat = false;
|
||||
bool throwOnFailure = false;
|
||||
bool breakOnFailure = true;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Autotest
|
||||
@@ -40,14 +40,15 @@ QStringList QtTestConfiguration::argumentsForTestRunner(const TestSettings &sett
|
||||
{
|
||||
QStringList arguments("-xml");
|
||||
|
||||
const QString &metricsOption = TestSettings::metricsTypeToOption(settings.metrics);
|
||||
const QString &metricsOption
|
||||
= QtTestSettings::metricsTypeToOption(settings.qtTestSettings.metrics);
|
||||
if (!metricsOption.isEmpty())
|
||||
arguments << metricsOption;
|
||||
if (testCases().count())
|
||||
arguments << testCases();
|
||||
|
||||
if (runMode() == DebuggableTestConfiguration::Debug) {
|
||||
if (settings.qtestNoCrashHandler)
|
||||
if (settings.qtTestSettings.noCrashHandler)
|
||||
arguments << "-nocrashhandler";
|
||||
}
|
||||
|
||||
|
||||
83
src/plugins/autotest/qtest/qttestsettings.cpp
Normal file
83
src/plugins/autotest/qtest/qttestsettings.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qttestsettings.h"
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
static const char metricsKey[] = "Metrics";
|
||||
static const char noCrashhandlerKey[] = "NoCrashhandlerOnDebug";
|
||||
|
||||
static MetricsType intToMetrics(int value)
|
||||
{
|
||||
switch (value) {
|
||||
case Walltime:
|
||||
return Walltime;
|
||||
case TickCounter:
|
||||
return TickCounter;
|
||||
case EventCounter:
|
||||
return EventCounter;
|
||||
case CallGrind:
|
||||
return CallGrind;
|
||||
case Perf:
|
||||
return Perf;
|
||||
default:
|
||||
return Walltime;
|
||||
}
|
||||
}
|
||||
|
||||
void QtTestSettings::fromSettings(const QSettings *s)
|
||||
{
|
||||
metrics = intToMetrics(s->value(QLatin1String(metricsKey), Walltime).toInt());
|
||||
noCrashHandler = s->value(QLatin1String(noCrashhandlerKey), true).toBool();
|
||||
}
|
||||
|
||||
void QtTestSettings::toSettings(QSettings *s) const
|
||||
{
|
||||
s->setValue(QLatin1String(metricsKey), metrics);
|
||||
s->setValue(QLatin1String(noCrashhandlerKey), noCrashHandler);
|
||||
}
|
||||
|
||||
QString QtTestSettings::metricsTypeToOption(const MetricsType type)
|
||||
{
|
||||
switch (type) {
|
||||
case MetricsType::Walltime:
|
||||
return QString();
|
||||
case MetricsType::TickCounter:
|
||||
return QLatin1String("-tickcounter");
|
||||
case MetricsType::EventCounter:
|
||||
return QLatin1String("-eventcounter");
|
||||
case MetricsType::CallGrind:
|
||||
return QLatin1String("-callgrind");
|
||||
case MetricsType::Perf:
|
||||
return QLatin1String("-perf");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Autotest
|
||||
55
src/plugins/autotest/qtest/qttestsettings.h
Normal file
55
src/plugins/autotest/qtest/qttestsettings.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at https://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3 as published by the Free Software
|
||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
** included in the packaging of this file. Please review the following
|
||||
** information to ensure the GNU General Public License requirements will
|
||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QSettings>
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
enum MetricsType
|
||||
{
|
||||
Walltime,
|
||||
TickCounter,
|
||||
EventCounter,
|
||||
CallGrind,
|
||||
Perf
|
||||
};
|
||||
|
||||
class QtTestSettings
|
||||
{
|
||||
public:
|
||||
QtTestSettings() {}
|
||||
void fromSettings(const QSettings *s);
|
||||
void toSettings(QSettings *s) const;
|
||||
static QString metricsTypeToOption(const MetricsType type);
|
||||
|
||||
MetricsType metrics = Walltime;
|
||||
bool noCrashHandler = true;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Autotest
|
||||
@@ -40,7 +40,8 @@ QStringList QuickTestConfiguration::argumentsForTestRunner(const TestSettings &s
|
||||
{
|
||||
QStringList arguments({"-xml"});
|
||||
|
||||
const QString &metricsOption = TestSettings::metricsTypeToOption(settings.metrics);
|
||||
const QString &metricsOption
|
||||
= QtTestSettings::metricsTypeToOption(settings.qtTestSettings.metrics);
|
||||
if (!metricsOption.isEmpty())
|
||||
arguments << metricsOption;
|
||||
if (testCases().count())
|
||||
|
||||
@@ -35,26 +35,16 @@ namespace Internal {
|
||||
|
||||
static const char group[] = "Autotest";
|
||||
static const char timeoutKey[] = "Timeout";
|
||||
static const char metricsKey[] = "Metrics";
|
||||
static const char omitInternalKey[] = "OmitInternal";
|
||||
static const char omitRunConfigWarnKey[] = "OmitRCWarnings";
|
||||
static const char limitResultOutputKey[] = "LimitResultOutput";
|
||||
static const char autoScrollKey[] = "AutoScrollResults";
|
||||
static const char alwaysParseKey[] = "AlwaysParse";
|
||||
static const char qtestNoCrashhandlerKey[] = "NoCrashhandlerOnDebug";
|
||||
static const char gtestRunDisabledKey[] = "RunDisabledGTests";
|
||||
static const char gtestRepeatKey[] = "RepeatGTests";
|
||||
static const char gtestShuffleKey[] = "ShuffleGTests";
|
||||
static const char gtestIterationsKey[] = "IterationsGTests";
|
||||
static const char gtestSeedKey[] = "SeedGTests";
|
||||
static const char gtestThrowOnFailureKey[] = "ThrowOnFailure";
|
||||
static const char gtestBreakOnFailureKey[] = "BreakOnFailure";
|
||||
|
||||
static const int defaultTimeout = 60000;
|
||||
|
||||
TestSettings::TestSettings()
|
||||
: timeout(defaultTimeout), metrics(Walltime), omitInternalMssg(true), omitRunConfigWarn(false),
|
||||
limitResultOutput(true), autoScroll(true), alwaysParse(true)
|
||||
: timeout(defaultTimeout)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -62,88 +52,51 @@ void TestSettings::toSettings(QSettings *s) const
|
||||
{
|
||||
s->beginGroup(QLatin1String(group));
|
||||
s->setValue(QLatin1String(timeoutKey), timeout);
|
||||
s->setValue(QLatin1String(metricsKey), metrics);
|
||||
s->setValue(QLatin1String(omitInternalKey), omitInternalMssg);
|
||||
s->setValue(QLatin1String(omitRunConfigWarnKey), omitRunConfigWarn);
|
||||
s->setValue(QLatin1String(limitResultOutputKey), limitResultOutput);
|
||||
s->setValue(QLatin1String(autoScrollKey), autoScroll);
|
||||
s->setValue(QLatin1String(alwaysParseKey), alwaysParse);
|
||||
s->setValue(QLatin1String(qtestNoCrashhandlerKey), qtestNoCrashHandler);
|
||||
s->setValue(QLatin1String(gtestRunDisabledKey), gtestRunDisabled);
|
||||
s->setValue(QLatin1String(gtestRepeatKey), gtestRepeat);
|
||||
s->setValue(QLatin1String(gtestShuffleKey), gtestShuffle);
|
||||
s->setValue(QLatin1String(gtestIterationsKey), gtestIterations);
|
||||
s->setValue(QLatin1String(gtestSeedKey), gtestSeed);
|
||||
s->setValue(QLatin1String(gtestBreakOnFailureKey), gtestBreakOnFailure);
|
||||
s->setValue(QLatin1String(gtestThrowOnFailureKey), gtestThrowOnFailure);
|
||||
// store frameworks and their current active state
|
||||
for (const Core::Id &id : frameworks.keys())
|
||||
s->setValue(QLatin1String(id.name()), frameworks.value(id));
|
||||
|
||||
s->beginGroup("QtTest");
|
||||
qtTestSettings.toSettings(s);
|
||||
s->endGroup();
|
||||
s->beginGroup("GTest");
|
||||
gTestSettings.toSettings(s);
|
||||
s->endGroup();
|
||||
|
||||
s->endGroup();
|
||||
}
|
||||
|
||||
static MetricsType intToMetrics(int value)
|
||||
void TestSettings::fromSettings(QSettings *s)
|
||||
{
|
||||
switch (value) {
|
||||
case Walltime:
|
||||
return Walltime;
|
||||
case TickCounter:
|
||||
return TickCounter;
|
||||
case EventCounter:
|
||||
return EventCounter;
|
||||
case CallGrind:
|
||||
return CallGrind;
|
||||
case Perf:
|
||||
return Perf;
|
||||
default:
|
||||
return Walltime;
|
||||
}
|
||||
}
|
||||
|
||||
void TestSettings::fromSettings(const QSettings *s)
|
||||
{
|
||||
const QString root = QLatin1String(group) + QLatin1Char('/');
|
||||
timeout = s->value(root + QLatin1String(timeoutKey), defaultTimeout).toInt();
|
||||
metrics = intToMetrics(s->value(root + QLatin1String(metricsKey), Walltime).toInt());
|
||||
omitInternalMssg = s->value(root + QLatin1String(omitInternalKey), true).toBool();
|
||||
omitRunConfigWarn = s->value(root + QLatin1String(omitRunConfigWarnKey), false).toBool();
|
||||
limitResultOutput = s->value(root + QLatin1String(limitResultOutputKey), true).toBool();
|
||||
autoScroll = s->value(root + QLatin1String(autoScrollKey), true).toBool();
|
||||
alwaysParse = s->value(root + QLatin1String(alwaysParseKey), true).toBool();
|
||||
qtestNoCrashHandler = s->value(root + QLatin1String(qtestNoCrashhandlerKey), true).toBool();
|
||||
gtestRunDisabled = s->value(root + QLatin1String(gtestRunDisabledKey), false).toBool();
|
||||
gtestRepeat = s->value(root + QLatin1String(gtestRepeatKey), false).toBool();
|
||||
gtestShuffle = s->value(root + QLatin1String(gtestShuffleKey), false).toBool();
|
||||
gtestIterations = s->value(root + QLatin1String(gtestIterationsKey), 1).toInt();
|
||||
gtestSeed = s->value(root + QLatin1String(gtestSeedKey), 0).toInt();
|
||||
gtestBreakOnFailure = s->value(root + QLatin1String(gtestBreakOnFailureKey), true).toBool();
|
||||
gtestThrowOnFailure = s->value(root + QLatin1String(gtestThrowOnFailureKey), false).toBool();
|
||||
s->beginGroup(group);
|
||||
timeout = s->value(QLatin1String(timeoutKey), defaultTimeout).toInt();
|
||||
omitInternalMssg = s->value(QLatin1String(omitInternalKey), true).toBool();
|
||||
omitRunConfigWarn = s->value(QLatin1String(omitRunConfigWarnKey), false).toBool();
|
||||
limitResultOutput = s->value(QLatin1String(limitResultOutputKey), true).toBool();
|
||||
autoScroll = s->value(QLatin1String(autoScrollKey), true).toBool();
|
||||
alwaysParse = s->value(QLatin1String(alwaysParseKey), true).toBool();
|
||||
// try to get settings for registered frameworks
|
||||
TestFrameworkManager *frameworkManager = TestFrameworkManager::instance();
|
||||
const QList<Core::Id> ®istered = frameworkManager->registeredFrameworkIds();
|
||||
frameworks.clear();
|
||||
for (const Core::Id &id : registered) {
|
||||
frameworks.insert(id, s->value(root + QLatin1String(id.name()),
|
||||
frameworks.insert(id, s->value(QLatin1String(id.name()),
|
||||
frameworkManager->isActive(id)).toBool());
|
||||
}
|
||||
}
|
||||
|
||||
QString TestSettings::metricsTypeToOption(const MetricsType type)
|
||||
{
|
||||
switch (type) {
|
||||
case MetricsType::Walltime:
|
||||
return QString();
|
||||
case MetricsType::TickCounter:
|
||||
return QLatin1String("-tickcounter");
|
||||
case MetricsType::EventCounter:
|
||||
return QLatin1String("-eventcounter");
|
||||
case MetricsType::CallGrind:
|
||||
return QLatin1String("-callgrind");
|
||||
case MetricsType::Perf:
|
||||
return QLatin1String("-perf");
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
s->beginGroup("QtTest");
|
||||
qtTestSettings.fromSettings(s);
|
||||
s->endGroup();
|
||||
s->beginGroup("GTest");
|
||||
gTestSettings.fromSettings(s);
|
||||
s->endGroup();
|
||||
|
||||
s->endGroup();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gtest/gtestsettings.h"
|
||||
#include "qtest/qttestsettings.h"
|
||||
|
||||
#include <QHash>
|
||||
|
||||
namespace Core { class Id; }
|
||||
@@ -36,37 +39,23 @@ QT_END_NAMESPACE
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
enum MetricsType {
|
||||
Walltime,
|
||||
TickCounter,
|
||||
EventCounter,
|
||||
CallGrind,
|
||||
Perf
|
||||
};
|
||||
|
||||
struct TestSettings
|
||||
{
|
||||
TestSettings();
|
||||
void toSettings(QSettings *s) const;
|
||||
void fromSettings(const QSettings *s);
|
||||
void fromSettings(QSettings *s);
|
||||
static QString metricsTypeToOption(const MetricsType type);
|
||||
|
||||
int timeout;
|
||||
int gtestIterations;
|
||||
int gtestSeed;
|
||||
MetricsType metrics;
|
||||
bool omitInternalMssg;
|
||||
bool omitRunConfigWarn;
|
||||
bool limitResultOutput;
|
||||
bool autoScroll;
|
||||
bool alwaysParse;
|
||||
bool qtestNoCrashHandler;
|
||||
bool gtestRunDisabled;
|
||||
bool gtestShuffle;
|
||||
bool gtestRepeat;
|
||||
bool gtestThrowOnFailure;
|
||||
bool gtestBreakOnFailure;
|
||||
bool omitInternalMssg = true;
|
||||
bool omitRunConfigWarn = false;
|
||||
bool limitResultOutput = true;
|
||||
bool autoScroll = true;
|
||||
bool alwaysParse = true;
|
||||
QHash<Core::Id, bool> frameworks;
|
||||
|
||||
QtTestSettings qtTestSettings;
|
||||
GTestSettings gTestSettings;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -64,16 +64,10 @@ void TestSettingsWidget::setSettings(const TestSettings &settings)
|
||||
m_ui.limitResultOutputCB->setChecked(settings.limitResultOutput);
|
||||
m_ui.autoScrollCB->setChecked(settings.autoScroll);
|
||||
m_ui.alwaysParseCB->setChecked(settings.alwaysParse);
|
||||
m_ui.disableCrashhandlerCB->setChecked(settings.qtestNoCrashHandler);
|
||||
m_ui.runDisabledGTestsCB->setChecked(settings.gtestRunDisabled);
|
||||
m_ui.repeatGTestsCB->setChecked(settings.gtestRepeat);
|
||||
m_ui.shuffleGTestsCB->setChecked(settings.gtestShuffle);
|
||||
m_ui.repetitionSpin->setValue(settings.gtestIterations);
|
||||
m_ui.seedSpin->setValue(settings.gtestSeed);
|
||||
m_ui.breakOnFailureCB->setChecked(settings.gtestBreakOnFailure);
|
||||
m_ui.throwOnFailureCB->setChecked(settings.gtestThrowOnFailure);
|
||||
populateFrameworksListWidget(settings.frameworks);
|
||||
|
||||
switch (settings.metrics) {
|
||||
m_ui.disableCrashhandlerCB->setChecked(settings.qtTestSettings.noCrashHandler);
|
||||
switch (settings.qtTestSettings.metrics) {
|
||||
case MetricsType::Walltime:
|
||||
m_ui.walltimeRB->setChecked(true);
|
||||
break;
|
||||
@@ -92,7 +86,14 @@ void TestSettingsWidget::setSettings(const TestSettings &settings)
|
||||
default:
|
||||
m_ui.walltimeRB->setChecked(true);
|
||||
}
|
||||
populateFrameworksListWidget(settings.frameworks);
|
||||
|
||||
m_ui.runDisabledGTestsCB->setChecked(settings.gTestSettings.runDisabled);
|
||||
m_ui.repeatGTestsCB->setChecked(settings.gTestSettings.repeat);
|
||||
m_ui.shuffleGTestsCB->setChecked(settings.gTestSettings.shuffle);
|
||||
m_ui.repetitionSpin->setValue(settings.gTestSettings.iterations);
|
||||
m_ui.seedSpin->setValue(settings.gTestSettings.seed);
|
||||
m_ui.breakOnFailureCB->setChecked(settings.gTestSettings.breakOnFailure);
|
||||
m_ui.throwOnFailureCB->setChecked(settings.gTestSettings.throwOnFailure);
|
||||
}
|
||||
|
||||
TestSettings TestSettingsWidget::settings() const
|
||||
@@ -104,28 +105,30 @@ TestSettings TestSettingsWidget::settings() const
|
||||
result.limitResultOutput = m_ui.limitResultOutputCB->isChecked();
|
||||
result.autoScroll = m_ui.autoScrollCB->isChecked();
|
||||
result.alwaysParse = m_ui.alwaysParseCB->isChecked();
|
||||
result.qtestNoCrashHandler = m_ui.disableCrashhandlerCB->isChecked();
|
||||
result.gtestRunDisabled = m_ui.runDisabledGTestsCB->isChecked();
|
||||
result.gtestRepeat = m_ui.repeatGTestsCB->isChecked();
|
||||
result.gtestShuffle = m_ui.shuffleGTestsCB->isChecked();
|
||||
result.gtestIterations = m_ui.repetitionSpin->value();
|
||||
result.gtestSeed = m_ui.seedSpin->value();
|
||||
result.gtestBreakOnFailure = m_ui.breakOnFailureCB->isChecked();
|
||||
result.gtestThrowOnFailure = m_ui.throwOnFailureCB->isChecked();
|
||||
|
||||
if (m_ui.walltimeRB->isChecked())
|
||||
result.metrics = MetricsType::Walltime;
|
||||
else if (m_ui.tickcounterRB->isChecked())
|
||||
result.metrics = MetricsType::TickCounter;
|
||||
else if (m_ui.eventCounterRB->isChecked())
|
||||
result.metrics = MetricsType::EventCounter;
|
||||
else if (m_ui.callgrindRB->isChecked())
|
||||
result.metrics = MetricsType::CallGrind;
|
||||
else if (m_ui.perfRB->isChecked())
|
||||
result.metrics = MetricsType::Perf;
|
||||
|
||||
result.frameworks = frameworks();
|
||||
|
||||
// QtTestSettings
|
||||
result.qtTestSettings.noCrashHandler = m_ui.disableCrashhandlerCB->isChecked();
|
||||
if (m_ui.walltimeRB->isChecked())
|
||||
result.qtTestSettings.metrics = MetricsType::Walltime;
|
||||
else if (m_ui.tickcounterRB->isChecked())
|
||||
result.qtTestSettings.metrics = MetricsType::TickCounter;
|
||||
else if (m_ui.eventCounterRB->isChecked())
|
||||
result.qtTestSettings.metrics = MetricsType::EventCounter;
|
||||
else if (m_ui.callgrindRB->isChecked())
|
||||
result.qtTestSettings.metrics = MetricsType::CallGrind;
|
||||
else if (m_ui.perfRB->isChecked())
|
||||
result.qtTestSettings.metrics = MetricsType::Perf;
|
||||
|
||||
// GTestSettings
|
||||
result.gTestSettings.runDisabled = m_ui.runDisabledGTestsCB->isChecked();
|
||||
result.gTestSettings.repeat = m_ui.repeatGTestsCB->isChecked();
|
||||
result.gTestSettings.shuffle = m_ui.shuffleGTestsCB->isChecked();
|
||||
result.gTestSettings.iterations = m_ui.repetitionSpin->value();
|
||||
result.gTestSettings.seed = m_ui.seedSpin->value();
|
||||
result.gTestSettings.breakOnFailure = m_ui.breakOnFailureCB->isChecked();
|
||||
result.gTestSettings.throwOnFailure = m_ui.throwOnFailureCB->isChecked();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user