aboutsummaryrefslogtreecommitdiffstats
path: root/tests/fuzzy-test
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/fuzzy-test
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/fuzzy-test')
-rw-r--r--tests/fuzzy-test/commandlineparser.cpp14
-rw-r--r--tests/fuzzy-test/fuzzytester.cpp24
2 files changed, 19 insertions, 19 deletions
diff --git a/tests/fuzzy-test/commandlineparser.cpp b/tests/fuzzy-test/commandlineparser.cpp
index 86f498dec..18515604b 100644
--- a/tests/fuzzy-test/commandlineparser.cpp
+++ b/tests/fuzzy-test/commandlineparser.cpp
@@ -64,7 +64,7 @@ void CommandLineParser::parse(const QStringList &commandLine)
else if (arg == logOption())
m_log = true;
else
- throw ParseException(QString::fromLatin1("Unknown parameter '%1'").arg(arg));
+ throw ParseException(QStringLiteral("Unknown parameter '%1'").arg(arg));
}
if (m_profile.isEmpty())
throw ParseException("No profile given.");
@@ -74,7 +74,7 @@ void CommandLineParser::parse(const QStringList &commandLine)
QString CommandLineParser::usageString() const
{
- return QString::fromLatin1("%1 %2 <profile> %3 <start commit> [%4 <duration>] "
+ return QStringLiteral("%1 %2 <profile> %3 <start commit> [%4 <duration>] "
"[%5 <job count>] [%6]")
.arg(QFileInfo(m_command).fileName(), profileOption(), startCommitOption(),
maxDurationoption(), jobCountOption(), logOption());
@@ -83,10 +83,10 @@ QString CommandLineParser::usageString() const
void CommandLineParser::assignOptionArgument(const QString &option, QString &argument)
{
if (m_commandLine.empty())
- throw ParseException(QString::fromLatin1("Option '%1' needs an argument.").arg(option));
+ throw ParseException(QStringLiteral("Option '%1' needs an argument.").arg(option));
argument = m_commandLine.takeFirst();
if (argument.isEmpty()) {
- throw ParseException(QString::fromLatin1("Argument for option '%1' must not be empty.")
+ throw ParseException(QStringLiteral("Argument for option '%1' must not be empty.")
.arg(option));
}
}
@@ -98,7 +98,7 @@ void CommandLineParser::assignOptionArgument(const QString &option, int &argumen
bool ok;
argument = numberString.toInt(&ok);
if (!ok || argument <= 0) {
- throw ParseException(QString::fromLatin1("Invalid argument '%1' for option '%2'.")
+ throw ParseException(QStringLiteral("Invalid argument '%1' for option '%2'.")
.arg(numberString, option));
}
}
@@ -116,7 +116,7 @@ void CommandLineParser::parseDuration()
bool ok;
m_maxDuration = choppedDurationString.toInt(&ok);
if (!ok || m_maxDuration <= 0) {
- throw ParseException(QString::fromLatin1("Invalid duration argument '%1'.")
+ throw ParseException(QStringLiteral("Invalid duration argument '%1'.")
.arg(durationString));
}
if (hasSuffix) {
@@ -125,7 +125,7 @@ void CommandLineParser::parseDuration()
case 'd': m_maxDuration *= 24; // Fall-through.
case 'h': m_maxDuration *= 60; break;
default:
- throw ParseException(QString::fromLatin1("Invalid duration suffix '%1'.")
+ throw ParseException(QStringLiteral("Invalid duration suffix '%1'.")
.arg(suffix));
}
}
diff --git a/tests/fuzzy-test/fuzzytester.cpp b/tests/fuzzy-test/fuzzytester.cpp
index 37a6c56fe..b836ee623 100644
--- a/tests/fuzzy-test/fuzzytester.cpp
+++ b/tests/fuzzy-test/fuzzytester.cpp
@@ -100,10 +100,10 @@ void FuzzyTester::runTest(const QString &profile, const QString &startCommit,
// for errors, as information from change tracking has to be serialized correctly.
QString qbsError;
m_currentActivity = resolveIncrementalActivity();
- bool success = runQbs(defaultBuildDir(), QLatin1String("resolve"), &qbsError);
+ bool success = runQbs(defaultBuildDir(), QStringLiteral("resolve"), &qbsError);
if (success) {
m_currentActivity = buildIncrementalActivity();
- success = runQbs(defaultBuildDir(), QLatin1String("build"), &qbsError);
+ success = runQbs(defaultBuildDir(), QStringLiteral("build"), &qbsError);
}
m_currentActivity = buildFromScratchActivity();
if (success) {
@@ -111,7 +111,7 @@ void FuzzyTester::runTest(const QString &profile, const QString &startCommit,
QString message = "An incremental build succeeded "
"with a commit for which a clean build failed.";
if (!m_log) {
- message += QString::fromLatin1("\nThe qbs error message "
+ message += QStringLiteral("\nThe qbs error message "
"for the clean build was: '%1'").arg(qbsError);
}
throwIncrementalBuildError(message, buildSequence);
@@ -122,7 +122,7 @@ void FuzzyTester::runTest(const QString &profile, const QString &startCommit,
QString message = "An incremental build failed "
"with a commit for which a clean build succeeded.";
if (!m_log) {
- message += QString::fromLatin1("\nThe qbs error message for "
+ message += QStringLiteral("\nThe qbs error message for "
"the incremental build was: '%1'").arg(qbsError);
}
throwIncrementalBuildError(message, buildSequence);
@@ -166,14 +166,14 @@ QString FuzzyTester::findWorkingStartCommit(const QString &startCommit)
}
checkoutCommit(m_currentCommit);
removeDir(defaultBuildDir());
- if (runQbs(defaultBuildDir(), QLatin1String("build"), &qbsError)) {
+ if (runQbs(defaultBuildDir(), QStringLiteral("build"), &qbsError)) {
m_buildableCommits << m_currentCommit;
return m_currentCommit;
}
qDebug("Commit %s is not buildable.", qPrintable(m_currentCommit));
m_unbuildableCommits << m_currentCommit;
}
- throw TestError(QString::fromLatin1("Cannot run test: Failed to find a single commit that "
+ throw TestError(QStringLiteral("Cannot run test: Failed to find a single commit that "
"builds successfully with qbs. The last qbs error was: '%1'").arg(qbsError));
}
@@ -184,9 +184,9 @@ void FuzzyTester::runGit(const QStringList &arguments, QString *output)
if (!git.waitForStarted())
throw TestError("Failed to start git. It is expected to be in the PATH.");
if (!git.waitForFinished(300000) || git.exitStatus() != QProcess::NormalExit) // 5 minutes ought to be enough for everyone
- throw TestError(QString::fromLatin1("git failed: %1").arg(git.errorString()));
+ throw TestError(QStringLiteral("git failed: %1").arg(git.errorString()));
if (git.exitCode() != 0) {
- throw TestError(QString::fromLatin1("git failed: %1")
+ throw TestError(QStringLiteral("git failed: %1")
.arg(QString::fromLocal8Bit(git.readAllStandardError())));
}
if (output)
@@ -222,7 +222,7 @@ bool FuzzyTester::runQbs(const QString &buildDir, const QString &command, QStrin
commandLine << ("profile:" + m_profile);
qbs.start("qbs", commandLine);
if (!qbs.waitForStarted()) {
- throw TestError(QString::fromLatin1("Failed to start qbs. It is expected to be "
+ throw TestError(QStringLiteral("Failed to start qbs. It is expected to be "
"in the PATH. QProcess error string: '%1'").arg(qbs.errorString()));
}
if (!qbs.waitForFinished(-1) || qbs.exitCode() != 0) {
@@ -237,7 +237,7 @@ void FuzzyTester::removeDir(const QString &dirPath)
{
QDir dir(dirPath);
if (!dir.removeRecursively()) {
- throw TestError(QString::fromLatin1("Failed to remove temporary dir '%1'.")
+ throw TestError(QStringLiteral("Failed to remove temporary dir '%1'.")
.arg(dir.absolutePath()));
}
}
@@ -254,7 +254,7 @@ bool FuzzyTester::doCleanBuild(QString *errorMessage)
}
const QString cleanBuildDir = "fuzzytest-verification-build";
removeDir(cleanBuildDir);
- if (runQbs(cleanBuildDir, QLatin1String("build"), errorMessage)) {
+ if (runQbs(cleanBuildDir, QStringLiteral("build"), errorMessage)) {
m_buildableCommits << m_currentCommit;
return true;
}
@@ -266,7 +266,7 @@ void FuzzyTester::throwIncrementalBuildError(const QString &message,
const QStringList &commitSequence)
{
const QString commitSequenceString = commitSequence.join(QLatin1Char(','));
- throw TestError(QString::fromLatin1("Found qbs bug with incremental build!\n"
+ throw TestError(QStringLiteral("Found qbs bug with incremental build!\n"
"%1\n"
"The sequence of commits was: %2.").arg(message, commitSequenceString));
}