aboutsummaryrefslogtreecommitdiffstats
path: root/tests/benchmarker
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2019-02-19 22:16:04 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2019-02-25 15:58:40 +0000
commit0876dc4d6abb147ccdcc190adfad01c704a73e61 (patch)
treee8a1d558827e2a9e4092600cbe1a2029895d9f99 /tests/benchmarker
parente160b26d8c7476c63f6220ac69d1d6405e8ce3aa (diff)
Use QStringLiteral more where it is possible
Change-Id: I7419cc3fbc1e8776de3943852dcedab4c95d1c32 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests/benchmarker')
-rw-r--r--tests/benchmarker/benchmarker.cpp2
-rw-r--r--tests/benchmarker/commandlineparser.cpp6
-rw-r--r--tests/benchmarker/runsupport.cpp8
-rw-r--r--tests/benchmarker/valgrindrunner.cpp18
4 files changed, 17 insertions, 17 deletions
diff --git a/tests/benchmarker/benchmarker.cpp b/tests/benchmarker/benchmarker.cpp
index 050eb97a7..5ecdbf08b 100644
--- a/tests/benchmarker/benchmarker.cpp
+++ b/tests/benchmarker/benchmarker.cpp
@@ -116,7 +116,7 @@ void Benchmarker::rememberCurrentRepoState()
void Benchmarker::buildQbs(const QString &buildDir) const
{
if (!QDir::root().mkpath(buildDir))
- throw Exception(QString::fromLatin1("Failed to create directory '%1'.").arg(buildDir));
+ throw Exception(QStringLiteral("Failed to create directory '%1'.").arg(buildDir));
runProcess(QStringList() << "qmake" << "CONFIG+=force_debug_info"
<< (m_qbsRepo + "/qbs.pro"), buildDir);
runProcess(QStringList() << "make" << "-s", buildDir);
diff --git a/tests/benchmarker/commandlineparser.cpp b/tests/benchmarker/commandlineparser.cpp
index 7c7e1a9c7..4e5052453 100644
--- a/tests/benchmarker/commandlineparser.cpp
+++ b/tests/benchmarker/commandlineparser.cpp
@@ -64,7 +64,7 @@ void CommandLineParser::parse()
"repo path");
parser.addOption(qbsRepoOption);
QCommandLineOption activitiesOption(QStringList{"activities", "a"},
- QString::fromLatin1("The activities to benchmark. Possible values (CSV): %1,%2,%3,%4")
+ QStringLiteral("The activities to benchmark. Possible values (CSV): %1,%2,%3,%4")
.arg(resolveActivity(), ruleExecutionActivity(), nullBuildActivity(),
allActivities()), "activities", allActivities());
parser.addOption(activitiesOption);
@@ -119,14 +119,14 @@ void CommandLineParser::parse()
void CommandLineParser::throwException(const QString &optionName, const QString &illegalValue,
const QString &helpText)
{
- const QString errorText(QString::fromLatin1("Error parsing command line: Illegal value '%1' "
+ const QString errorText(QStringLiteral("Error parsing command line: Illegal value '%1' "
"for option '--%2'.\n%3").arg(illegalValue, optionName, helpText));
throw Exception(errorText);
}
void CommandLineParser::throwException(const QString &missingOption, const QString &helpText)
{
- const QString errorText(QString::fromLatin1("Error parsing command line: Missing mandatory "
+ const QString errorText(QStringLiteral("Error parsing command line: Missing mandatory "
"option '--%1'.\n%3").arg(missingOption, helpText));
throw Exception(errorText);
}
diff --git a/tests/benchmarker/runsupport.cpp b/tests/benchmarker/runsupport.cpp
index e01200067..3f8f46470 100644
--- a/tests/benchmarker/runsupport.cpp
+++ b/tests/benchmarker/runsupport.cpp
@@ -46,20 +46,20 @@ void runProcess(const QStringList &commandLine, const QString &workingDir, QByte
p.setWorkingDirectory(workingDir);
p.start(command, args);
if (!p.waitForStarted())
- throw Exception(QString::fromLatin1("Process '%1' failed to start.").arg(command));
+ throw Exception(QStringLiteral("Process '%1' failed to start.").arg(command));
p.waitForFinished(-1);
if (p.exitStatus() != QProcess::NormalExit) {
- throw Exception(QString::fromLatin1("Error running '%1': %2")
+ throw Exception(QStringLiteral("Error running '%1': %2")
.arg(command, p.errorString()));
}
if (exitCode)
*exitCode = p.exitCode();
if (p.exitCode() != 0) {
- QString errorString = QString::fromLatin1("Command '%1' finished with exit code %2.")
+ QString errorString = QStringLiteral("Command '%1' finished with exit code %2.")
.arg(command).arg(p.exitCode());
const QByteArray stdErr = p.readAllStandardError();
if (!stdErr.isEmpty()) {
- errorString += QString::fromLatin1("\nStandard error output was: '%1'")
+ errorString += QStringLiteral("\nStandard error output was: '%1'")
.arg(QString::fromLocal8Bit(stdErr));
}
throw Exception(errorString);
diff --git a/tests/benchmarker/valgrindrunner.cpp b/tests/benchmarker/valgrindrunner.cpp
index 399216226..0441e1b10 100644
--- a/tests/benchmarker/valgrindrunner.cpp
+++ b/tests/benchmarker/valgrindrunner.cpp
@@ -51,7 +51,7 @@ ValgrindRunner::ValgrindRunner(Activities activities, const QString &testProject
, m_baseOutputDir(baseOutputDir)
{
if (!QDir::root().mkpath(m_baseOutputDir))
- throw Exception(QString::fromLatin1("Failed to create directory '%1'.").arg(baseOutputDir));
+ throw Exception(QStringLiteral("Failed to create directory '%1'.").arg(baseOutputDir));
}
void ValgrindRunner::run()
@@ -163,7 +163,7 @@ qint64 ValgrindRunner::runCallgrind(const QString &qbsCommand, const QString &bu
runProcess(valgrindCommandLine(qbsCommand, buildDir, dryRun, "callgrind", outFile));
QFile f(outFile);
if (!f.open(QIODevice::ReadOnly)) {
- throw Exception(QString::fromLatin1("Failed to open file '%1': %2")
+ throw Exception(QStringLiteral("Failed to open file '%1': %2")
.arg(outFile, f.errorString()));
}
while (!f.atEnd()) {
@@ -175,14 +175,14 @@ qint64 ValgrindRunner::runCallgrind(const QString &qbsCommand, const QString &bu
bool ok;
const qint64 iCount = icString.toLongLong(&ok);
if (!ok) {
- throw Exception(QString::fromLatin1("Unexpected line in callgrind output file "
+ throw Exception(QStringLiteral("Unexpected line in callgrind output file "
"'%1': '%2'.")
.arg(outFile, QString::fromLocal8Bit(line)));
}
return iCount;
}
- throw Exception(QString::fromLatin1("Failed to find summary line in callgrind "
+ throw Exception(QStringLiteral("Failed to find summary line in callgrind "
"output file '%1'.").arg(outFile));
}
@@ -195,7 +195,7 @@ qint64 ValgrindRunner::runMassif(const QString &qbsCommand, const QString &build
QBuffer buffer(&ms_printOutput);
buffer.open(QIODevice::ReadOnly);
QByteArray peakSnapshot;
- const QString exceptionStringPattern = QString::fromLatin1("Failed to extract peak memory "
+ const QString exceptionStringPattern = QStringLiteral("Failed to extract peak memory "
"usage from file '%1': %2").arg(outFile);
while (!buffer.atEnd()) {
const QByteArray line = buffer.readLine();
@@ -207,7 +207,7 @@ qint64 ValgrindRunner::runMassif(const QString &qbsCommand, const QString &build
if (delimiterOffset == -1)
delimiterOffset = line.lastIndexOf('[', magicStringOffset);
if (delimiterOffset == -1) {
- const QString details = QString::fromLatin1("Failed to extract peak snapshot from "
+ const QString details = QStringLiteral("Failed to extract peak snapshot from "
"line '%1'.").arg(QString::fromLocal8Bit(line));
throw Exception(exceptionStringPattern.arg(details));
}
@@ -222,7 +222,7 @@ qint64 ValgrindRunner::runMassif(const QString &qbsCommand, const QString &build
continue;
const QList<QByteArray> entries = line.split(' ');
if (entries.size() != 6) {
- const QString details = QString::fromLatin1("Expected 6 entries in line '%1', but "
+ const QString details = QStringLiteral("Expected 6 entries in line '%1', but "
"there are %2.").arg(QString::fromLocal8Bit(line)).arg(entries.size());
throw Exception(exceptionStringPattern.arg(details));
}
@@ -231,14 +231,14 @@ qint64 ValgrindRunner::runMassif(const QString &qbsCommand, const QString &build
bool ok;
qint64 peakMemoryUsage = peakMemoryString.toLongLong(&ok);
if (!ok) {
- const QString details = QString::fromLatin1("Failed to parse peak memory value '%1' "
+ const QString details = QStringLiteral("Failed to parse peak memory value '%1' "
"as a number.").arg(QString::fromLocal8Bit(peakMemoryString));
throw Exception(exceptionStringPattern.arg(details));
}
return peakMemoryUsage;
}
- const QString details = QString::fromLatin1("Failed to find snapshot '%1'.")
+ const QString details = QStringLiteral("Failed to find snapshot '%1'.")
.arg(QString::fromLocal8Bit(peakSnapshot));
throw Exception(exceptionStringPattern.arg(details));
}