2016-09-13 09:30:59 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** 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"
|
|
|
|
|
|
2021-03-26 18:16:08 +01:00
|
|
|
#include "../autotestconstants.h"
|
2022-07-13 18:31:56 +02:00
|
|
|
#include "../autotesttr.h"
|
2021-03-26 18:16:08 +01:00
|
|
|
#include "qttestconstants.h"
|
|
|
|
|
|
2022-05-24 00:40:44 +02:00
|
|
|
#include <utils/hostosinfo.h>
|
2021-03-26 18:16:08 +01:00
|
|
|
#include <utils/layoutbuilder.h>
|
|
|
|
|
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
|
2016-09-13 09:30:59 +02:00
|
|
|
namespace Autotest {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2021-03-24 12:40:03 +01:00
|
|
|
QtTestSettings::QtTestSettings()
|
2016-09-13 13:38:19 +02:00
|
|
|
{
|
2021-03-24 12:40:03 +01:00
|
|
|
setSettingsGroups("Autotest", "QtTest");
|
|
|
|
|
setAutoApply(false);
|
2016-09-13 13:38:19 +02:00
|
|
|
|
2021-03-24 12:40:03 +01:00
|
|
|
registerAspect(&metrics);
|
|
|
|
|
metrics.setSettingsKey("Metrics");
|
|
|
|
|
metrics.setDefaultValue(Walltime);
|
2022-07-13 18:31:56 +02:00
|
|
|
metrics.addOption(Tr::tr("Walltime"), Tr::tr("Uses walltime metrics for executing benchmarks (default)."));
|
|
|
|
|
metrics.addOption(Tr::tr("Tick counter"), Tr::tr("Uses tick counter when executing benchmarks."));
|
|
|
|
|
metrics.addOption(Tr::tr("Event counter"), Tr::tr("Uses event counter when executing benchmarks."));
|
2021-03-26 18:16:08 +01:00
|
|
|
metrics.addOption({
|
2022-07-13 18:31:56 +02:00
|
|
|
Tr::tr("Callgrind"),
|
|
|
|
|
Tr::tr("Uses Valgrind Callgrind when executing benchmarks (it must be installed)."),
|
2021-03-26 18:16:08 +01:00
|
|
|
HostOsInfo::isAnyUnixHost() // valgrind available on UNIX
|
|
|
|
|
});
|
|
|
|
|
metrics.addOption({
|
2022-07-13 18:31:56 +02:00
|
|
|
Tr::tr("Perf"),
|
|
|
|
|
Tr::tr("Uses Perf when executing benchmarks (it must be installed)."),
|
2021-03-26 18:16:08 +01:00
|
|
|
HostOsInfo::isLinuxHost() // according to docs perf Linux only
|
|
|
|
|
});
|
2016-09-13 09:30:59 +02:00
|
|
|
|
2021-03-24 12:40:03 +01:00
|
|
|
registerAspect(&noCrashHandler);
|
|
|
|
|
noCrashHandler.setSettingsKey("NoCrashhandlerOnDebug");
|
|
|
|
|
noCrashHandler.setDefaultValue(true);
|
2022-07-13 18:31:56 +02:00
|
|
|
noCrashHandler.setLabelText(Tr::tr("Disable crash handler while debugging"));
|
|
|
|
|
noCrashHandler.setToolTip(Tr::tr("Enables interrupting tests on assertions."));
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&useXMLOutput);
|
|
|
|
|
useXMLOutput.setSettingsKey("UseXMLOutput");
|
|
|
|
|
useXMLOutput.setDefaultValue(true);
|
2022-07-13 18:31:56 +02:00
|
|
|
useXMLOutput.setLabelText(Tr::tr("Use XML output"));
|
|
|
|
|
useXMLOutput.setToolTip(Tr::tr("XML output is recommended, because it avoids parsing issues, "
|
2021-03-26 18:16:08 +01:00
|
|
|
"while plain text is more human readable.\n\n"
|
|
|
|
|
"Warning: Plain text misses some information, such as duration."));
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&verboseBench);
|
|
|
|
|
verboseBench.setSettingsKey("VerboseBench");
|
2022-07-13 18:31:56 +02:00
|
|
|
verboseBench.setLabelText(Tr::tr("Verbose benchmarks"));
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
registerAspect(&logSignalsSlots);
|
|
|
|
|
logSignalsSlots.setSettingsKey("LogSignalsSlots");
|
2022-07-13 18:31:56 +02:00
|
|
|
logSignalsSlots.setLabelText(Tr::tr("Log signals and slots"));
|
|
|
|
|
logSignalsSlots.setToolTip(Tr::tr("Log every signal emission and resulting slot invocations."));
|
2020-11-27 09:47:57 +01:00
|
|
|
|
|
|
|
|
registerAspect(&limitWarnings);
|
|
|
|
|
limitWarnings.setSettingsKey("LimitWarnings");
|
2022-07-13 18:31:56 +02:00
|
|
|
limitWarnings.setLabelText(Tr::tr("Limit warnings"));
|
|
|
|
|
limitWarnings.setToolTip(Tr::tr("Set the maximum number of warnings. 0 means that the number "
|
2020-11-27 09:47:57 +01:00
|
|
|
"is not limited."));
|
|
|
|
|
|
|
|
|
|
registerAspect(&maxWarnings);
|
|
|
|
|
maxWarnings.setSettingsKey("MaxWarnings");
|
|
|
|
|
maxWarnings.setRange(0, 10000);
|
|
|
|
|
maxWarnings.setDefaultValue(2000);
|
2022-07-13 18:31:56 +02:00
|
|
|
maxWarnings.setSpecialValueText(Tr::tr("Unlimited"));
|
2020-11-27 09:47:57 +01:00
|
|
|
maxWarnings.setEnabler(&limitWarnings);
|
2016-09-13 09:30:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QtTestSettings::metricsTypeToOption(const MetricsType type)
|
|
|
|
|
{
|
|
|
|
|
switch (type) {
|
|
|
|
|
case MetricsType::Walltime:
|
|
|
|
|
return QString();
|
|
|
|
|
case MetricsType::TickCounter:
|
2017-02-13 10:05:06 +01:00
|
|
|
return QString("-tickcounter");
|
2016-09-13 09:30:59 +02:00
|
|
|
case MetricsType::EventCounter:
|
2017-02-13 10:05:06 +01:00
|
|
|
return QString("-eventcounter");
|
2016-09-13 09:30:59 +02:00
|
|
|
case MetricsType::CallGrind:
|
2017-02-13 10:05:06 +01:00
|
|
|
return QString("-callgrind");
|
2016-09-13 09:30:59 +02:00
|
|
|
case MetricsType::Perf:
|
2017-02-13 10:05:06 +01:00
|
|
|
return QString("-perf");
|
2016-09-13 09:30:59 +02:00
|
|
|
}
|
2018-07-11 15:44:51 +02:00
|
|
|
return QString();
|
2016-09-13 09:30:59 +02:00
|
|
|
}
|
|
|
|
|
|
2021-03-26 18:16:08 +01:00
|
|
|
QtTestSettingsPage::QtTestSettingsPage(QtTestSettings *settings, Id settingsId)
|
|
|
|
|
{
|
|
|
|
|
setId(settingsId);
|
|
|
|
|
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
|
2022-07-13 18:31:56 +02:00
|
|
|
setDisplayName(Tr::tr(QtTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
|
2021-03-26 18:16:08 +01:00
|
|
|
setSettings(settings);
|
|
|
|
|
|
|
|
|
|
setLayouter([settings](QWidget *widget) {
|
|
|
|
|
QtTestSettings &s = *settings;
|
|
|
|
|
using namespace Layouting;
|
|
|
|
|
|
|
|
|
|
Column col {
|
|
|
|
|
s.noCrashHandler,
|
|
|
|
|
s.useXMLOutput,
|
|
|
|
|
s.verboseBench,
|
|
|
|
|
s.logSignalsSlots,
|
2020-11-27 09:47:57 +01:00
|
|
|
Row {
|
|
|
|
|
s.limitWarnings, s.maxWarnings
|
|
|
|
|
},
|
2021-03-26 18:16:08 +01:00
|
|
|
Group {
|
2022-07-13 18:31:56 +02:00
|
|
|
title(Tr::tr("Benchmark Metrics")),
|
2022-07-21 11:10:34 +02:00
|
|
|
Column { s.metrics }
|
2021-03-26 18:16:08 +01:00
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2022-07-22 18:54:04 +02:00
|
|
|
Column { Row { col, st }, st }.attachTo(widget);
|
2021-03-26 18:16:08 +01:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-13 09:30:59 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Autotest
|