Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
40 | #include <QtTest/private/qabstracttestlogger_p.h> | - |
41 | #include <QtTest/qtestassert.h> | - |
42 | | - |
43 | #include <QtCore/qbytearray.h> | - |
44 | | - |
45 | #include <stdio.h> | - |
46 | #include <stdlib.h> | - |
47 | #include <stdarg.h> | - |
48 | | - |
49 | #ifndef Q_OS_WIN | - |
50 | #include <unistd.h> | - |
51 | #endif | - |
52 | | - |
53 | #ifdef Q_OS_ANDROID | - |
54 | #include <sys/stat.h> | - |
55 | #endif | - |
56 | | - |
57 | QT_BEGIN_NAMESPACE | - |
58 | | - |
59 | QAbstractTestLogger::QAbstractTestLogger(const char *filename) | - |
60 | { | - |
61 | if (!filename) {TRUE | evaluated 984 times by 506 testsEvaluated by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
| FALSE | evaluated 609 times by 1 testEvaluated by:- tst_selftests - unknown status
|
| 609-984 |
62 | stream = stdout; | - |
63 | return;executed 984 times by 506 tests: return; Executed by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
| 984 |
64 | } | - |
65 | #if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE) | - |
66 | if (::fopen_s(&stream, filename, "wt")) { | - |
67 | #else | - |
68 | stream = ::fopen(filename, "wt"); | - |
69 | if (!stream) {TRUE | never evaluated | FALSE | evaluated 609 times by 1 testEvaluated by:- tst_selftests - unknown status
|
| 0-609 |
70 | #endif | - |
71 | fprintf(stderr, "Unable to open file for logging: %s\n", filename); | - |
72 | ::exit(1); never executed: ::exit(1); | 0 |
73 | } | - |
74 | #ifdef Q_OS_ANDROID | - |
75 | else { | - |
76 | | - |
77 | ::chmod(filename, 0666); | - |
78 | } | - |
79 | #endif | - |
80 | }executed 609 times by 1 test: end of block Executed by:- tst_selftests - unknown status
| 609 |
81 | | - |
82 | QAbstractTestLogger::~QAbstractTestLogger() | - |
83 | { | - |
84 | QTEST_ASSERT(stream); never executed: qt_assert("stream",__FILE__,84); TRUE | never evaluated | FALSE | evaluated 1589 times by 506 testsEvaluated by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
|
| 0-1589 |
85 | if (stream != stdout) {TRUE | evaluated 609 times by 1 testEvaluated by:- tst_selftests - unknown status
| FALSE | evaluated 980 times by 506 testsEvaluated by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
|
| 609-980 |
86 | fclose(stream); | - |
87 | }executed 609 times by 1 test: end of block Executed by:- tst_selftests - unknown status
| 609 |
88 | stream = 0; | - |
89 | }executed 1589 times by 506 tests: end of block Executed by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
| 1589 |
90 | | - |
91 | void QAbstractTestLogger::filterUnprintable(char *str) const | - |
92 | { | - |
93 | unsigned char *idx = reinterpret_cast<unsigned char *>(str); | - |
94 | while (*idx) {TRUE | evaluated 14567145 times by 507 testsEvaluated by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
| FALSE | evaluated 379494 times by 507 testsEvaluated by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
|
| 379494-14567145 |
95 | if (((*idx < 0x20 && *idx != '\n' && *idx != '\t') || *idx == 0x7f))TRUE | evaluated 295858 times by 507 testsEvaluated by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
| FALSE | evaluated 14271287 times by 507 testsEvaluated by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
|
TRUE | evaluated 43 times by 7 testsEvaluated by:- tst_PlatformSocketEngine
- tst_QGraphicsScene
- tst_QHttpSocketEngine
- tst_QString
- tst_QStringRef
- tst_QTcpSocket
- tst_QUdpSocket
| FALSE | evaluated 295815 times by 507 testsEvaluated by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
|
TRUE | never evaluated | FALSE | evaluated 43 times by 7 testsEvaluated by:- tst_PlatformSocketEngine
- tst_QGraphicsScene
- tst_QHttpSocketEngine
- tst_QString
- tst_QStringRef
- tst_QTcpSocket
- tst_QUdpSocket
|
TRUE | never evaluated | FALSE | evaluated 14567145 times by 507 testsEvaluated by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
|
| 0-14567145 |
96 | *idx = '?'; never executed: *idx = '?'; | 0 |
97 | ++idx; | - |
98 | }executed 14567145 times by 507 tests: end of block Executed by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
| 14567145 |
99 | }executed 379494 times by 507 tests: end of block Executed by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
| 379494 |
100 | | - |
101 | void QAbstractTestLogger::outputString(const char *msg) | - |
102 | { | - |
103 | QTEST_ASSERT(stream); never executed: qt_assert("stream",__FILE__,103); TRUE | never evaluated | FALSE | evaluated 379494 times by 507 testsEvaluated by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
|
| 0-379494 |
104 | QTEST_ASSERT(msg); never executed: qt_assert("msg",__FILE__,104); TRUE | never evaluated | FALSE | evaluated 379494 times by 507 testsEvaluated by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
|
| 0-379494 |
105 | | - |
106 | char *filtered = new char[strlen(msg) + 1]; | - |
107 | strcpy(filtered, msg); | - |
108 | filterUnprintable(filtered); | - |
109 | | - |
110 | ::fputs(filtered, stream); | - |
111 | ::fflush(stream); | - |
112 | | - |
113 | delete [] filtered; | - |
114 | }executed 379494 times by 507 tests: end of block Executed by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
| 379494 |
115 | | - |
116 | void QAbstractTestLogger::startLogging() | - |
117 | { | - |
118 | } | - |
119 | | - |
120 | void QAbstractTestLogger::stopLogging() | - |
121 | { | - |
122 | } | - |
123 | | - |
124 | namespace QTest | - |
125 | { | - |
126 | | - |
127 | extern void filter_unprintable(char *str); | - |
128 | | - |
129 | | - |
130 | | - |
131 | | - |
132 | | - |
133 | int qt_asprintf(QTestCharBuffer *str, const char *format, ...) | - |
134 | { | - |
135 | static const int MAXSIZE = 1024*1024*2; | - |
136 | | - |
137 | Q_ASSERT(str); | - |
138 | | - |
139 | int size = str->size(); | - |
140 | | - |
141 | va_list ap; | - |
142 | int res = 0; | - |
143 | | - |
144 | for (;;) { | - |
145 | va_start(ap, format); | - |
146 | res = qvsnprintf(str->data(), size, format, ap); | - |
147 | va_end(ap); | - |
148 | str->data()[size - 1] = '\0'; | - |
149 | if (res >= 0 && res < size) {TRUE | evaluated 292348 times by 507 testsEvaluated by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
| FALSE | never evaluated |
TRUE | evaluated 292170 times by 507 testsEvaluated by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
| FALSE | evaluated 178 times by 5 testsEvaluated by:- tst_NetworkSelfTest
- tst_QDBusInterface
- tst_QOpenGlConfig
- tst_QSslSocket
- tst_selftests - unknown status
|
| 0-292348 |
150 | | - |
151 | break;executed 292170 times by 507 tests: break; Executed by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
| 292170 |
152 | } | - |
153 | | - |
154 | | - |
155 | size *= 2; | - |
156 | if (size > MAXSIZE) {TRUE | never evaluated | FALSE | evaluated 178 times by 5 testsEvaluated by:- tst_NetworkSelfTest
- tst_QDBusInterface
- tst_QOpenGlConfig
- tst_QSslSocket
- tst_selftests - unknown status
|
| 0-178 |
157 | break; never executed: break; | 0 |
158 | } | - |
159 | if (!str->reset(size))TRUE | never evaluated | FALSE | evaluated 178 times by 5 testsEvaluated by:- tst_NetworkSelfTest
- tst_QDBusInterface
- tst_QOpenGlConfig
- tst_QSslSocket
- tst_selftests - unknown status
|
| 0-178 |
160 | break; never executed: break; | 0 |
161 | }executed 178 times by 5 tests: end of block Executed by:- tst_NetworkSelfTest
- tst_QDBusInterface
- tst_QOpenGlConfig
- tst_QSslSocket
- tst_selftests - unknown status
| 178 |
162 | | - |
163 | return res;executed 292170 times by 507 tests: return res; Executed by:- tst_Collections
- tst_Compiler
- tst_Gestures
- tst_Lancelot
- tst_LargeFile
- tst_ModelTest
- tst_NetworkSelfTest
- tst_PlatformSocketEngine
- tst_QAbstractAnimation
- tst_QAbstractButton
- tst_QAbstractFileEngine
- tst_QAbstractItemModel
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractPrintDialog
- tst_QAbstractProxyModel
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSocket
- tst_QAbstractSpinBox
- tst_QAbstractTextDocumentLayout
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QAlgorithms
- ...
| 292170 |
164 | } | - |
165 | | - |
166 | } | - |
167 | | - |
168 | QT_END_NAMESPACE | - |
| | |