forked from qt-creator/qt-creator
avoid abbreviations in variable names
Change-Id: Ie9474da2a4c9c2e461bdd15e859e1a53f820a1d1 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -168,20 +168,20 @@ static bool xmlExtractBenchmarkInformation(const QString &code, const QString &t
|
|||||||
const double value = code.mid(start, code.indexOf(QLatin1Char('"'), start) - start).toDouble();
|
const double value = code.mid(start, code.indexOf(QLatin1Char('"'), start) - start).toDouble();
|
||||||
start = code.indexOf(QLatin1String(" iterations=\"")) + 13;
|
start = code.indexOf(QLatin1String(" iterations=\"")) + 13;
|
||||||
const int iterations = code.mid(start, code.indexOf(QLatin1Char('"'), start) - start).toInt();
|
const int iterations = code.mid(start, code.indexOf(QLatin1Char('"'), start) - start).toInt();
|
||||||
QString metricsTxt;
|
QString metricsText;
|
||||||
if (metric == QLatin1String("WalltimeMilliseconds")) // default
|
if (metric == QLatin1String("WalltimeMilliseconds")) // default
|
||||||
metricsTxt = QLatin1String("msecs");
|
metricsText = QLatin1String("msecs");
|
||||||
else if (metric == QLatin1String("CPUTicks")) // -tickcounter
|
else if (metric == QLatin1String("CPUTicks")) // -tickcounter
|
||||||
metricsTxt = QLatin1String("CPU ticks");
|
metricsText = QLatin1String("CPU ticks");
|
||||||
else if (metric == QLatin1String("Events")) // -eventcounter
|
else if (metric == QLatin1String("Events")) // -eventcounter
|
||||||
metricsTxt = QLatin1String("events");
|
metricsText = QLatin1String("events");
|
||||||
else if (metric == QLatin1String("InstructionReads")) // -callgrind
|
else if (metric == QLatin1String("InstructionReads")) // -callgrind
|
||||||
metricsTxt = QLatin1String("instruction reads");
|
metricsText = QLatin1String("instruction reads");
|
||||||
else if (metric == QLatin1String("CPUCycles")) // -perf
|
else if (metric == QLatin1String("CPUCycles")) // -perf
|
||||||
metricsTxt = QLatin1String("CPU cycles");
|
metricsText = QLatin1String("CPU cycles");
|
||||||
description = QObject::tr("%1 %2 per iteration (total: %3, iterations: %4)")
|
description = QObject::tr("%1 %2 per iteration (total: %3, iterations: %4)")
|
||||||
.arg(formatResult(value))
|
.arg(formatResult(value))
|
||||||
.arg(metricsTxt)
|
.arg(metricsText)
|
||||||
.arg(formatResult(value * (double)iterations))
|
.arg(formatResult(value * (double)iterations))
|
||||||
.arg(iterations);
|
.arg(iterations);
|
||||||
return true;
|
return true;
|
||||||
@@ -211,7 +211,7 @@ void processOutput(QProcess *testRunner)
|
|||||||
static bool readingDescription = false;
|
static bool readingDescription = false;
|
||||||
static QString qtVersion;
|
static QString qtVersion;
|
||||||
static QString qtestVersion;
|
static QString qtestVersion;
|
||||||
static QString bmDescription;
|
static QString benchmarkDescription;
|
||||||
|
|
||||||
while (testRunner->canReadLine()) {
|
while (testRunner->canReadLine()) {
|
||||||
// TODO Qt5 uses UTF-8 - while Qt4 uses ISO-8859-1 - could this be a problem?
|
// TODO Qt5 uses UTF-8 - while Qt4 uses ISO-8859-1 - could this be a problem?
|
||||||
@@ -259,8 +259,8 @@ void processOutput(QProcess *testRunner)
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (xmlExtractBenchmarkInformation(line, QLatin1String("<BenchmarkResult"), bmDescription)) {
|
if (xmlExtractBenchmarkInformation(line, QLatin1String("<BenchmarkResult"), benchmarkDescription)) {
|
||||||
TestResult testResult(className, testCase, dataTag, Result::BENCHMARK, bmDescription);
|
TestResult testResult(className, testCase, dataTag, Result::BENCHMARK, benchmarkDescription);
|
||||||
emitTestResultCreated(testResult);
|
emitTestResultCreated(testResult);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -302,33 +302,33 @@ void processOutput(QProcess *testRunner)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString which(const QString &path, const QString &cmd)
|
static QString which(const QString &pathValue, const QString &command)
|
||||||
{
|
{
|
||||||
if (path.isEmpty() || cmd.isEmpty())
|
if (pathValue.isEmpty() || command.isEmpty())
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
QStringList paths;
|
QStringList pathList;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
paths = path.split(QLatin1Char(';'));
|
pathList = pathValue.split(QLatin1Char(';'));
|
||||||
#else
|
#else
|
||||||
paths = path.split(QLatin1Char(':'));
|
pathList = pathValue.split(QLatin1Char(':'));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
foreach (const QString &p, paths) {
|
foreach (const QString &path, pathList) {
|
||||||
const QString fName = p + QDir::separator() + cmd;
|
const QString filePath = path + QDir::separator() + command;
|
||||||
QFileInfo fi(fName);
|
QFileInfo commandFileInfo(filePath);
|
||||||
if (fi.exists() && fi.isExecutable())
|
if (commandFileInfo.exists() && commandFileInfo.isExecutable())
|
||||||
return fName;
|
return filePath;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
fi = QFileInfo(fName + QLatin1String(".exe"));
|
commandFileInfo = QFileInfo(filePath + QLatin1String(".exe"));
|
||||||
if (fi.exists())
|
if (commandFileInfo.exists())
|
||||||
return fi.absoluteFilePath();
|
return commandFileInfo.absoluteFilePath();
|
||||||
fi = QFileInfo(fName + QLatin1String(".bat"));
|
commandFileInfo = QFileInfo(filePath + QLatin1String(".bat"));
|
||||||
if (fi.exists())
|
if (commandFileInfo.exists())
|
||||||
return fi.absoluteFilePath();
|
return commandFileInfo.absoluteFilePath();
|
||||||
fi = QFileInfo(fName + QLatin1String(".cmd"));
|
commandFileInfo = QFileInfo(filePath + QLatin1String(".cmd"));
|
||||||
if (fi.exists())
|
if (commandFileInfo.exists())
|
||||||
return fi.absoluteFilePath();
|
return commandFileInfo.absoluteFilePath();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
@@ -356,28 +356,28 @@ void performTestRun(QFutureInterface<void> &future, const QList<TestConfiguratio
|
|||||||
m_currentFuture->setProgressRange(0, testCaseCount);
|
m_currentFuture->setProgressRange(0, testCaseCount);
|
||||||
m_currentFuture->setProgressValue(0);
|
m_currentFuture->setProgressValue(0);
|
||||||
|
|
||||||
foreach (const TestConfiguration *tc, selectedTests) {
|
foreach (const TestConfiguration *testConfiguration, selectedTests) {
|
||||||
if (m_currentFuture->isCanceled())
|
if (m_currentFuture->isCanceled())
|
||||||
break;
|
break;
|
||||||
QString command = tc->targetFile();
|
QString command = testConfiguration->targetFile();
|
||||||
QString workingDirectory = tc->workingDirectory();
|
QString workingDirectory = testConfiguration->workingDirectory();
|
||||||
QStringList argumentList;
|
QStringList argumentList;
|
||||||
Utils::Environment environment = tc->environment();
|
Utils::Environment environment = testConfiguration->environment();
|
||||||
|
|
||||||
argumentList << QLatin1String("-xml");
|
argumentList << QLatin1String("-xml");
|
||||||
if (!metricsOption.isEmpty())
|
if (!metricsOption.isEmpty())
|
||||||
argumentList << metricsOption;
|
argumentList << metricsOption;
|
||||||
if (tc->testCases().count())
|
if (testConfiguration->testCases().count())
|
||||||
argumentList << tc->testCases();
|
argumentList << testConfiguration->testCases();
|
||||||
QString runCmd;
|
QString runCommand;
|
||||||
if (!QDir::toNativeSeparators(command).contains(QDir::separator())) {
|
if (!QDir::toNativeSeparators(command).contains(QDir::separator())) {
|
||||||
if (environment.hasKey(QLatin1String("PATH")))
|
if (environment.hasKey(QLatin1String("PATH")))
|
||||||
runCmd = which(environment.value(QLatin1String("PATH")), command);
|
runCommand = which(environment.value(QLatin1String("PATH")), command);
|
||||||
} else if (QFileInfo(command).exists()) {
|
} else if (QFileInfo(command).exists()) {
|
||||||
runCmd = command;
|
runCommand = command;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runCmd.isEmpty()) {
|
if (runCommand.isEmpty()) {
|
||||||
emitTestResultCreated(FaultyTestResult(Result::MESSAGE_FATAL,
|
emitTestResultCreated(FaultyTestResult(Result::MESSAGE_FATAL,
|
||||||
QObject::tr("*** Could not find command '%1' ***").arg(command)));
|
QObject::tr("*** Could not find command '%1' ***").arg(command)));
|
||||||
continue;
|
continue;
|
||||||
@@ -388,9 +388,9 @@ void performTestRun(QFutureInterface<void> &future, const QList<TestConfiguratio
|
|||||||
QTime executionTimer;
|
QTime executionTimer;
|
||||||
|
|
||||||
if (argumentList.count()) {
|
if (argumentList.count()) {
|
||||||
testProcess.start(runCmd, argumentList);
|
testProcess.start(runCommand, argumentList);
|
||||||
} else {
|
} else {
|
||||||
testProcess.start(runCmd);
|
testProcess.start(runCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok = testProcess.waitForStarted();
|
bool ok = testProcess.waitForStarted();
|
||||||
@@ -456,9 +456,9 @@ void TestRunner::runTests()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::Internal::ProjectExplorerSettings pes =
|
ProjectExplorer::Internal::ProjectExplorerSettings projectExplorerSettings =
|
||||||
ProjectExplorer::ProjectExplorerPlugin::projectExplorerSettings();
|
ProjectExplorer::ProjectExplorerPlugin::projectExplorerSettings();
|
||||||
if (pes.buildBeforeDeploy) {
|
if (projectExplorerSettings.buildBeforeDeploy) {
|
||||||
if (!project->hasActiveBuildSettings()) {
|
if (!project->hasActiveBuildSettings()) {
|
||||||
TestResultsPane::instance()->addTestResult(FaultyTestResult(Result::MESSAGE_FATAL,
|
TestResultsPane::instance()->addTestResult(FaultyTestResult(Result::MESSAGE_FATAL,
|
||||||
tr("*** Project is not configured - canceling Test Run ***")));
|
tr("*** Project is not configured - canceling Test Run ***")));
|
||||||
@@ -498,18 +498,18 @@ void TestRunner::buildProject(ProjectExplorer::Project *project)
|
|||||||
{
|
{
|
||||||
m_building = true;
|
m_building = true;
|
||||||
m_buildSucceeded = false;
|
m_buildSucceeded = false;
|
||||||
ProjectExplorer::BuildManager *mgr = static_cast<ProjectExplorer::BuildManager *>(
|
ProjectExplorer::BuildManager *buildManager = static_cast<ProjectExplorer::BuildManager *>(
|
||||||
ProjectExplorer::BuildManager::instance());
|
ProjectExplorer::BuildManager::instance());
|
||||||
connect(mgr, &ProjectExplorer::BuildManager::buildQueueFinished,
|
connect(buildManager, &ProjectExplorer::BuildManager::buildQueueFinished,
|
||||||
this, &TestRunner::buildFinished);
|
this, &TestRunner::buildFinished);
|
||||||
ProjectExplorer::ProjectExplorerPlugin::buildProject(project);
|
ProjectExplorer::ProjectExplorerPlugin::buildProject(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::buildFinished(bool success)
|
void TestRunner::buildFinished(bool success)
|
||||||
{
|
{
|
||||||
ProjectExplorer::BuildManager *mgr = static_cast<ProjectExplorer::BuildManager *>(
|
ProjectExplorer::BuildManager *buildManager = static_cast<ProjectExplorer::BuildManager *>(
|
||||||
ProjectExplorer::BuildManager::instance());
|
ProjectExplorer::BuildManager::instance());
|
||||||
disconnect(mgr, &ProjectExplorer::BuildManager::buildQueueFinished,
|
disconnect(buildManager, &ProjectExplorer::BuildManager::buildQueueFinished,
|
||||||
this, &TestRunner::buildFinished);
|
this, &TestRunner::buildFinished);
|
||||||
m_building = false;
|
m_building = false;
|
||||||
m_buildSucceeded = success;
|
m_buildSucceeded = success;
|
||||||
|
|||||||
Reference in New Issue
Block a user