2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2016-09-13 09:30:59 +02:00
|
|
|
|
|
|
|
|
#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>
|
|
|
|
|
|
2023-05-09 17:46:02 +02:00
|
|
|
using namespace Layouting;
|
2021-03-26 18:16:08 +01:00
|
|
|
using namespace Utils;
|
|
|
|
|
|
2023-05-09 17:46:02 +02:00
|
|
|
namespace Autotest::Internal {
|
2016-09-13 09:30:59 +02:00
|
|
|
|
2023-05-09 17:46:02 +02:00
|
|
|
QtTestSettings::QtTestSettings(Id settingsId)
|
2016-09-13 13:38:19 +02:00
|
|
|
{
|
2021-03-24 12:40:03 +01:00
|
|
|
setSettingsGroups("Autotest", "QtTest");
|
2023-05-09 17:46:02 +02:00
|
|
|
setId(settingsId);
|
|
|
|
|
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
|
|
|
|
|
setDisplayName(Tr::tr(QtTest::Constants::FRAMEWORK_SETTINGS_CATEGORY));
|
|
|
|
|
|
2023-05-17 09:43:14 +02:00
|
|
|
setLayouter([this] {
|
|
|
|
|
return Row { Form {
|
2023-05-12 06:55:36 +02:00
|
|
|
noCrashHandler, br,
|
|
|
|
|
useXMLOutput, br,
|
|
|
|
|
verboseBench, br,
|
|
|
|
|
logSignalsSlots, br,
|
|
|
|
|
limitWarnings, maxWarnings, br,
|
2023-05-09 17:46:02 +02:00
|
|
|
Group {
|
|
|
|
|
title(Tr::tr("Benchmark Metrics")),
|
|
|
|
|
Column { metrics }
|
2023-05-12 06:55:36 +02:00
|
|
|
}, br,
|
|
|
|
|
quickCheckForDerivedTests, br
|
2023-05-17 09:43:14 +02:00
|
|
|
}, st };
|
2023-05-09 17:46:02 +02:00
|
|
|
});
|
2016-09-13 13:38:19 +02:00
|
|
|
|
2021-03-24 12:40:03 +01:00
|
|
|
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
|
|
|
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
|
|
|
|
|
|
|
|
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, "
|
2023-05-12 06:55:36 +02:00
|
|
|
"while plain text is more human readable.\n\nWarning: "
|
|
|
|
|
"Plain text misses some information, such as duration."));
|
2021-03-24 12:40:03 +01:00
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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."));
|
|
|
|
|
|
|
|
|
|
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);
|
2023-01-18 08:15:08 +01:00
|
|
|
|
|
|
|
|
quickCheckForDerivedTests.setSettingsKey("QuickCheckForDerivedTests");
|
|
|
|
|
quickCheckForDerivedTests.setDefaultValue(false);
|
|
|
|
|
quickCheckForDerivedTests.setLabelText(Tr::tr("Check for derived Qt Quick tests"));
|
|
|
|
|
quickCheckForDerivedTests.setToolTip(
|
|
|
|
|
Tr::tr("Search for Qt Quick tests that are derived from TestCase.\nWarning: Enabling this "
|
|
|
|
|
"feature significantly increases scan time."));
|
2016-09-13 09:30:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QtTestSettings::metricsTypeToOption(const MetricsType type)
|
|
|
|
|
{
|
|
|
|
|
switch (type) {
|
|
|
|
|
case MetricsType::Walltime:
|
2023-01-14 16:25:51 +01:00
|
|
|
return {};
|
2016-09-13 09:30:59 +02:00
|
|
|
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
|
|
|
}
|
2023-01-14 16:25:51 +01:00
|
|
|
return {};
|
2016-09-13 09:30:59 +02:00
|
|
|
}
|
|
|
|
|
|
2023-05-09 17:46:02 +02:00
|
|
|
} // Autotest::Internal
|