forked from qt-creator/qt-creator
AutoTest: Fix location parsing for Qt Test
There are multiple ways to print the location depending on the OS the test is executed on. Do not "parse" again the location string, but use named captures instead as they are present anyhow. Former approach would return no location in case the location would be printed like /path/to/file:10 which might be used on UNIX. Task-number: QTCREATORBUG-30143 Change-Id: If48bd0d9d9d8121522a44dfa69a15a0ccabde708 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
@@ -351,9 +351,9 @@ void QtTestOutputReader::processPlainTextOutput(const QByteArray &outputLine)
|
||||
if (hasMatch(result)) {
|
||||
processResultOutput(match.captured(1).toLower().trimmed(), match.captured(2));
|
||||
} else if (hasMatch(locationUnix)) {
|
||||
processLocationOutput(match.captured(1));
|
||||
processLocationOutput(match.captured("file"), match.captured("line"));
|
||||
} else if (hasMatch(locationWin)) {
|
||||
processLocationOutput(match.captured(1));
|
||||
processLocationOutput(match.captured("file"), match.captured("line"));
|
||||
} else if (hasMatch(benchDetails)) {
|
||||
m_description = match.captured(1);
|
||||
} else if (hasMatch(config)) {
|
||||
@@ -412,15 +412,11 @@ void QtTestOutputReader::processResultOutput(const QString &result, const QStrin
|
||||
m_formerTestCase = m_testCase;
|
||||
}
|
||||
|
||||
void QtTestOutputReader::processLocationOutput(const QString &fileWithLine)
|
||||
void QtTestOutputReader::processLocationOutput(const QStringView file, const QStringView line)
|
||||
{
|
||||
QTC_ASSERT(fileWithLine.endsWith(')'), return);
|
||||
int openBrace = fileWithLine.lastIndexOf('(');
|
||||
QTC_ASSERT(openBrace != -1, return);
|
||||
m_file = constructSourceFilePath(m_buildDir, fileWithLine.left(openBrace));
|
||||
QString numberStr = fileWithLine.mid(openBrace + 1);
|
||||
numberStr.chop(1);
|
||||
m_lineNumber = numberStr.toInt();
|
||||
QTC_ASSERT(!file.isEmpty(), return);
|
||||
m_file = constructSourceFilePath(m_buildDir, file.toString());
|
||||
m_lineNumber = line.toInt();
|
||||
}
|
||||
|
||||
void QtTestOutputReader::processSummaryFinishOutput()
|
||||
|
||||
@@ -33,7 +33,7 @@ private:
|
||||
void processXMLOutput(const QByteArray &outputLine);
|
||||
void processPlainTextOutput(const QByteArray &outputLine);
|
||||
void processResultOutput(const QString &result, const QString &message);
|
||||
void processLocationOutput(const QString &fileWithLine);
|
||||
void processLocationOutput(const QStringView file, const QStringView line);
|
||||
void processSummaryFinishOutput();
|
||||
// helper functions
|
||||
void sendCompleteInformation();
|
||||
|
||||
Reference in New Issue
Block a user