qtestlog.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
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 Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include <QtTest/qtestassert.h> -
43 -
44#include <QtTest/private/qtestlog_p.h> -
45#include <QtTest/private/qtestresult_p.h> -
46#include <QtTest/private/qabstracttestlogger_p.h> -
47#include <QtTest/private/qplaintestlogger_p.h> -
48#include <QtTest/private/qxunittestlogger_p.h> -
49#include <QtTest/private/qxmltestlogger_p.h> -
50#include <QtCore/qatomic.h> -
51#include <QtCore/qbytearray.h> -
52 -
53#include <stdlib.h> -
54#include <string.h> -
55#include <limits.h> -
56 -
57QT_BEGIN_NAMESPACE -
58 -
59static void saveCoverageTool(const char * appname, bool testfailed, bool installedTestCoverage) -
60{ -
61#ifdef __COVERAGESCANNER__ -
62 if (!installedTestCoverage)
partially evaluated: !installedTestCoverage
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:396
0-396
63 return;
never executed: return;
0
64 // install again to make sure the filename is correct. -
65 // without this, a plugin or similar may have changed the filename. -
66 __coveragescanner_install(appname);
executed (the execution status of this line is deduced): __coveragescanner_install(appname);
-
67 __coveragescanner_teststate(testfailed ? "FAILED" : "PASSED");
executed (the execution status of this line is deduced): __coveragescanner_teststate(testfailed ? "FAILED" : "PASSED");
-
68 __coveragescanner_save();
executed (the execution status of this line is deduced): __coveragescanner_save();
-
69 __coveragescanner_testname("");
executed (the execution status of this line is deduced): __coveragescanner_testname("");
-
70 __coveragescanner_clear();
executed (the execution status of this line is deduced): __coveragescanner_clear();
-
71 unsetenv("QT_TESTCOCOON_ACTIVE");
executed (the execution status of this line is deduced): unsetenv("QT_TESTCOCOON_ACTIVE");
-
72#else -
73 Q_UNUSED(appname); -
74 Q_UNUSED(testfailed); -
75 Q_UNUSED(installedTestCoverage); -
76#endif -
77}
executed: }
Execution Count:399
399
78 -
79// -
80// declare deprecated API from qlogging.h locally -
81// (we can't use qInstallMessageHandler because it would break -
82// tests that (still) rely on qInstallMsgHandler.) -
83// -
84typedef void (*QtMsgHandler)(QtMsgType, const char *); -
85Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler); -
86 -
87namespace QTest { -
88 -
89 int fails = 0; -
90 int passes = 0; -
91 int skips = 0; -
92 -
93 struct IgnoreResultList -
94 { -
95 inline IgnoreResultList(QtMsgType tp, const char *message) -
96 : type(tp), next(0) -
97 { msg = qstrdup(message); }
executed: }
Execution Count:469
469
98 inline ~IgnoreResultList() -
99 { delete [] msg; }
executed: }
Execution Count:469
469
100 -
101 static inline void clearList(IgnoreResultList *&list) -
102 { -
103 while (list) {
partially evaluated: list
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:67229
0-67229
104 IgnoreResultList *current = list;
never executed (the execution status of this line is deduced): IgnoreResultList *current = list;
-
105 list = list->next;
never executed (the execution status of this line is deduced): list = list->next;
-
106 delete current;
never executed (the execution status of this line is deduced): delete current;
-
107 }
never executed: }
0
108 }
executed: }
Execution Count:67229
67229
109 -
110 QtMsgType type; -
111 char *msg; -
112 IgnoreResultList *next; -
113 }; -
114 -
115 static IgnoreResultList *ignoreResultList = 0; -
116 -
117 struct LoggerList -
118 { -
119 QAbstractTestLogger *logger; -
120 LoggerList *next; -
121 }; -
122 -
123 class TestLoggers -
124 { -
125 public: -
126 static void addLogger(QAbstractTestLogger *logger) -
127 { -
128 LoggerList *l = new LoggerList;
executed (the execution status of this line is deduced): LoggerList *l = new LoggerList;
-
129 l->logger = logger;
executed (the execution status of this line is deduced): l->logger = logger;
-
130 l->next = loggers;
executed (the execution status of this line is deduced): l->next = loggers;
-
131 loggers = l;
executed (the execution status of this line is deduced): loggers = l;
-
132 }
executed: }
Execution Count:399
399
133 -
134 static void destroyLoggers() -
135 { -
136 while (loggers) {
evaluated: loggers
TRUEFALSE
yes
Evaluation Count:396
yes
Evaluation Count:396
396
137 LoggerList *l = loggers;
executed (the execution status of this line is deduced): LoggerList *l = loggers;
-
138 loggers = loggers->next;
executed (the execution status of this line is deduced): loggers = loggers->next;
-
139 delete l->logger;
executed (the execution status of this line is deduced): delete l->logger;
-
140 delete l;
executed (the execution status of this line is deduced): delete l;
-
141 }
executed: }
Execution Count:396
396
142 }
executed: }
Execution Count:396
396
143 -
144#define FOREACH_LOGGER(operation) \ -
145 LoggerList *l = loggers; \ -
146 while (l) { \ -
147 QAbstractTestLogger *logger = l->logger; \ -
148 Q_UNUSED(logger); \ -
149 operation; \ -
150 l = l->next; \ -
151 } -
152 -
153 static void startLogging() -
154 { -
155 FOREACH_LOGGER(logger->startLogging());
executed: }
Execution Count:399
evaluated: l
TRUEFALSE
yes
Evaluation Count:399
yes
Evaluation Count:399
399
156 }
executed: }
Execution Count:399
399
157 -
158 static void stopLogging() -
159 { -
160 FOREACH_LOGGER(logger->stopLogging());
executed: }
Execution Count:396
evaluated: l
TRUEFALSE
yes
Evaluation Count:396
yes
Evaluation Count:396
396
161 }
executed: }
Execution Count:396
396
162 -
163 static void enterTestFunction(const char *function) -
164 { -
165 FOREACH_LOGGER(logger->enterTestFunction(function));
executed: }
Execution Count:7610
evaluated: l
TRUEFALSE
yes
Evaluation Count:7610
yes
Evaluation Count:7610
7610
166 }
executed: }
Execution Count:7610
7610
167 -
168 static void leaveTestFunction() -
169 { -
170 FOREACH_LOGGER(logger->leaveTestFunction());
executed: }
Execution Count:7607
evaluated: l
TRUEFALSE
yes
Evaluation Count:7607
yes
Evaluation Count:7607
7607
171 }
executed: }
Execution Count:7607
7607
172 -
173 static void addIncident(QAbstractTestLogger::IncidentTypes type, const char *description, -
174 const char *file = 0, int line = 0) -
175 { -
176 FOREACH_LOGGER(logger->addIncident(type, description, file, line));
executed: }
Execution Count:67322
evaluated: l
TRUEFALSE
yes
Evaluation Count:67322
yes
Evaluation Count:67322
67322
177 }
executed: }
Execution Count:67322
67322
178 -
179 static void addBenchmarkResult(const QBenchmarkResult &result) -
180 { -
181 FOREACH_LOGGER(logger->addBenchmarkResult(result));
executed: }
Execution Count:8
evaluated: l
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:8
8
182 }
executed: }
Execution Count:8
8
183 -
184 static void addMessage(QAbstractTestLogger::MessageTypes type, const char *message, -
185 const char *file = 0, int line = 0) -
186 { -
187 FOREACH_LOGGER(logger->addMessage(type, message, file, line));
executed: }
Execution Count:1849
evaluated: l
TRUEFALSE
yes
Evaluation Count:1849
yes
Evaluation Count:1849
1849
188 }
executed: }
Execution Count:1849
1849
189 -
190 static void outputString(const char *msg) -
191 { -
192 FOREACH_LOGGER(logger->outputString(msg));
never executed: }
never evaluated: l
0
193 }
never executed: }
0
194 -
195 static int loggerCount() -
196 { -
197 int count = 0;
executed (the execution status of this line is deduced): int count = 0;
-
198 FOREACH_LOGGER(++count);
executed: }
Execution Count:2003
evaluated: l
TRUEFALSE
yes
Evaluation Count:2003
yes
Evaluation Count:2402
2003-2402
199 return count;
executed: return count;
Execution Count:2402
2402
200 } -
201 -
202 private: -
203 static LoggerList *loggers; -
204 }; -
205 -
206#undef FOREACH_LOGGER -
207 -
208 LoggerList *TestLoggers::loggers = 0; -
209 static bool loggerUsingStdout = false; -
210 -
211 static int verbosity = 0; -
212 static int maxWarnings = 2002; -
213 static bool installedTestCoverage = true; -
214 -
215 static QtMsgHandler oldMessageHandler; -
216 -
217 static bool handleIgnoredMessage(QtMsgType type, const char *msg) -
218 { -
219 IgnoreResultList *last = 0;
executed (the execution status of this line is deduced): IgnoreResultList *last = 0;
-
220 IgnoreResultList *list = ignoreResultList;
executed (the execution status of this line is deduced): IgnoreResultList *list = ignoreResultList;
-
221 while (list) {
evaluated: list
TRUEFALSE
yes
Evaluation Count:503
yes
Evaluation Count:1526
503-1526
222 if (list->type == type && strcmp(msg, list->msg) == 0) {
partially evaluated: list->type == type
TRUEFALSE
yes
Evaluation Count:503
no
Evaluation Count:0
evaluated: strcmp(msg, list->msg) == 0
TRUEFALSE
yes
Evaluation Count:469
yes
Evaluation Count:34
0-503
223 // remove the item from the list -
224 if (last)
partially evaluated: last
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:469
0-469
225 last->next = list->next;
never executed: last->next = list->next;
0
226 else if (list->next)
evaluated: list->next
TRUEFALSE
yes
Evaluation Count:70
yes
Evaluation Count:399
70-399
227 ignoreResultList = list->next;
executed: ignoreResultList = list->next;
Execution Count:70
70
228 else -
229 ignoreResultList = 0;
executed: ignoreResultList = 0;
Execution Count:399
399
230 -
231 delete list;
executed (the execution status of this line is deduced): delete list;
-
232 return true;
executed: return true;
Execution Count:469
469
233 } -
234 -
235 last = list;
executed (the execution status of this line is deduced): last = list;
-
236 list = list->next;
executed (the execution status of this line is deduced): list = list->next;
-
237 }
executed: }
Execution Count:34
34
238 return false;
executed: return false;
Execution Count:1526
1526
239 } -
240 -
241// don't warn about qInstallMsgHandler -
242#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL) -
243# pragma GCC diagnostic push -
244# pragma GCC diagnostic ignored "-Wdeprecated-declarations" -
245#endif -
246 -
247 static void messageHandler(QtMsgType type, const char *msg) -
248 { -
249 static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(QTest::maxWarnings); -
250 -
251 if (!msg || QTest::TestLoggers::loggerCount() == 0) {
partially evaluated: !msg
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1995
partially evaluated: QTest::TestLoggers::loggerCount() == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1995
0-1995
252 // if this goes wrong, something is seriously broken. -
253 qInstallMsgHandler(oldMessageHandler);
never executed (the execution status of this line is deduced): qInstallMsgHandler(oldMessageHandler);
-
254 QTEST_ASSERT(msg);
never executed: qt_assert("msg","qtestlog.cpp",254);
never executed: }
never evaluated: !(msg)
never evaluated: 0
0
255 QTEST_ASSERT(QTest::TestLoggers::loggerCount() != 0);
never executed: qt_assert("QTest::TestLoggers::loggerCount() != 0","qtestlog.cpp",255);
never executed: }
never evaluated: !(QTest::TestLoggers::loggerCount() != 0)
never evaluated: 0
0
256 }
never executed: }
0
257 -
258 if (handleIgnoredMessage(type, msg))
evaluated: handleIgnoredMessage(type, msg)
TRUEFALSE
yes
Evaluation Count:469
yes
Evaluation Count:1526
469-1526
259 // the message is expected, so just swallow it. -
260 return;
executed: return;
Execution Count:469
469
261 -
262 if (type != QtFatalMsg) {
evaluated: type != QtFatalMsg
TRUEFALSE
yes
Evaluation Count:1521
yes
Evaluation Count:5
5-1521
263 if (counter.load() <= 0)
partially evaluated: counter.load() <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1521
0-1521
264 return;
never executed: return;
0
265 -
266 if (!counter.deref()) {
partially evaluated: !counter.deref()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1521
0-1521
267 QTest::TestLoggers::addMessage(QAbstractTestLogger::QSystem,
never executed (the execution status of this line is deduced): QTest::TestLoggers::addMessage(QAbstractTestLogger::QSystem,
-
268 "Maximum amount of warnings exceeded. Use -maxwarnings to override.");
never executed (the execution status of this line is deduced): "Maximum amount of warnings exceeded. Use -maxwarnings to override.");
-
269 return;
never executed: return;
0
270 } -
271 }
executed: }
Execution Count:1521
1521
272 -
273 switch (type) { -
274 case QtDebugMsg: -
275 QTest::TestLoggers::addMessage(QAbstractTestLogger::QDebug, msg);
executed (the execution status of this line is deduced): QTest::TestLoggers::addMessage(QAbstractTestLogger::QDebug, msg);
-
276 break;
executed: break;
Execution Count:1076
1076
277 case QtCriticalMsg: -
278 QTest::TestLoggers::addMessage(QAbstractTestLogger::QSystem, msg);
never executed (the execution status of this line is deduced): QTest::TestLoggers::addMessage(QAbstractTestLogger::QSystem, msg);
-
279 break;
never executed: break;
0
280 case QtWarningMsg: -
281 QTest::TestLoggers::addMessage(QAbstractTestLogger::QWarning, msg);
executed (the execution status of this line is deduced): QTest::TestLoggers::addMessage(QAbstractTestLogger::QWarning, msg);
-
282 break;
executed: break;
Execution Count:445
445
283 case QtFatalMsg: -
284 QTest::TestLoggers::addMessage(QAbstractTestLogger::QFatal, msg);
executed (the execution status of this line is deduced): QTest::TestLoggers::addMessage(QAbstractTestLogger::QFatal, msg);
-
285 /* Right now, we're inside the custom message handler and we're -
286 * being qt_message_output in qglobal.cpp. After we return from -
287 * this function, it will proceed with calling exit() and abort() -
288 * and hence crash. Therefore, we call these logging functions such -
289 * that we wrap up nicely, and in particular produce well-formed XML. */ -
290 QTestResult::addFailure("Received a fatal error.", "Unknown file", 0);
executed (the execution status of this line is deduced): QTestResult::addFailure("Received a fatal error.", "Unknown file", 0);
-
291 QTestLog::leaveTestFunction();
executed (the execution status of this line is deduced): QTestLog::leaveTestFunction();
-
292 QTestLog::stopLogging();
executed (the execution status of this line is deduced): QTestLog::stopLogging();
-
293 break;
executed: break;
Execution Count:5
5
294 } -
295 }
executed: }
Execution Count:1526
1526
296 -
297#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL) -
298# pragma GCC diagnostic pop -
299#endif -
300} -
301 -
302void QTestLog::enterTestFunction(const char* function) -
303{ -
304 if (printAvailableTags)
partially evaluated: printAvailableTags
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7610
0-7610
305 return;
never executed: return;
0
306 -
307 QTEST_ASSERT(function);
never executed: qt_assert("function","qtestlog.cpp",307);
executed: }
Execution Count:7610
partially evaluated: !(function)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7610
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7610
0-7610
308 -
309 QTest::TestLoggers::enterTestFunction(function);
executed (the execution status of this line is deduced): QTest::TestLoggers::enterTestFunction(function);
-
310}
executed: }
Execution Count:7610
7610
311 -
312int QTestLog::unhandledIgnoreMessages() -
313{ -
314 int i = 0;
executed (the execution status of this line is deduced): int i = 0;
-
315 QTest::IgnoreResultList *list = QTest::ignoreResultList;
executed (the execution status of this line is deduced): QTest::IgnoreResultList *list = QTest::ignoreResultList;
-
316 while (list) {
partially evaluated: list
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:66997
0-66997
317 ++i;
never executed (the execution status of this line is deduced): ++i;
-
318 list = list->next;
never executed (the execution status of this line is deduced): list = list->next;
-
319 }
never executed: }
0
320 return i;
executed: return i;
Execution Count:66997
66997
321} -
322 -
323void QTestLog::leaveTestFunction() -
324{ -
325 if (printAvailableTags)
partially evaluated: printAvailableTags
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7607
0-7607
326 return;
never executed: return;
0
327 -
328 QTest::TestLoggers::leaveTestFunction();
executed (the execution status of this line is deduced): QTest::TestLoggers::leaveTestFunction();
-
329}
executed: }
Execution Count:7607
7607
330 -
331void QTestLog::printUnhandledIgnoreMessages() -
332{ -
333 char msg[1024];
never executed (the execution status of this line is deduced): char msg[1024];
-
334 QTest::IgnoreResultList *list = QTest::ignoreResultList;
never executed (the execution status of this line is deduced): QTest::IgnoreResultList *list = QTest::ignoreResultList;
-
335 while (list) {
never evaluated: list
0
336 qsnprintf(msg, 1024, "Did not receive message: \"%s\"", list->msg);
never executed (the execution status of this line is deduced): qsnprintf(msg, 1024, "Did not receive message: \"%s\"", list->msg);
-
337 QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, msg);
never executed (the execution status of this line is deduced): QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, msg);
-
338 -
339 list = list->next;
never executed (the execution status of this line is deduced): list = list->next;
-
340 }
never executed: }
0
341}
never executed: }
0
342 -
343void QTestLog::clearIgnoreMessages() -
344{ -
345 QTest::IgnoreResultList::clearList(QTest::ignoreResultList);
executed (the execution status of this line is deduced): QTest::IgnoreResultList::clearList(QTest::ignoreResultList);
-
346}
executed: }
Execution Count:67229
67229
347 -
348void QTestLog::addPass(const char *msg) -
349{ -
350 if (printAvailableTags)
partially evaluated: printAvailableTags
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:66746
0-66746
351 return;
never executed: return;
0
352 -
353 QTEST_ASSERT(msg);
never executed: qt_assert("msg","qtestlog.cpp",353);
executed: }
Execution Count:66746
partially evaluated: !(msg)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:66746
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:66746
0-66746
354 -
355 ++QTest::passes;
executed (the execution status of this line is deduced): ++QTest::passes;
-
356 -
357 QTest::TestLoggers::addIncident(QAbstractTestLogger::Pass, msg);
executed (the execution status of this line is deduced): QTest::TestLoggers::addIncident(QAbstractTestLogger::Pass, msg);
-
358}
executed: }
Execution Count:66746
66746
359 -
360void QTestLog::addFail(const char *msg, const char *file, int line) -
361{ -
362 QTEST_ASSERT(msg);
never executed: qt_assert("msg","qtestlog.cpp",362);
executed: }
Execution Count:237
partially evaluated: !(msg)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:237
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:237
0-237
363 -
364 ++QTest::fails;
executed (the execution status of this line is deduced): ++QTest::fails;
-
365 -
366 QTest::TestLoggers::addIncident(QAbstractTestLogger::Fail, msg, file, line);
executed (the execution status of this line is deduced): QTest::TestLoggers::addIncident(QAbstractTestLogger::Fail, msg, file, line);
-
367}
executed: }
Execution Count:237
237
368 -
369void QTestLog::addXFail(const char *msg, const char *file, int line) -
370{ -
371 QTEST_ASSERT(msg);
never executed: qt_assert("msg","qtestlog.cpp",371);
executed: }
Execution Count:339
partially evaluated: !(msg)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:339
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:339
0-339
372 QTEST_ASSERT(file);
never executed: qt_assert("file","qtestlog.cpp",372);
executed: }
Execution Count:339
partially evaluated: !(file)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:339
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:339
0-339
373 -
374 QTest::TestLoggers::addIncident(QAbstractTestLogger::XFail, msg, file, line);
executed (the execution status of this line is deduced): QTest::TestLoggers::addIncident(QAbstractTestLogger::XFail, msg, file, line);
-
375}
executed: }
Execution Count:339
339
376 -
377void QTestLog::addXPass(const char *msg, const char *file, int line) -
378{ -
379 QTEST_ASSERT(msg);
never executed: qt_assert("msg","qtestlog.cpp",379);
never executed: }
never evaluated: !(msg)
never evaluated: 0
0
380 QTEST_ASSERT(file);
never executed: qt_assert("file","qtestlog.cpp",380);
never executed: }
never evaluated: !(file)
never evaluated: 0
0
381 -
382 ++QTest::fails;
never executed (the execution status of this line is deduced): ++QTest::fails;
-
383 -
384 QTest::TestLoggers::addIncident(QAbstractTestLogger::XPass, msg, file, line);
never executed (the execution status of this line is deduced): QTest::TestLoggers::addIncident(QAbstractTestLogger::XPass, msg, file, line);
-
385}
never executed: }
0
386 -
387void QTestLog::addSkip(const char *msg, const char *file, int line) -
388{ -
389 QTEST_ASSERT(msg);
never executed: qt_assert("msg","qtestlog.cpp",389);
executed: }
Execution Count:315
partially evaluated: !(msg)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:315
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:315
0-315
390 QTEST_ASSERT(file);
never executed: qt_assert("file","qtestlog.cpp",390);
executed: }
Execution Count:315
partially evaluated: !(file)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:315
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:315
0-315
391 -
392 ++QTest::skips;
executed (the execution status of this line is deduced): ++QTest::skips;
-
393 -
394 QTest::TestLoggers::addMessage(QAbstractTestLogger::Skip, msg, file, line);
executed (the execution status of this line is deduced): QTest::TestLoggers::addMessage(QAbstractTestLogger::Skip, msg, file, line);
-
395}
executed: }
Execution Count:315
315
396 -
397void QTestLog::addBenchmarkResult(const QBenchmarkResult &result) -
398{ -
399 QTest::TestLoggers::addBenchmarkResult(result);
executed (the execution status of this line is deduced): QTest::TestLoggers::addBenchmarkResult(result);
-
400}
executed: }
Execution Count:8
8
401 -
402void QTestLog::startLogging() -
403{ -
404 QTest::TestLoggers::startLogging();
executed (the execution status of this line is deduced): QTest::TestLoggers::startLogging();
-
405 QTest::oldMessageHandler = qInstallMsgHandler(QTest::messageHandler);
executed (the execution status of this line is deduced): QTest::oldMessageHandler = qInstallMsgHandler(QTest::messageHandler);
-
406}
executed: }
Execution Count:399
399
407 -
408void QTestLog::stopLogging() -
409{ -
410 qInstallMsgHandler(QTest::oldMessageHandler);
executed (the execution status of this line is deduced): qInstallMsgHandler(QTest::oldMessageHandler);
-
411 QTest::TestLoggers::stopLogging();
executed (the execution status of this line is deduced): QTest::TestLoggers::stopLogging();
-
412 QTest::TestLoggers::destroyLoggers();
executed (the execution status of this line is deduced): QTest::TestLoggers::destroyLoggers();
-
413 QTest::loggerUsingStdout = false;
executed (the execution status of this line is deduced): QTest::loggerUsingStdout = false;
-
414 saveCoverageTool(QTestResult::currentAppname(), failCount() != 0, QTestLog::installedTestCoverage());
executed (the execution status of this line is deduced): saveCoverageTool(QTestResult::currentAppname(), failCount() != 0, QTestLog::installedTestCoverage());
-
415}
executed: }
Execution Count:399
399
416 -
417void QTestLog::addLogger(LogMode mode, const char *filename) -
418{ -
419 if (filename && strcmp(filename, "-") == 0)
partially evaluated: filename
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:399
never evaluated: strcmp(filename, "-") == 0
0-399
420 filename = 0;
never executed: filename = 0;
0
421 if (!filename)
partially evaluated: !filename
TRUEFALSE
yes
Evaluation Count:399
no
Evaluation Count:0
0-399
422 QTest::loggerUsingStdout = true;
executed: QTest::loggerUsingStdout = true;
Execution Count:399
399
423 -
424 QAbstractTestLogger *logger = 0;
executed (the execution status of this line is deduced): QAbstractTestLogger *logger = 0;
-
425 switch (mode) { -
426 case QTestLog::Plain: -
427 logger = new QPlainTestLogger(filename);
executed (the execution status of this line is deduced): logger = new QPlainTestLogger(filename);
-
428 break;
executed: break;
Execution Count:399
399
429 case QTestLog::XML: -
430 logger = new QXmlTestLogger(QXmlTestLogger::Complete, filename);
never executed (the execution status of this line is deduced): logger = new QXmlTestLogger(QXmlTestLogger::Complete, filename);
-
431 break;
never executed: break;
0
432 case QTestLog::LightXML: -
433 logger = new QXmlTestLogger(QXmlTestLogger::Light, filename);
never executed (the execution status of this line is deduced): logger = new QXmlTestLogger(QXmlTestLogger::Light, filename);
-
434 break;
never executed: break;
0
435 case QTestLog::XunitXML: -
436 logger = new QXunitTestLogger(filename);
never executed (the execution status of this line is deduced): logger = new QXunitTestLogger(filename);
-
437 break;
never executed: break;
0
438 } -
439 QTEST_ASSERT(logger);
never executed: qt_assert("logger","qtestlog.cpp",439);
executed: }
Execution Count:399
partially evaluated: !(logger)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:399
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:399
0-399
440 QTest::TestLoggers::addLogger(logger);
executed (the execution status of this line is deduced): QTest::TestLoggers::addLogger(logger);
-
441}
executed: }
Execution Count:399
399
442 -
443int QTestLog::loggerCount() -
444{ -
445 return QTest::TestLoggers::loggerCount();
executed: return QTest::TestLoggers::loggerCount();
Execution Count:399
399
446} -
447 -
448bool QTestLog::loggerUsingStdout() -
449{ -
450 return QTest::loggerUsingStdout;
never executed: return QTest::loggerUsingStdout;
0
451} -
452 -
453void QTestLog::warn(const char *msg, const char *file, int line) -
454{ -
455 QTEST_ASSERT(msg);
never executed: qt_assert("msg","qtestlog.cpp",455);
executed: }
Execution Count:8
partially evaluated: !(msg)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
456 -
457 if (QTest::TestLoggers::loggerCount() > 0)
partially evaluated: QTest::TestLoggers::loggerCount() > 0
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
458 QTest::TestLoggers::addMessage(QAbstractTestLogger::Warn, msg, file, line);
executed: QTest::TestLoggers::addMessage(QAbstractTestLogger::Warn, msg, file, line);
Execution Count:8
8
459}
executed: }
Execution Count:8
8
460 -
461void QTestLog::info(const char *msg, const char *file, int line) -
462{ -
463 QTEST_ASSERT(msg);
never executed: qt_assert("msg","qtestlog.cpp",463);
never executed: }
never evaluated: !(msg)
never evaluated: 0
0
464 -
465 QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, msg, file, line);
never executed (the execution status of this line is deduced): QTest::TestLoggers::addMessage(QAbstractTestLogger::Info, msg, file, line);
-
466}
never executed: }
0
467 -
468void QTestLog::setVerboseLevel(int level) -
469{ -
470 QTest::verbosity = level;
never executed (the execution status of this line is deduced): QTest::verbosity = level;
-
471}
never executed: }
0
472 -
473int QTestLog::verboseLevel() -
474{ -
475 return QTest::verbosity;
executed: return QTest::verbosity;
Execution Count:37002063
37002063
476} -
477 -
478void QTestLog::ignoreMessage(QtMsgType type, const char *msg) -
479{ -
480 QTEST_ASSERT(msg);
never executed: qt_assert("msg","qtestlog.cpp",480);
executed: }
Execution Count:469
partially evaluated: !(msg)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:469
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:469
0-469
481 -
482 QTest::IgnoreResultList *item = new QTest::IgnoreResultList(type, msg);
executed (the execution status of this line is deduced): QTest::IgnoreResultList *item = new QTest::IgnoreResultList(type, msg);
-
483 -
484 QTest::IgnoreResultList *list = QTest::ignoreResultList;
executed (the execution status of this line is deduced): QTest::IgnoreResultList *list = QTest::ignoreResultList;
-
485 if (!list) {
evaluated: !list
TRUEFALSE
yes
Evaluation Count:399
yes
Evaluation Count:70
70-399
486 QTest::ignoreResultList = item;
executed (the execution status of this line is deduced): QTest::ignoreResultList = item;
-
487 return;
executed: return;
Execution Count:399
399
488 } -
489 while (list->next)
evaluated: list->next
TRUEFALSE
yes
Evaluation Count:157
yes
Evaluation Count:70
70-157
490 list = list->next;
executed: list = list->next;
Execution Count:157
157
491 list->next = item;
executed (the execution status of this line is deduced): list->next = item;
-
492}
executed: }
Execution Count:70
70
493 -
494void QTestLog::setMaxWarnings(int m) -
495{ -
496 QTest::maxWarnings = m <= 0 ? INT_MAX : m + 2;
never evaluated: m <= 0
0
497}
never executed: }
0
498 -
499bool QTestLog::printAvailableTags = false; -
500 -
501void QTestLog::setPrintAvailableTagsMode() -
502{ -
503 printAvailableTags = true;
never executed (the execution status of this line is deduced): printAvailableTags = true;
-
504}
never executed: }
0
505 -
506int QTestLog::passCount() -
507{ -
508 return QTest::passes;
executed: return QTest::passes;
Execution Count:396
396
509} -
510 -
511int QTestLog::failCount() -
512{ -
513 return QTest::fails;
executed: return QTest::fails;
Execution Count:1186
1186
514} -
515 -
516int QTestLog::skipCount() -
517{ -
518 return QTest::skips;
executed: return QTest::skips;
Execution Count:396
396
519} -
520 -
521void QTestLog::resetCounters() -
522{ -
523 QTest::passes = 0;
never executed (the execution status of this line is deduced): QTest::passes = 0;
-
524 QTest::fails = 0;
never executed (the execution status of this line is deduced): QTest::fails = 0;
-
525 QTest::skips = 0;
never executed (the execution status of this line is deduced): QTest::skips = 0;
-
526}
never executed: }
0
527 -
528void QTestLog::setInstalledTestCoverage(bool installed) -
529{ -
530 QTest::installedTestCoverage = installed;
executed (the execution status of this line is deduced): QTest::installedTestCoverage = installed;
-
531}
executed: }
Execution Count:399
399
532 -
533bool QTestLog::installedTestCoverage() -
534{ -
535 return QTest::installedTestCoverage;
executed: return QTest::installedTestCoverage;
Execution Count:396
396
536} -
537 -
538QT_END_NAMESPACE -
539 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial