blob: 3734223609fe1938639425d6b25dc78681a69c4b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qttestconfiguration.h"
#include "qttestframework.h"
#include "qttestoutputreader.h"
#include "qttest_utils.h"
#include "../testsettings.h"
#include <utils/algorithm.h>
using namespace Utils;
namespace Autotest {
namespace Internal {
static QStringList quoteIfNeeded(const QStringList &testCases, bool debugMode)
{
if (debugMode)
return testCases;
return Utils::transform(testCases, [](const QString &testCase){
return testCase.contains(' ') ? '"' + testCase + '"' : testCase;
});
}
TestOutputReader *QtTestConfiguration::createOutputReader(Process *app) const
{
const QtTestOutputReader::OutputMode mode = theQtTestFramework().useXMLOutput()
? QtTestOutputReader::XML
: QtTestOutputReader::PlainText;
return new QtTestOutputReader(app, buildDirectory(), projectFile(), mode, TestType::QtTest);
}
QStringList QtTestConfiguration::argumentsForTestRunner(QStringList *omitted) const
{
QStringList arguments;
if (testSettings().processArgs()) {
arguments.append(QTestUtils::filterInterfering(
runnable().command.arguments().split(' ', Qt::SkipEmptyParts),
omitted, false));
}
QtTestFramework &qtSettings = theQtTestFramework();
if (qtSettings.useXMLOutput())
arguments << "-o" << "-,xml";
else
arguments << "-o" << "-,txt";
if (!testCases().isEmpty())
arguments << quoteIfNeeded(testCases(), isDebugRunMode());
const QString metricsOption = QtTestFramework::metricsTypeToOption(MetricsType(qtSettings.metrics()));
if (!metricsOption.isEmpty())
arguments << metricsOption;
if (qtSettings.verboseBench())
arguments << "-vb";
if (qtSettings.logSignalsSlots())
arguments << "-vs";
if (isDebugRunMode() && qtSettings.noCrashHandler())
arguments << "-nocrashhandler";
if (qtSettings.limitWarnings() && qtSettings.maxWarnings() != 2000)
arguments << "-maxwarnings" << QString::number(qtSettings.maxWarnings());
return arguments;
}
Environment QtTestConfiguration::filteredEnvironment(const Environment &original) const
{
return QTestUtils::prepareBasicEnvironment(original);
}
} // namespace Internal
} // namespace Autotest
|