diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-04-10 13:55:10 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-05-08 15:11:32 +0000 |
commit | 4fe68ffbe5c93244562f2b56292d4ecf5ce39f56 (patch) | |
tree | ac8b39a6630ad35495a539bf8599b5590310e27d /src/testlib/qtestblacklist.cpp | |
parent | e6ffb36b5517d1d4025718b56423db9bdf0a63f8 (diff) | |
download | qtbase-4fe68ffbe5c93244562f2b56292d4ecf5ce39f56.tar.gz |
Add GPU_BLACKLIST support to QTestLib
In addition to BLACKLIST, Qt will now look for GPU_BLACKLIST too.
Test cases that are specified as disabled in the GPU blacklist
will be skipped. This is particularly relevant when running tests
on Embedded Linux devices.
For example, the following JSON would configure the test case
glxContextWrap to be skipped on drivers where GL_VENDOR contains
UnstableDriverVendor:
{
"entries": [ {
"gl_vendor": "UnstableDriverVendor",
"features": [ "disable_glxContextWrap" ]
} ]
}
In contrast to the regular blacklist, GPU-blacklisted test cases are
not run at all. This is because driver problems and instabilities
often lead to crashes.
Change-Id: I340cf5c0261a206109b78409774408981bba5c68
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/testlib/qtestblacklist.cpp')
-rw-r--r-- | src/testlib/qtestblacklist.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp index f8285c3ea9..28a2878b32 100644 --- a/src/testlib/qtestblacklist.cpp +++ b/src/testlib/qtestblacklist.cpp @@ -34,6 +34,7 @@ #include "qtestresult_p.h" #include <QtTest/qtestcase.h> +#include <QtTest/qtest.h> #include <QtCore/qbytearray.h> #include <QtCore/qfile.h> #include <QtCore/QSysInfo> @@ -154,6 +155,9 @@ static bool checkCondition(const QByteArray &condition) static bool ignoreAll = false; static std::set<QByteArray> *ignoredTests = 0; +static std::set<QByteArray> *gpuFeatures = 0; + +Q_TESTLIB_EXPORT std::set<QByteArray> *(*qgpu_features_ptr)(const QString &) = 0; namespace QTestPrivate { @@ -189,7 +193,18 @@ void parseBlackList() } } -void checkBlackList(const char *slot, const char *data) +void parseGpuBlackList() +{ + if (!qgpu_features_ptr) + return; + QString filename = QTest::qFindTestData(QStringLiteral("GPU_BLACKLIST")); + if (filename.isEmpty()) + return; + if (!gpuFeatures) + gpuFeatures = qgpu_features_ptr(filename); +} + +void checkBlackLists(const char *slot, const char *data) { bool ignore = ignoreAll; @@ -204,6 +219,16 @@ void checkBlackList(const char *slot, const char *data) } QTestResult::setBlacklistCurrentTest(ignore); + + // Tests blacklisted in GPU_BLACKLIST are to be skipped. Just ignoring the result is + // not sufficient since these are expected to crash or behave in undefined ways. + if (!ignore && gpuFeatures) { + const QByteArray disableKey = QByteArrayLiteral("disable_") + QByteArray(slot); + if (gpuFeatures->find(disableKey) != gpuFeatures->end()) { + const QByteArray msg = QByteArrayLiteral("Skipped due to GPU blacklist: ") + disableKey; + QTest::qSkip(msg.constData(), __FILE__, __LINE__); + } + } } } |