Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/testlib/qtestblacklist.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | static QSet<QByteArray> keywords() | - | ||||||||||||
6 | { | - | ||||||||||||
7 | - | |||||||||||||
8 | QSet<QByteArray> set = QSet<QByteArray>() | - | ||||||||||||
9 | << "*" | - | ||||||||||||
10 | - | |||||||||||||
11 | << "linux" | - | ||||||||||||
12 | << "64bit" | - | ||||||||||||
13 | - | |||||||||||||
14 | - | |||||||||||||
15 | - | |||||||||||||
16 | - | |||||||||||||
17 | - | |||||||||||||
18 | << "gcc" | - | ||||||||||||
19 | << "developer-build" | - | ||||||||||||
20 | - | |||||||||||||
21 | ; | - | ||||||||||||
22 | - | |||||||||||||
23 | QCoreApplication *app = QCoreApplication::instance(); | - | ||||||||||||
24 | if (app
| 0-2 | ||||||||||||
25 | const QVariant platformName = app->property("platformName"); | - | ||||||||||||
26 | if (platformName.isValid()
| 0-2 | ||||||||||||
27 | set never executed: << platformName.toByteArray();set << platformName.toByteArray(); never executed: set << platformName.toByteArray(); | 0 | ||||||||||||
28 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
29 | - | |||||||||||||
30 | return executed 2 times by 1 test: set;return set; Executed by:
executed 2 times by 1 test: return set; Executed by:
| 2 | ||||||||||||
31 | } | - | ||||||||||||
32 | - | |||||||||||||
33 | static QSet<QByteArray> activeConditions() | - | ||||||||||||
34 | { | - | ||||||||||||
35 | QSet<QByteArray> result = keywords(); | - | ||||||||||||
36 | - | |||||||||||||
37 | QByteArray distributionName = QSysInfo::productType().toLower().toUtf8(); | - | ||||||||||||
38 | QByteArray distributionRelease = QSysInfo::productVersion().toLower().toUtf8(); | - | ||||||||||||
39 | if (!distributionName.isEmpty()
| 0-2 | ||||||||||||
40 | if (result.find(distributionName) == result.end()
| 0-2 | ||||||||||||
41 | result.insert(distributionName); executed 2 times by 1 test: result.insert(distributionName); Executed by:
| 2 | ||||||||||||
42 | if (!distributionRelease.isEmpty()
| 0-2 | ||||||||||||
43 | QByteArray versioned = distributionName + "-" + distributionRelease; | - | ||||||||||||
44 | if (result.find(versioned) == result.end()
| 0-2 | ||||||||||||
45 | result.insert(versioned); executed 2 times by 1 test: result.insert(versioned); Executed by:
| 2 | ||||||||||||
46 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
47 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
48 | - | |||||||||||||
49 | if (qEnvironmentVariableIsSet("QTEST_ENVIRONMENT")
| 0-2 | ||||||||||||
50 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(qgetenv("QTEST_ENVIRONMENT").split(' '))>::type> _container_((qgetenv("QTEST_ENVIRONMENT").split(' '))); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QByteArray &k = *_container_.i; _container_.control; _container_.control = 0) | - | ||||||||||||
51 | result.insert(k); never executed: result.insert(k); | 0 | ||||||||||||
52 | } never executed: end of block | 0 | ||||||||||||
53 | - | |||||||||||||
54 | return executed 2 times by 1 test: result;return result; Executed by:
executed 2 times by 1 test: return result; Executed by:
| 2 | ||||||||||||
55 | } | - | ||||||||||||
56 | - | |||||||||||||
57 | static bool checkCondition(const QByteArray &condition) | - | ||||||||||||
58 | { | - | ||||||||||||
59 | static const QSet<QByteArray> matchedConditions = activeConditions(); | - | ||||||||||||
60 | QList<QByteArray> conds = condition.split(' '); | - | ||||||||||||
61 | - | |||||||||||||
62 | for (int i = 0; i < conds.size()
| 12 | ||||||||||||
63 | QByteArray c = conds.at(i); | - | ||||||||||||
64 | bool result = c.startsWith('!'); | - | ||||||||||||
65 | if (result
| 0-12 | ||||||||||||
66 | c = c.mid(1); never executed: c = c.mid(1); | 0 | ||||||||||||
67 | - | |||||||||||||
68 | result ^= matchedConditions.contains(c); | - | ||||||||||||
69 | if (!result
| 0-12 | ||||||||||||
70 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
71 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||
72 | return executed 12 times by 1 test: true;return true; Executed by:
executed 12 times by 1 test: return true; Executed by:
| 12 | ||||||||||||
73 | } | - | ||||||||||||
74 | - | |||||||||||||
75 | static bool ignoreAll = false; | - | ||||||||||||
76 | static std::set<QByteArray> *ignoredTests = 0; | - | ||||||||||||
77 | static std::set<QByteArray> *gpuFeatures = 0; | - | ||||||||||||
78 | - | |||||||||||||
79 | __attribute__((visibility("default"))) std::set<QByteArray> *(*qgpu_features_ptr)(const QString &) = 0; | - | ||||||||||||
80 | - | |||||||||||||
81 | static bool isGPUTestBlacklisted(const char *slot, const char *data = 0) | - | ||||||||||||
82 | { | - | ||||||||||||
83 | const QByteArray disableKey = ([]() -> QByteArray { enum { Size = sizeof("disable_") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "disable_" }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return never executed: ba;return ba; never executed: }()) + QByteArray(slot);return ba; | 0 | ||||||||||||
84 | if (gpuFeatures->find(disableKey) != gpuFeatures->end()
| 0 | ||||||||||||
85 | QByteArray msg = ([]() -> QByteArray { enum { Size = sizeof("Skipped due to GPU blacklist: ") - 1 }; static const QStaticByteArrayData<Size> qbytearray_literal = { { { { -1 } }, Size, 0, 0, sizeof(QByteArrayData) }, "Skipped due to GPU blacklist: " }; QByteArrayDataPtr holder = { qbytearray_literal.data_ptr() }; const QByteArray ba(holder); return never executed: ba;return ba; never executed: }()) + disableKey;return ba; | 0 | ||||||||||||
86 | if (data
| 0 | ||||||||||||
87 | msg += ':' + QByteArray(data); never executed: msg += ':' + QByteArray(data); | 0 | ||||||||||||
88 | QTest::qSkip(msg.constData(), __FILE__, 212); | - | ||||||||||||
89 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||
90 | } | - | ||||||||||||
91 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
92 | } | - | ||||||||||||
93 | - | |||||||||||||
94 | namespace QTestPrivate { | - | ||||||||||||
95 | - | |||||||||||||
96 | void parseBlackList() | - | ||||||||||||
97 | { | - | ||||||||||||
98 | QString filename = QTest::qFindTestData(([]() -> QString { enum { Size = sizeof(u"" "BLACKLIST")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "BLACKLIST" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 699 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 699 times by 1 test: }()));return qstring_literal_temp; Executed by:
| 699 | ||||||||||||
99 | if (filename.isEmpty()
| 2-697 | ||||||||||||
100 | return; executed 697 times by 1 test: return; Executed by:
| 697 | ||||||||||||
101 | QFile ignored(filename); | - | ||||||||||||
102 | if (!ignored.open(QIODevice::ReadOnly)
| 0-2 | ||||||||||||
103 | return; never executed: return; | 0 | ||||||||||||
104 | - | |||||||||||||
105 | QByteArray function; | - | ||||||||||||
106 | - | |||||||||||||
107 | while (!ignored.atEnd()
| 2-24 | ||||||||||||
108 | QByteArray line = ignored.readLine().simplified(); | - | ||||||||||||
109 | if (line.isEmpty()
| 0-24 | ||||||||||||
110 | continue; never executed: continue; | 0 | ||||||||||||
111 | if (line.startsWith('[')
| 12 | ||||||||||||
112 | function = line.mid(1, line.length() - 2); | - | ||||||||||||
113 | continue; executed 12 times by 1 test: continue; Executed by:
| 12 | ||||||||||||
114 | } | - | ||||||||||||
115 | bool condition = checkCondition(line); | - | ||||||||||||
116 | if (condition
| 0-12 | ||||||||||||
117 | if (!function.size()
| 0-12 | ||||||||||||
118 | ignoreAll = true; | - | ||||||||||||
119 | } never executed: else {end of block | 0 | ||||||||||||
120 | if (!ignoredTests
| 2-10 | ||||||||||||
121 | ignoredTests = new std::set<QByteArray>; executed 2 times by 1 test: ignoredTests = new std::set<QByteArray>; Executed by:
| 2 | ||||||||||||
122 | ignoredTests->insert(function); | - | ||||||||||||
123 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||
124 | } | - | ||||||||||||
125 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||
126 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
127 | - | |||||||||||||
128 | void parseGpuBlackList() | - | ||||||||||||
129 | { | - | ||||||||||||
130 | if (!qgpu_features_ptr
| 21-678 | ||||||||||||
131 | return; executed 678 times by 1 test: return; Executed by:
| 678 | ||||||||||||
132 | QString filename = QTest::qFindTestData(([]() -> QString { enum { Size = sizeof(u"" "GPU_BLACKLIST")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "GPU_BLACKLIST" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return executed 21 times by 1 test: qstring_literal_temp;return qstring_literal_temp; Executed by:
executed 21 times by 1 test: }()));return qstring_literal_temp; Executed by:
| 21 | ||||||||||||
133 | if (filename.isEmpty()
| 0-21 | ||||||||||||
134 | return; executed 21 times by 1 test: return; Executed by:
| 21 | ||||||||||||
135 | if (!gpuFeatures
| 0 | ||||||||||||
136 | gpuFeatures = qgpu_features_ptr(filename); never executed: gpuFeatures = qgpu_features_ptr(filename); | 0 | ||||||||||||
137 | } never executed: end of block | 0 | ||||||||||||
138 | - | |||||||||||||
139 | void checkBlackLists(const char *slot, const char *data) | - | ||||||||||||
140 | { | - | ||||||||||||
141 | bool ignore = ignoreAll; | - | ||||||||||||
142 | - | |||||||||||||
143 | if (!ignore
| 471-130010 | ||||||||||||
144 | QByteArray s = slot; | - | ||||||||||||
145 | ignore = (ignoredTests->find(s) != ignoredTests->end()); | - | ||||||||||||
146 | if (!ignore
| 70-3667 | ||||||||||||
147 | s += ':'; | - | ||||||||||||
148 | s += data; | - | ||||||||||||
149 | ignore = (ignoredTests->find(s) != ignoredTests->end()); | - | ||||||||||||
150 | } executed 2847 times by 18 tests: end of block Executed by:
| 2847 | ||||||||||||
151 | } executed 3737 times by 24 tests: end of block Executed by:
| 3737 | ||||||||||||
152 | - | |||||||||||||
153 | QTestResult::setBlacklistCurrentTest(ignore); | - | ||||||||||||
154 | - | |||||||||||||
155 | - | |||||||||||||
156 | - | |||||||||||||
157 | if (!ignore
| 0-129932 | ||||||||||||
158 | QByteArray s_gpu = slot; | - | ||||||||||||
159 | ignore = isGPUTestBlacklisted(s_gpu, data); | - | ||||||||||||
160 | if (!ignore
| 0 | ||||||||||||
161 | s_gpu += ':'; | - | ||||||||||||
162 | s_gpu += data; | - | ||||||||||||
163 | isGPUTestBlacklisted(s_gpu); | - | ||||||||||||
164 | } never executed: end of block | 0 | ||||||||||||
165 | } never executed: end of block | 0 | ||||||||||||
166 | } executed 130481 times by 535 tests: end of block Executed by:
| 130481 | ||||||||||||
167 | - | |||||||||||||
168 | } | - | ||||||||||||
169 | - | |||||||||||||
170 | - | |||||||||||||
171 | - | |||||||||||||
Switch to Source code | Preprocessed file |