Redo processing output to avoid costly functions

Change-Id: I8fa0a84f49b981909d5ac61ef7993c3569aafa2b
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Christian Stenger
2016-01-12 17:53:13 +01:00
parent 059f8cf3e9
commit 07ba6bc7e3

View File

@@ -324,16 +324,22 @@ void TestOutputReader::processGTestOutput()
static QString description; static QString description;
static QByteArray unprocessed; static QByteArray unprocessed;
while (m_testApplication->canReadLine()) while (m_testApplication->canReadLine()) {
unprocessed.append(m_testApplication->readLine()); QByteArray read = m_testApplication->readLine();
if (!unprocessed.isEmpty()) {
int lineBreak; read = unprocessed + read;
while ((lineBreak = unprocessed.indexOf('\n')) != -1) { unprocessed.clear();
const QString line = QLatin1String(unprocessed.left(lineBreak)); }
unprocessed.remove(0, lineBreak + 1); if (!read.endsWith('\n')) {
if (line.isEmpty()) { unprocessed = read;
continue; continue;
} }
read.chop(1); // remove the newline from the output
const QString line = QString::fromLatin1(read);
if (line.trimmed().isEmpty())
continue;
if (!line.startsWith(QLatin1Char('['))) { if (!line.startsWith(QLatin1Char('['))) {
description.append(line).append(QLatin1Char('\n')); description.append(line).append(QLatin1Char('\n'));
if (line.startsWith(QStringLiteral("Note:"))) { if (line.startsWith(QStringLiteral("Note:"))) {