| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/testlib/qteamcitylogger.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||||||||||||||||||||
| 3 | ** Copyright (C) 2016 Borgar Ovsthus | - | ||||||||||||||||||||||||||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||||||||||||||||||||
| 6 | ** This file is part of the QtTest module of the Qt Toolkit. | - | ||||||||||||||||||||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||||||||||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||||||||||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||||||||||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||||||||||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||||||||||||||||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||||||||||||||||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||||||||||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||||||||||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||||||||||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||||||||||||||||||||
| 24 | ** | - | ||||||||||||||||||||||||||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||||||||||||||||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||||||||||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||||||||||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||||||||||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||||||||||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||||||||||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||||||||||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||||||||||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||||||||||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||||||||||||||||||||
| 35 | ** | - | ||||||||||||||||||||||||||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||||||||||||||
| 37 | ** | - | ||||||||||||||||||||||||||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||||||||||||||
| 40 | #include <QtTest/private/qtestresult_p.h> | - | ||||||||||||||||||||||||||||||||||||
| 41 | #include <QtTest/qtestassert.h> | - | ||||||||||||||||||||||||||||||||||||
| 42 | #include <QtTest/private/qtestlog_p.h> | - | ||||||||||||||||||||||||||||||||||||
| 43 | #include <QtTest/private/qteamcitylogger_p.h> | - | ||||||||||||||||||||||||||||||||||||
| 44 | #include <QtCore/qbytearray.h> | - | ||||||||||||||||||||||||||||||||||||
| 45 | #include <stdarg.h> | - | ||||||||||||||||||||||||||||||||||||
| 46 | #include <stdio.h> | - | ||||||||||||||||||||||||||||||||||||
| 47 | #include <stdlib.h> | - | ||||||||||||||||||||||||||||||||||||
| 48 | #include <string.h> | - | ||||||||||||||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||||||||||||||
| 50 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||||||||||||||
| 51 | - | |||||||||||||||||||||||||||||||||||||
| 52 | namespace QTest { | - | ||||||||||||||||||||||||||||||||||||
| 53 | - | |||||||||||||||||||||||||||||||||||||
| 54 | static const char *incidentType2String(QAbstractTestLogger::IncidentTypes type) | - | ||||||||||||||||||||||||||||||||||||
| 55 | { | - | ||||||||||||||||||||||||||||||||||||
| 56 | switch (type) { | - | ||||||||||||||||||||||||||||||||||||
| 57 | case QAbstractTestLogger::Pass: never executed: case QAbstractTestLogger::Pass: | 0 | ||||||||||||||||||||||||||||||||||||
| 58 | return "PASS"; never executed: return "PASS"; | 0 | ||||||||||||||||||||||||||||||||||||
| 59 | case QAbstractTestLogger::XFail: executed 75 times by 1 test: case QAbstractTestLogger::XFail:Executed by:
| 75 | ||||||||||||||||||||||||||||||||||||
| 60 | return "XFAIL"; executed 75 times by 1 test: return "XFAIL";Executed by:
| 75 | ||||||||||||||||||||||||||||||||||||
| 61 | case QAbstractTestLogger::Fail: never executed: case QAbstractTestLogger::Fail: | 0 | ||||||||||||||||||||||||||||||||||||
| 62 | return "FAIL!"; never executed: return "FAIL!"; | 0 | ||||||||||||||||||||||||||||||||||||
| 63 | case QAbstractTestLogger::XPass: never executed: case QAbstractTestLogger::XPass: | 0 | ||||||||||||||||||||||||||||||||||||
| 64 | return "XPASS"; never executed: return "XPASS"; | 0 | ||||||||||||||||||||||||||||||||||||
| 65 | case QAbstractTestLogger::BlacklistedPass: never executed: case QAbstractTestLogger::BlacklistedPass: | 0 | ||||||||||||||||||||||||||||||||||||
| 66 | return "BPASS"; never executed: return "BPASS"; | 0 | ||||||||||||||||||||||||||||||||||||
| 67 | case QAbstractTestLogger::BlacklistedFail: never executed: case QAbstractTestLogger::BlacklistedFail: | 0 | ||||||||||||||||||||||||||||||||||||
| 68 | return "BFAIL"; never executed: return "BFAIL"; | 0 | ||||||||||||||||||||||||||||||||||||
| 69 | } | - | ||||||||||||||||||||||||||||||||||||
| 70 | return "??????"; never executed: return "??????"; | 0 | ||||||||||||||||||||||||||||||||||||
| 71 | } | - | ||||||||||||||||||||||||||||||||||||
| 72 | - | |||||||||||||||||||||||||||||||||||||
| 73 | static const char *messageType2String(QAbstractTestLogger::MessageTypes type) | - | ||||||||||||||||||||||||||||||||||||
| 74 | { | - | ||||||||||||||||||||||||||||||||||||
| 75 | switch (type) { | - | ||||||||||||||||||||||||||||||||||||
| 76 | case QAbstractTestLogger::Skip: never executed: case QAbstractTestLogger::Skip: | 0 | ||||||||||||||||||||||||||||||||||||
| 77 | return "SKIP"; never executed: return "SKIP"; | 0 | ||||||||||||||||||||||||||||||||||||
| 78 | case QAbstractTestLogger::Warn: executed 10 times by 1 test: case QAbstractTestLogger::Warn:Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
| 79 | return "WARNING"; executed 10 times by 1 test: return "WARNING";Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
| 80 | case QAbstractTestLogger::QWarning: executed 10020 times by 1 test: case QAbstractTestLogger::QWarning:Executed by:
| 10020 | ||||||||||||||||||||||||||||||||||||
| 81 | return "QWARN"; executed 10020 times by 1 test: return "QWARN";Executed by:
| 10020 | ||||||||||||||||||||||||||||||||||||
| 82 | case QAbstractTestLogger::QDebug: executed 448 times by 1 test: case QAbstractTestLogger::QDebug:Executed by:
| 448 | ||||||||||||||||||||||||||||||||||||
| 83 | return "QDEBUG"; executed 448 times by 1 test: return "QDEBUG";Executed by:
| 448 | ||||||||||||||||||||||||||||||||||||
| 84 | case QAbstractTestLogger::QInfo: executed 10 times by 1 test: case QAbstractTestLogger::QInfo:Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
| 85 | return "QINFO"; executed 10 times by 1 test: return "QINFO";Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
| 86 | case QAbstractTestLogger::QSystem: executed 5 times by 1 test: case QAbstractTestLogger::QSystem:Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||
| 87 | return "QSYSTEM"; executed 5 times by 1 test: return "QSYSTEM";Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||
| 88 | case QAbstractTestLogger::QFatal: executed 10 times by 1 test: case QAbstractTestLogger::QFatal:Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
| 89 | return "QFATAL"; executed 10 times by 1 test: return "QFATAL";Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
| 90 | case QAbstractTestLogger::Info: executed 155 times by 1 test: case QAbstractTestLogger::Info:Executed by:
| 155 | ||||||||||||||||||||||||||||||||||||
| 91 | return "INFO"; executed 155 times by 1 test: return "INFO";Executed by:
| 155 | ||||||||||||||||||||||||||||||||||||
| 92 | } | - | ||||||||||||||||||||||||||||||||||||
| 93 | return "??????"; never executed: return "??????"; | 0 | ||||||||||||||||||||||||||||||||||||
| 94 | } | - | ||||||||||||||||||||||||||||||||||||
| 95 | } | - | ||||||||||||||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||||||||||||||
| 97 | QTeamCityLogger::QTeamCityLogger(const char *filename) | - | ||||||||||||||||||||||||||||||||||||
| 98 | : QAbstractTestLogger(filename) | - | ||||||||||||||||||||||||||||||||||||
| 99 | { | - | ||||||||||||||||||||||||||||||||||||
| 100 | } executed 146 times by 1 test: end of blockExecuted by:
| 146 | ||||||||||||||||||||||||||||||||||||
| 101 | - | |||||||||||||||||||||||||||||||||||||
| 102 | QTeamCityLogger::~QTeamCityLogger() | - | ||||||||||||||||||||||||||||||||||||
| 103 | { | - | ||||||||||||||||||||||||||||||||||||
| 104 | } | - | ||||||||||||||||||||||||||||||||||||
| 105 | - | |||||||||||||||||||||||||||||||||||||
| 106 | void QTeamCityLogger::startLogging() | - | ||||||||||||||||||||||||||||||||||||
| 107 | { | - | ||||||||||||||||||||||||||||||||||||
| 108 | QAbstractTestLogger::startLogging(); | - | ||||||||||||||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||||||||||||||
| 110 | QString testSuiteName = tcEscapedString(QString::fromUtf8(QTestResult::currentTestObjectName())); | - | ||||||||||||||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||||||||||||||
| 112 | QString str = QString(QLatin1String("##teamcity[testSuiteStarted name='%1']\n")).arg(testSuiteName); | - | ||||||||||||||||||||||||||||||||||||
| 113 | outputString(qPrintable(str)); | - | ||||||||||||||||||||||||||||||||||||
| 114 | } executed 146 times by 1 test: end of blockExecuted by:
| 146 | ||||||||||||||||||||||||||||||||||||
| 115 | - | |||||||||||||||||||||||||||||||||||||
| 116 | void QTeamCityLogger::stopLogging() | - | ||||||||||||||||||||||||||||||||||||
| 117 | { | - | ||||||||||||||||||||||||||||||||||||
| 118 | QString testSuiteName = tcEscapedString(QString::fromUtf8(QTestResult::currentTestObjectName())); | - | ||||||||||||||||||||||||||||||||||||
| 119 | - | |||||||||||||||||||||||||||||||||||||
| 120 | QString str = QString(QLatin1String("##teamcity[testSuiteFinished name='%1']\n")).arg(testSuiteName); | - | ||||||||||||||||||||||||||||||||||||
| 121 | outputString(qPrintable(str)); | - | ||||||||||||||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||||||||||||||
| 123 | QAbstractTestLogger::stopLogging(); | - | ||||||||||||||||||||||||||||||||||||
| 124 | } executed 146 times by 1 test: end of blockExecuted by:
| 146 | ||||||||||||||||||||||||||||||||||||
| 125 | - | |||||||||||||||||||||||||||||||||||||
| 126 | void QTeamCityLogger::enterTestFunction(const char * /*function*/) | - | ||||||||||||||||||||||||||||||||||||
| 127 | { | - | ||||||||||||||||||||||||||||||||||||
| 128 | // don't print anything | - | ||||||||||||||||||||||||||||||||||||
| 129 | } | - | ||||||||||||||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||||||||||||||
| 131 | void QTeamCityLogger::leaveTestFunction() | - | ||||||||||||||||||||||||||||||||||||
| 132 | { | - | ||||||||||||||||||||||||||||||||||||
| 133 | // don't print anything | - | ||||||||||||||||||||||||||||||||||||
| 134 | } | - | ||||||||||||||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||||||||||||||
| 136 | void QTeamCityLogger::addIncident(IncidentTypes type, const char *description, | - | ||||||||||||||||||||||||||||||||||||
| 137 | const char *file, int line) | - | ||||||||||||||||||||||||||||||||||||
| 138 | { | - | ||||||||||||||||||||||||||||||||||||
| 139 | // suppress PASS and XFAIL in silent mode | - | ||||||||||||||||||||||||||||||||||||
| 140 |
| 0-962 | ||||||||||||||||||||||||||||||||||||
| 141 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||||||||||||||
| 143 | QString buf; | - | ||||||||||||||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||||||||||||||
| 145 | QString tmpFuncName = escapedTestFuncName(); | - | ||||||||||||||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||||||||||||||
| 147 | if (tmpFuncName != currTestFuncName) {
| 80-1418 | ||||||||||||||||||||||||||||||||||||
| 148 | buf = QString(QLatin1String("##teamcity[testStarted name='%1']\n")).arg(tmpFuncName); | - | ||||||||||||||||||||||||||||||||||||
| 149 | outputString(qPrintable(buf)); | - | ||||||||||||||||||||||||||||||||||||
| 150 | } executed 1418 times by 1 test: end of blockExecuted by:
| 1418 | ||||||||||||||||||||||||||||||||||||
| 151 | - | |||||||||||||||||||||||||||||||||||||
| 152 | currTestFuncName = tmpFuncName; | - | ||||||||||||||||||||||||||||||||||||
| 153 | - | |||||||||||||||||||||||||||||||||||||
| 154 | if (type == QAbstractTestLogger::XFail) {
| 75-1423 | ||||||||||||||||||||||||||||||||||||
| 155 | addPendingMessage(QTest::incidentType2String(type), QString::fromUtf8(description), file, line); | - | ||||||||||||||||||||||||||||||||||||
| 156 | return; executed 75 times by 1 test: return;Executed by:
| 75 | ||||||||||||||||||||||||||||||||||||
| 157 | } | - | ||||||||||||||||||||||||||||||||||||
| 158 | - | |||||||||||||||||||||||||||||||||||||
| 159 | QString detailedText = QString::fromUtf8(description); | - | ||||||||||||||||||||||||||||||||||||
| 160 | detailedText = tcEscapedString(detailedText); | - | ||||||||||||||||||||||||||||||||||||
| 161 | - | |||||||||||||||||||||||||||||||||||||
| 162 | // Test failed | - | ||||||||||||||||||||||||||||||||||||
| 163 |
| 20-907 | ||||||||||||||||||||||||||||||||||||
| 164 | QString messageText(QLatin1String("Failure!")); | - | ||||||||||||||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||||||||||||||
| 166 | if (file)
| 34-502 | ||||||||||||||||||||||||||||||||||||
| 167 | messageText += QString(QLatin1String(" |[Loc: %1(%2)|]")).arg(QString::fromUtf8(file)).arg(line); executed 502 times by 1 test: messageText += QString(QLatin1String(" |[Loc: %1(%2)|]")).arg(QString::fromUtf8(file)).arg(line);Executed by:
| 502 | ||||||||||||||||||||||||||||||||||||
| 168 | - | |||||||||||||||||||||||||||||||||||||
| 169 | buf = QString(QLatin1String("##teamcity[testFailed name='%1' message='%2' details='%3']\n")) | - | ||||||||||||||||||||||||||||||||||||
| 170 | .arg(tmpFuncName) | - | ||||||||||||||||||||||||||||||||||||
| 171 | .arg(messageText) | - | ||||||||||||||||||||||||||||||||||||
| 172 | .arg(detailedText); | - | ||||||||||||||||||||||||||||||||||||
| 173 | - | |||||||||||||||||||||||||||||||||||||
| 174 | outputString(qPrintable(buf)); | - | ||||||||||||||||||||||||||||||||||||
| 175 | } executed 536 times by 1 test: end of blockExecuted by:
| 536 | ||||||||||||||||||||||||||||||||||||
| 176 | - | |||||||||||||||||||||||||||||||||||||
| 177 | if (!pendingMessages.isEmpty()) {
| 378-1045 | ||||||||||||||||||||||||||||||||||||
| 178 | buf = QString(QLatin1String("##teamcity[testStdOut name='%1' out='%2']\n")) | - | ||||||||||||||||||||||||||||||||||||
| 179 | .arg(tmpFuncName) | - | ||||||||||||||||||||||||||||||||||||
| 180 | .arg(pendingMessages); | - | ||||||||||||||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||||||||||||||
| 182 | outputString(qPrintable(buf)); | - | ||||||||||||||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||||||||||||||
| 184 | pendingMessages.clear(); | - | ||||||||||||||||||||||||||||||||||||
| 185 | } executed 378 times by 1 test: end of blockExecuted by:
| 378 | ||||||||||||||||||||||||||||||||||||
| 186 | - | |||||||||||||||||||||||||||||||||||||
| 187 | buf = QString(QLatin1String("##teamcity[testFinished name='%1']\n")).arg(tmpFuncName); | - | ||||||||||||||||||||||||||||||||||||
| 188 | outputString(qPrintable(buf)); | - | ||||||||||||||||||||||||||||||||||||
| 189 | } executed 1423 times by 1 test: end of blockExecuted by:
| 1423 | ||||||||||||||||||||||||||||||||||||
| 190 | - | |||||||||||||||||||||||||||||||||||||
| 191 | void QTeamCityLogger::addBenchmarkResult(const QBenchmarkResult &) | - | ||||||||||||||||||||||||||||||||||||
| 192 | { | - | ||||||||||||||||||||||||||||||||||||
| 193 | // don't print anything | - | ||||||||||||||||||||||||||||||||||||
| 194 | } | - | ||||||||||||||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||||||||||||||
| 196 | void QTeamCityLogger::addMessage(MessageTypes type, const QString &message, | - | ||||||||||||||||||||||||||||||||||||
| 197 | const char *file, int line) | - | ||||||||||||||||||||||||||||||||||||
| 198 | { | - | ||||||||||||||||||||||||||||||||||||
| 199 | // suppress non-fatal messages in silent mode | - | ||||||||||||||||||||||||||||||||||||
| 200 |
| 0-10833 | ||||||||||||||||||||||||||||||||||||
| 201 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||||||||||||||
| 203 | QString escapedMessage = tcEscapedString(message); | - | ||||||||||||||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||||||||||||||
| 205 | QString buf; | - | ||||||||||||||||||||||||||||||||||||
| 206 | - | |||||||||||||||||||||||||||||||||||||
| 207 | if (type == QAbstractTestLogger::Skip) {
| 185-10658 | ||||||||||||||||||||||||||||||||||||
| 208 | if (file)
| 0-185 | ||||||||||||||||||||||||||||||||||||
| 209 | escapedMessage.append(QString(QLatin1String(" |[Loc: %1(%2)|]")).arg(QString::fromUtf8(file)).arg(line)); executed 185 times by 1 test: escapedMessage.append(QString(QLatin1String(" |[Loc: %1(%2)|]")).arg(QString::fromUtf8(file)).arg(line));Executed by:
| 185 | ||||||||||||||||||||||||||||||||||||
| 210 | - | |||||||||||||||||||||||||||||||||||||
| 211 | buf = QString(QLatin1String("##teamcity[testIgnored name='%1' message='%2']\n")) | - | ||||||||||||||||||||||||||||||||||||
| 212 | .arg(escapedTestFuncName()) | - | ||||||||||||||||||||||||||||||||||||
| 213 | .arg(escapedMessage); | - | ||||||||||||||||||||||||||||||||||||
| 214 | - | |||||||||||||||||||||||||||||||||||||
| 215 | outputString(qPrintable(buf)); | - | ||||||||||||||||||||||||||||||||||||
| 216 | } executed 185 times by 1 test: end of blockExecuted by:
| 185 | ||||||||||||||||||||||||||||||||||||
| 217 | else { | - | ||||||||||||||||||||||||||||||||||||
| 218 | addPendingMessage(QTest::messageType2String(type), escapedMessage, file, line); | - | ||||||||||||||||||||||||||||||||||||
| 219 | } executed 10658 times by 1 test: end of blockExecuted by:
| 10658 | ||||||||||||||||||||||||||||||||||||
| 220 | } | - | ||||||||||||||||||||||||||||||||||||
| 221 | - | |||||||||||||||||||||||||||||||||||||
| 222 | QString QTeamCityLogger::tcEscapedString(const QString &str) const | - | ||||||||||||||||||||||||||||||||||||
| 223 | { | - | ||||||||||||||||||||||||||||||||||||
| 224 | QString formattedString; | - | ||||||||||||||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||||||||||||||
| 226 | for (int i = 0; i < str.length(); i++) {
| 14241-144034 | ||||||||||||||||||||||||||||||||||||
| 227 | QChar ch = str.at(i); | - | ||||||||||||||||||||||||||||||||||||
| 228 | - | |||||||||||||||||||||||||||||||||||||
| 229 | switch (ch.toLatin1()) { | - | ||||||||||||||||||||||||||||||||||||
| 230 | case '\n': executed 380 times by 1 test: case '\n':Executed by:
| 380 | ||||||||||||||||||||||||||||||||||||
| 231 | formattedString.append(QLatin1Literal("|n")); | - | ||||||||||||||||||||||||||||||||||||
| 232 | break; executed 380 times by 1 test: break;Executed by:
| 380 | ||||||||||||||||||||||||||||||||||||
| 233 | case '\r': never executed: case '\r': | 0 | ||||||||||||||||||||||||||||||||||||
| 234 | formattedString.append(QLatin1Literal("|r")); | - | ||||||||||||||||||||||||||||||||||||
| 235 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 236 | case '|': never executed: case '|': | 0 | ||||||||||||||||||||||||||||||||||||
| 237 | formattedString.append(QLatin1Literal("||")); | - | ||||||||||||||||||||||||||||||||||||
| 238 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 239 | case '[': executed 10 times by 1 test: case '[':Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
| 240 | formattedString.append(QLatin1Literal("|[")); | - | ||||||||||||||||||||||||||||||||||||
| 241 | break; executed 10 times by 1 test: break;Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
| 242 | case ']': executed 130 times by 1 test: case ']':Executed by:
| 130 | ||||||||||||||||||||||||||||||||||||
| 243 | formattedString.append(QLatin1Literal("|]")); | - | ||||||||||||||||||||||||||||||||||||
| 244 | break; executed 130 times by 1 test: break;Executed by:
| 130 | ||||||||||||||||||||||||||||||||||||
| 245 | case '\'': executed 420 times by 1 test: case '\'':Executed by:
| 420 | ||||||||||||||||||||||||||||||||||||
| 246 | formattedString.append(QLatin1Literal("|'")); | - | ||||||||||||||||||||||||||||||||||||
| 247 | break; executed 420 times by 1 test: break;Executed by:
| 420 | ||||||||||||||||||||||||||||||||||||
| 248 | default: executed 143094 times by 1 test: default:Executed by:
| 143094 | ||||||||||||||||||||||||||||||||||||
| 249 | formattedString.append(ch); | - | ||||||||||||||||||||||||||||||||||||
| 250 | } executed 143094 times by 1 test: end of blockExecuted by:
| 143094 | ||||||||||||||||||||||||||||||||||||
| 251 | } | - | ||||||||||||||||||||||||||||||||||||
| 252 | - | |||||||||||||||||||||||||||||||||||||
| 253 | return qMove(formattedString).simplified(); executed 14241 times by 1 test: return std::move(formattedString).simplified();Executed by:
| 14241 | ||||||||||||||||||||||||||||||||||||
| 254 | } | - | ||||||||||||||||||||||||||||||||||||
| 255 | - | |||||||||||||||||||||||||||||||||||||
| 256 | QString QTeamCityLogger::escapedTestFuncName() const | - | ||||||||||||||||||||||||||||||||||||
| 257 | { | - | ||||||||||||||||||||||||||||||||||||
| 258 | const char *fn = QTestResult::currentTestFunction() ? QTestResult::currentTestFunction()
| 0-1683 | ||||||||||||||||||||||||||||||||||||
| 259 | : "UnknownTestFunc"; | - | ||||||||||||||||||||||||||||||||||||
| 260 | const char *tag = QTestResult::currentDataTag() ? QTestResult::currentDataTag() : "";
| 613-1070 | ||||||||||||||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||||||||||||||
| 262 | QString str = QString(QLatin1String("%1(%2)")).arg(QString::fromUtf8(fn)).arg(QString::fromUtf8(tag)); | - | ||||||||||||||||||||||||||||||||||||
| 263 | str = tcEscapedString(str); | - | ||||||||||||||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||||||||||||||
| 265 | return str; executed 1683 times by 1 test: return str;Executed by:
| 1683 | ||||||||||||||||||||||||||||||||||||
| 266 | } | - | ||||||||||||||||||||||||||||||||||||
| 267 | - | |||||||||||||||||||||||||||||||||||||
| 268 | void QTeamCityLogger::addPendingMessage(const char *type, const QString &msg, const char *file, int line) | - | ||||||||||||||||||||||||||||||||||||
| 269 | { | - | ||||||||||||||||||||||||||||||||||||
| 270 | QString pendMessage; | - | ||||||||||||||||||||||||||||||||||||
| 271 | - | |||||||||||||||||||||||||||||||||||||
| 272 | if (!pendingMessages.isEmpty())
| 378-10355 | ||||||||||||||||||||||||||||||||||||
| 273 | pendMessage += QLatin1String("|n"); executed 10355 times by 1 test: pendMessage += QLatin1String("|n");Executed by:
| 10355 | ||||||||||||||||||||||||||||||||||||
| 274 | - | |||||||||||||||||||||||||||||||||||||
| 275 | if (file) {
| 205-10528 | ||||||||||||||||||||||||||||||||||||
| 276 | pendMessage += QString(QLatin1String("%1 |[Loc: %2(%3)|]: %4")) | - | ||||||||||||||||||||||||||||||||||||
| 277 | .arg(QString::fromUtf8(type)) | - | ||||||||||||||||||||||||||||||||||||
| 278 | .arg(QString::fromUtf8(file)) | - | ||||||||||||||||||||||||||||||||||||
| 279 | .arg(line) | - | ||||||||||||||||||||||||||||||||||||
| 280 | .arg(msg); | - | ||||||||||||||||||||||||||||||||||||
| 281 | - | |||||||||||||||||||||||||||||||||||||
| 282 | } executed 205 times by 1 test: end of blockExecuted by:
| 205 | ||||||||||||||||||||||||||||||||||||
| 283 | else { | - | ||||||||||||||||||||||||||||||||||||
| 284 | pendMessage += QString(QLatin1String("%1: %2")) | - | ||||||||||||||||||||||||||||||||||||
| 285 | .arg(QString::fromUtf8(type)) | - | ||||||||||||||||||||||||||||||||||||
| 286 | .arg(msg); | - | ||||||||||||||||||||||||||||||||||||
| 287 | } executed 10528 times by 1 test: end of blockExecuted by:
| 10528 | ||||||||||||||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||||||||||||||
| 289 | pendingMessages.append(pendMessage); | - | ||||||||||||||||||||||||||||||||||||
| 290 | } executed 10733 times by 1 test: end of blockExecuted by:
| 10733 | ||||||||||||||||||||||||||||||||||||
| 291 | - | |||||||||||||||||||||||||||||||||||||
| 292 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |