| 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 | << "x86" | - | ||||||||||||
| 20 | - | |||||||||||||
| 21 | - | |||||||||||||
| 22 | - | |||||||||||||
| 23 | - | |||||||||||||
| 24 | - | |||||||||||||
| 25 | - | |||||||||||||
| 26 | << "developer-build" | - | ||||||||||||
| 27 | - | |||||||||||||
| 28 | ; | - | ||||||||||||
| 29 | - | |||||||||||||
| 30 | QCoreApplication *app = QCoreApplication::instance(); | - | ||||||||||||
| 31 | if (app
| 0-2 | ||||||||||||
| 32 | const QVariant platformName = app->property("platformName"); | - | ||||||||||||
| 33 | if (platformName.isValid()
| 0-2 | ||||||||||||
| 34 | set never executed: << platformName.toByteArray();set << platformName.toByteArray();never executed: set << platformName.toByteArray(); | 0 | ||||||||||||
| 35 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 36 | - | |||||||||||||
| 37 | return executed 2 times by 1 test: set;return set;Executed by:
executed 2 times by 1 test: return set;Executed by:
| 2 | ||||||||||||
| 38 | } | - | ||||||||||||
| 39 | - | |||||||||||||
| 40 | static QSet<QByteArray> activeConditions() | - | ||||||||||||
| 41 | { | - | ||||||||||||
| 42 | QSet<QByteArray> result = keywords(); | - | ||||||||||||
| 43 | - | |||||||||||||
| 44 | QByteArray distributionName = QSysInfo::productType().toLower().toUtf8(); | - | ||||||||||||
| 45 | QByteArray distributionRelease = QSysInfo::productVersion().toLower().toUtf8(); | - | ||||||||||||
| 46 | if (!distributionName.isEmpty()
| 0-2 | ||||||||||||
| 47 | if (result.find(distributionName) == result.end()
| 0-2 | ||||||||||||
| 48 | result.insert(distributionName); executed 2 times by 1 test: result.insert(distributionName);Executed by:
| 2 | ||||||||||||
| 49 | if (!distributionRelease.isEmpty()
| 0-2 | ||||||||||||
| 50 | QByteArray versioned = distributionName + "-" + distributionRelease; | - | ||||||||||||
| 51 | if (result.find(versioned) == result.end()
| 0-2 | ||||||||||||
| 52 | result.insert(versioned); executed 2 times by 1 test: result.insert(versioned);Executed by:
| 2 | ||||||||||||
| 53 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 54 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 55 | - | |||||||||||||
| 56 | return executed 2 times by 1 test: result;return result;Executed by:
executed 2 times by 1 test: return result;Executed by:
| 2 | ||||||||||||
| 57 | } | - | ||||||||||||
| 58 | - | |||||||||||||
| 59 | static bool checkCondition(const QByteArray &condition) | - | ||||||||||||
| 60 | { | - | ||||||||||||
| 61 | static const QSet<QByteArray> matchedConditions = activeConditions(); | - | ||||||||||||
| 62 | QList<QByteArray> conds = condition.split(' '); | - | ||||||||||||
| 63 | - | |||||||||||||
| 64 | for (int i = 0; i < conds.size()
| 12 | ||||||||||||
| 65 | QByteArray c = conds.at(i); | - | ||||||||||||
| 66 | bool result = c.startsWith('!'); | - | ||||||||||||
| 67 | if (result
| 0-12 | ||||||||||||
| 68 | c = c.mid(1); never executed: c = c.mid(1); | 0 | ||||||||||||
| 69 | - | |||||||||||||
| 70 | result ^= matchedConditions.contains(c); | - | ||||||||||||
| 71 | if (!result
| 0-12 | ||||||||||||
| 72 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 73 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||
| 74 | return executed 12 times by 1 test: true;return true;Executed by:
executed 12 times by 1 test: return true;Executed by:
| 12 | ||||||||||||
| 75 | } | - | ||||||||||||
| 76 | - | |||||||||||||
| 77 | static bool ignoreAll = false; | - | ||||||||||||
| 78 | static std::set<QByteArray> *ignoredTests = 0; | - | ||||||||||||
| 79 | static std::set<QByteArray> *gpuFeatures = 0; | - | ||||||||||||
| 80 | - | |||||||||||||
| 81 | __attribute__((visibility("default"))) std::set<QByteArray> *(*qgpu_features_ptr)(const QString &) = 0; | - | ||||||||||||
| 82 | - | |||||||||||||
| 83 | static bool isGPUTestBlacklisted(const char *slot, const char *data = 0) | - | ||||||||||||
| 84 | { | - | ||||||||||||
| 85 | 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 | ||||||||||||
| 86 | if (gpuFeatures->find(disableKey) != gpuFeatures->end()
| 0 | ||||||||||||
| 87 | 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 | ||||||||||||
| 88 | if (data
| 0 | ||||||||||||
| 89 | msg += ':' + QByteArray(data); never executed: msg += ':' + QByteArray(data); | 0 | ||||||||||||
| 90 | QTest::qSkip(msg.constData(), __FILE__, 218); | - | ||||||||||||
| 91 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||
| 92 | } | - | ||||||||||||
| 93 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 94 | } | - | ||||||||||||
| 95 | - | |||||||||||||
| 96 | namespace QTestPrivate { | - | ||||||||||||
| 97 | - | |||||||||||||
| 98 | void parseBlackList() | - | ||||||||||||
| 99 | { | - | ||||||||||||
| 100 | 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 815 times by 1 test: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 815 times by 1 test: }()));return qstring_literal_temp;Executed by:
| 815 | ||||||||||||
| 101 | if (filename.isEmpty()
| 2-813 | ||||||||||||
| 102 | return; executed 813 times by 1 test: return;Executed by:
| 813 | ||||||||||||
| 103 | QFile ignored(filename); | - | ||||||||||||
| 104 | if (!ignored.open(QIODevice::ReadOnly)
| 0-2 | ||||||||||||
| 105 | return; never executed: return; | 0 | ||||||||||||
| 106 | - | |||||||||||||
| 107 | QByteArray function; | - | ||||||||||||
| 108 | - | |||||||||||||
| 109 | while (!ignored.atEnd()
| 2-24 | ||||||||||||
| 110 | QByteArray line = ignored.readLine().simplified(); | - | ||||||||||||
| 111 | if (line.isEmpty()
| 0-24 | ||||||||||||
| 112 | continue; never executed: continue; | 0 | ||||||||||||
| 113 | if (line.startsWith('[')
| 12 | ||||||||||||
| 114 | function = line.mid(1, line.length() - 2); | - | ||||||||||||
| 115 | continue; executed 12 times by 1 test: continue;Executed by:
| 12 | ||||||||||||
| 116 | } | - | ||||||||||||
| 117 | bool condition = checkCondition(line); | - | ||||||||||||
| 118 | if (condition
| 0-12 | ||||||||||||
| 119 | if (!function.size()
| 0-12 | ||||||||||||
| 120 | ignoreAll = true; | - | ||||||||||||
| 121 | } never executed: else {end of block | 0 | ||||||||||||
| 122 | if (!ignoredTests
| 2-10 | ||||||||||||
| 123 | ignoredTests = new std::set<QByteArray>; executed 2 times by 1 test: ignoredTests = new std::set<QByteArray>;Executed by:
| 2 | ||||||||||||
| 124 | ignoredTests->insert(function); | - | ||||||||||||
| 125 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||
| 126 | } | - | ||||||||||||
| 127 | } executed 12 times by 1 test: end of blockExecuted by:
| 12 | ||||||||||||
| 128 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 129 | - | |||||||||||||
| 130 | void parseGpuBlackList() | - | ||||||||||||
| 131 | { | - | ||||||||||||
| 132 | if (!qgpu_features_ptr
| 25-790 | ||||||||||||
| 133 | return; executed 790 times by 1 test: return;Executed by:
| 790 | ||||||||||||
| 134 | 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 25 times by 1 test: qstring_literal_temp;return qstring_literal_temp;Executed by:
executed 25 times by 1 test: }()));return qstring_literal_temp;Executed by:
| 25 | ||||||||||||
| 135 | if (filename.isEmpty()
| 0-25 | ||||||||||||
| 136 | return; executed 25 times by 1 test: return;Executed by:
| 25 | ||||||||||||
| 137 | if (!gpuFeatures
| 0 | ||||||||||||
| 138 | gpuFeatures = qgpu_features_ptr(filename); never executed: gpuFeatures = qgpu_features_ptr(filename); | 0 | ||||||||||||
| 139 | } never executed: end of block | 0 | ||||||||||||
| 140 | - | |||||||||||||
| 141 | void checkBlackLists(const char *slot, const char *data) | - | ||||||||||||
| 142 | { | - | ||||||||||||
| 143 | bool ignore = ignoreAll; | - | ||||||||||||
| 144 | - | |||||||||||||
| 145 | if (!ignore
| 471-126139 | ||||||||||||
| 146 | QByteArray s = slot; | - | ||||||||||||
| 147 | ignore = (ignoredTests->find(s) != ignoredTests->end()); | - | ||||||||||||
| 148 | if (!ignore
| 70-3480 | ||||||||||||
| 149 | s += ':'; | - | ||||||||||||
| 150 | s += data; | - | ||||||||||||
| 151 | ignore = (ignoredTests->find(s) != ignoredTests->end()); | - | ||||||||||||
| 152 | } executed 2665 times by 18 tests: end of blockExecuted by:
| 2665 | ||||||||||||
| 153 | } executed 3550 times by 24 tests: end of blockExecuted by:
| 3550 | ||||||||||||
| 154 | - | |||||||||||||
| 155 | QTestResult::setBlacklistCurrentTest(ignore); | - | ||||||||||||
| 156 | - | |||||||||||||
| 157 | - | |||||||||||||
| 158 | - | |||||||||||||
| 159 | if (!ignore
| 0-126061 | ||||||||||||
| 160 | QByteArray s_gpu = slot; | - | ||||||||||||
| 161 | ignore = isGPUTestBlacklisted(s_gpu, data); | - | ||||||||||||
| 162 | if (!ignore
| 0 | ||||||||||||
| 163 | s_gpu += ':'; | - | ||||||||||||
| 164 | s_gpu += data; | - | ||||||||||||
| 165 | isGPUTestBlacklisted(s_gpu); | - | ||||||||||||
| 166 | } never executed: end of block | 0 | ||||||||||||
| 167 | } never executed: end of block | 0 | ||||||||||||
| 168 | } executed 126610 times by 502 tests: end of blockExecuted by:
| 126610 | ||||||||||||
| 169 | - | |||||||||||||
| 170 | } | - | ||||||||||||
| 171 | - | |||||||||||||
| 172 | - | |||||||||||||
| 173 | - | |||||||||||||
| Switch to Source code | Preprocessed file |