diff options
author | Christian Stenger <christian.stenger@theqtcompany.com> | 2016-01-12 17:53:13 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@theqtcompany.com> | 2016-01-13 10:12:08 +0000 |
commit | 07ba6bc7e319d868e344021267265c515e1032c9 (patch) | |
tree | bedbb6b5ff4ef25ede283b9bfba9f2022eaf10f9 | |
parent | 059f8cf3e9c733f1784f8ccdcd3997d03f01f69f (diff) |
Redo processing output to avoid costly functions
Change-Id: I8fa0a84f49b981909d5ac61ef7993c3569aafa2b
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
-rw-r--r-- | plugins/autotest/testoutputreader.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/plugins/autotest/testoutputreader.cpp b/plugins/autotest/testoutputreader.cpp index c75260ef01..df4083b308 100644 --- a/plugins/autotest/testoutputreader.cpp +++ b/plugins/autotest/testoutputreader.cpp @@ -324,16 +324,22 @@ void TestOutputReader::processGTestOutput() static QString description; static QByteArray unprocessed; - while (m_testApplication->canReadLine()) - unprocessed.append(m_testApplication->readLine()); - - int lineBreak; - while ((lineBreak = unprocessed.indexOf('\n')) != -1) { - const QString line = QLatin1String(unprocessed.left(lineBreak)); - unprocessed.remove(0, lineBreak + 1); - if (line.isEmpty()) { + while (m_testApplication->canReadLine()) { + QByteArray read = m_testApplication->readLine(); + if (!unprocessed.isEmpty()) { + read = unprocessed + read; + unprocessed.clear(); + } + if (!read.endsWith('\n')) { + unprocessed = read; 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('['))) { description.append(line).append(QLatin1Char('\n')); if (line.startsWith(QStringLiteral("Note:"))) { |