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 | #include <QtTest/private/qabstracttestlogger_p.h> | - |
35 | #include <QtTest/qtestassert.h> | - |
36 | | - |
37 | #include <QtCore/qbytearray.h> | - |
38 | | - |
39 | #include <stdio.h> | - |
40 | #include <stdlib.h> | - |
41 | #include <stdarg.h> | - |
42 | | - |
43 | #ifndef Q_OS_WIN | - |
44 | #include <unistd.h> | - |
45 | #endif | - |
46 | | - |
47 | #ifdef Q_OS_ANDROID | - |
48 | #include <sys/stat.h> | - |
49 | #endif | - |
50 | | - |
51 | QT_BEGIN_NAMESPACE | - |
52 | | - |
53 | QAbstractTestLogger::QAbstractTestLogger(const char *filename) | - |
54 | { | - |
55 | if (!filename) {TRUE | evaluated 959 times by 539 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 521 times by 1 testEvaluated by:- tst_selftests - unknown status
|
| 521-959 |
56 | stream = stdout; | - |
57 | return;executed 959 times by 539 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
- ...
| 959 |
58 | } | - |
59 | #if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE) | - |
60 | if (::fopen_s(&stream, filename, "wt")) { | - |
61 | #else | - |
62 | stream = ::fopen(filename, "wt"); | - |
63 | if (!stream) {TRUE | never evaluated | FALSE | evaluated 521 times by 1 testEvaluated by:- tst_selftests - unknown status
|
| 0-521 |
64 | #endif | - |
65 | fprintf(stderr, "Unable to open file for logging: %s\n", filename); | - |
66 | ::exit(1); never executed: ::exit(1); | 0 |
67 | } | - |
68 | #ifdef Q_OS_ANDROID | - |
69 | else { | - |
70 | | - |
71 | ::chmod(filename, 0666); | - |
72 | } | - |
73 | #endif | - |
74 | }executed 521 times by 1 test: end of block Executed by:- tst_selftests - unknown status
| 521 |
75 | | - |
76 | QAbstractTestLogger::~QAbstractTestLogger() | - |
77 | { | - |
78 | QTEST_ASSERT(stream); never executed: qt_assert("stream",__FILE__,78); TRUE | never evaluated | FALSE | evaluated 1476 times by 539 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-1476 |
79 | if (stream != stdout) {TRUE | evaluated 521 times by 1 testEvaluated by:- tst_selftests - unknown status
| FALSE | evaluated 955 times by 539 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
- ...
|
| 521-955 |
80 | fclose(stream); | - |
81 | }executed 521 times by 1 test: end of block Executed by:- tst_selftests - unknown status
| 521 |
82 | stream = 0; | - |
83 | }executed 1476 times by 539 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
- ...
| 1476 |
84 | | - |
85 | void QAbstractTestLogger::filterUnprintable(char *str) const | - |
86 | { | - |
87 | unsigned char *idx = reinterpret_cast<unsigned char *>(str); | - |
88 | while (*idx) {TRUE | evaluated 14388855 times by 540 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 379916 times by 540 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
- ...
|
| 379916-14388855 |
89 | if (((*idx < 0x20 && *idx != '\n' && *idx != '\t') || *idx == 0x7f))TRUE | evaluated 296251 times by 540 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 14092604 times by 540 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 296208 times by 540 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 14388855 times by 540 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-14388855 |
90 | *idx = '?'; never executed: *idx = '?'; | 0 |
91 | ++idx; | - |
92 | }executed 14388855 times by 540 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
- ...
| 14388855 |
93 | }executed 379916 times by 540 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
- ...
| 379916 |
94 | | - |
95 | void QAbstractTestLogger::outputString(const char *msg) | - |
96 | { | - |
97 | QTEST_ASSERT(stream); never executed: qt_assert("stream",__FILE__,97); TRUE | never evaluated | FALSE | evaluated 379916 times by 540 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-379916 |
98 | QTEST_ASSERT(msg); never executed: qt_assert("msg",__FILE__,98); TRUE | never evaluated | FALSE | evaluated 379916 times by 540 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-379916 |
99 | | - |
100 | char *filtered = new char[strlen(msg) + 1]; | - |
101 | strcpy(filtered, msg); | - |
102 | filterUnprintable(filtered); | - |
103 | | - |
104 | ::fputs(filtered, stream); | - |
105 | ::fflush(stream); | - |
106 | | - |
107 | delete [] filtered; | - |
108 | }executed 379916 times by 540 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
- ...
| 379916 |
109 | | - |
110 | void QAbstractTestLogger::startLogging() | - |
111 | { | - |
112 | } | - |
113 | | - |
114 | void QAbstractTestLogger::stopLogging() | - |
115 | { | - |
116 | } | - |
117 | | - |
118 | namespace QTest | - |
119 | { | - |
120 | | - |
121 | extern void filter_unprintable(char *str); | - |
122 | | - |
123 | | - |
124 | | - |
125 | | - |
126 | | - |
127 | int qt_asprintf(QTestCharBuffer *str, const char *format, ...) | - |
128 | { | - |
129 | static const int MAXSIZE = 1024*1024*2; | - |
130 | | - |
131 | Q_ASSERT(str); | - |
132 | | - |
133 | int size = str->size(); | - |
134 | | - |
135 | va_list ap; | - |
136 | int res = 0; | - |
137 | | - |
138 | for (;;) { | - |
139 | va_start(ap, format); | - |
140 | res = qvsnprintf(str->data(), size, format, ap); | - |
141 | va_end(ap); | - |
142 | str->data()[size - 1] = '\0'; | - |
143 | if (res >= 0 && res < size) {TRUE | evaluated 297048 times by 540 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 296870 times by 540 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-297048 |
144 | | - |
145 | break;executed 296870 times by 540 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
- ...
| 296870 |
146 | } | - |
147 | | - |
148 | | - |
149 | size *= 2; | - |
150 | 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 |
151 | break; never executed: break; | 0 |
152 | } | - |
153 | 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 |
154 | break; never executed: break; | 0 |
155 | }executed 178 times by 5 tests: end of block Executed by:- tst_NetworkSelfTest
- tst_QDBusInterface
- tst_QOpenGlConfig
- tst_QSslSocket
- tst_selftests - unknown status
| 178 |
156 | | - |
157 | return res;executed 296870 times by 540 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
- ...
| 296870 |
158 | } | - |
159 | | - |
160 | } | - |
161 | | - |
162 | QT_END_NAMESPACE | - |
| | |