Remove GPU_BLACKLIST support from QTest

This reverts 4fe68ffbe5,
1dfc16f6da and
9545bee98a2431d4ef4c3449631a5fcb8d9bd57a; this feature has not been in
use for some time, so is just dead code.

[ChangeLog][QtTestLib] Removed support for GPU_BLACKLIST files.
Reimplementations or equivalents of QTEST_MAIN() should remove their
uses of QTEST_ADD_GPU_BLACKLIST_SUPPORT and its _DEFS; they are still
vacuously defined, but serve no remaining purpose and shall be
undefined in due course.

Change-Id: I94ffd5c37ce4e1f7cf25d3c7ae8d40696b74c911
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Edward Welbourne 2018-08-08 14:08:15 +02:00
parent b6427ded65
commit 641eb4a965
5 changed files with 8 additions and 77 deletions

View File

@ -54,8 +54,6 @@
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtCore/QDir> #include <QtCore/QDir>
#include <set>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#if defined(QT_OPENGL_3) #if defined(QT_OPENGL_3)
@ -527,13 +525,4 @@ QOpenGLConfig::Gpu QOpenGLConfig::Gpu::fromContext()
return gpu; return gpu;
} }
Q_GUI_EXPORT std::set<QByteArray> *qgpu_features(const QString &filename)
{
const QSet<QString> features = QOpenGLConfig::gpuFeatures(QOpenGLConfig::Gpu::fromContext(), filename);
std::set<QByteArray> *result = new std::set<QByteArray>;
for (const QString &feature : features)
result->insert(feature.toUtf8());
return result;
}
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -368,18 +368,11 @@ int main(int argc, char *argv[]) \
} }
#include <QtTest/qtestsystem.h> #include <QtTest/qtestsystem.h>
#include <set>
#ifndef QT_NO_OPENGL // Two backwards-compatibility defines for an obsolete feature:
# define QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS \ #define QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
extern Q_TESTLIB_EXPORT std::set<QByteArray> *(*qgpu_features_ptr)(const QString &); \ #define QTEST_ADD_GPU_BLACKLIST_SUPPORT
extern Q_GUI_EXPORT std::set<QByteArray> *qgpu_features(const QString &); // ### Qt 6: fully remove these.
# define QTEST_ADD_GPU_BLACKLIST_SUPPORT \
qgpu_features_ptr = qgpu_features;
#else
# define QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS
# define QTEST_ADD_GPU_BLACKLIST_SUPPORT
#endif
#if defined(QT_NETWORK_LIB) #if defined(QT_NETWORK_LIB)
# include <QtTest/qtest_network.h> # include <QtTest/qtest_network.h>
@ -396,15 +389,11 @@ int main(int argc, char *argv[]) \
#endif #endif
#define QTEST_MAIN(TestObject) \ #define QTEST_MAIN(TestObject) \
QT_BEGIN_NAMESPACE \
QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS \
QT_END_NAMESPACE \
int main(int argc, char *argv[]) \ int main(int argc, char *argv[]) \
{ \ { \
QApplication app(argc, argv); \ QApplication app(argc, argv); \
app.setAttribute(Qt::AA_Use96Dpi, true); \ app.setAttribute(Qt::AA_Use96Dpi, true); \
QTEST_DISABLE_KEYPAD_NAVIGATION \ QTEST_DISABLE_KEYPAD_NAVIGATION \
QTEST_ADD_GPU_BLACKLIST_SUPPORT \
TestObject tc; \ TestObject tc; \
QTEST_SET_MAIN_SOURCE_PATH \ QTEST_SET_MAIN_SOURCE_PATH \
return QTest::qExec(&tc, argc, argv); \ return QTest::qExec(&tc, argc, argv); \
@ -415,14 +404,10 @@ int main(int argc, char *argv[]) \
#include <QtTest/qtest_gui.h> #include <QtTest/qtest_gui.h>
#define QTEST_MAIN(TestObject) \ #define QTEST_MAIN(TestObject) \
QT_BEGIN_NAMESPACE \
QTEST_ADD_GPU_BLACKLIST_SUPPORT_DEFS \
QT_END_NAMESPACE \
int main(int argc, char *argv[]) \ int main(int argc, char *argv[]) \
{ \ { \
QGuiApplication app(argc, argv); \ QGuiApplication app(argc, argv); \
app.setAttribute(Qt::AA_Use96Dpi, true); \ app.setAttribute(Qt::AA_Use96Dpi, true); \
QTEST_ADD_GPU_BLACKLIST_SUPPORT \
TestObject tc; \ TestObject tc; \
QTEST_SET_MAIN_SOURCE_PATH \ QTEST_SET_MAIN_SOURCE_PATH \
return QTest::qExec(&tc, argc, argv); \ return QTest::qExec(&tc, argc, argv); \

View File

@ -220,22 +220,6 @@ static bool checkCondition(const QByteArray &condition)
static bool ignoreAll = false; static bool ignoreAll = false;
static std::set<QByteArray> *ignoredTests = 0; static std::set<QByteArray> *ignoredTests = 0;
static std::set<QByteArray> *gpuFeatures = 0;
Q_TESTLIB_EXPORT std::set<QByteArray> *(*qgpu_features_ptr)(const QString &) = 0;
static bool isGPUTestBlacklisted(const char *slot, const char *data = 0)
{
const QByteArray disableKey = QByteArrayLiteral("disable_") + QByteArray(slot);
if (gpuFeatures->find(disableKey) != gpuFeatures->end()) {
QByteArray msg = QByteArrayLiteral("Skipped due to GPU blacklist: ") + disableKey;
if (data)
msg += ':' + QByteArray(data);
QTest::qSkip(msg.constData(), __FILE__, __LINE__);
return true;
}
return false;
}
namespace QTestPrivate { namespace QTestPrivate {
@ -275,18 +259,7 @@ void parseBlackList()
} }
} }
void parseGpuBlackList() void checkBlackList(const char *slot, const char *data)
{
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; bool ignore = ignoreAll;
@ -301,21 +274,8 @@ void checkBlackLists(const char *slot, const char *data)
} }
QTestResult::setBlacklistCurrentTest(ignore); 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) {
QByteArray s_gpu = slot;
ignore = isGPUTestBlacklisted(s_gpu, data);
if (!ignore && data) {
s_gpu += ':';
s_gpu += data;
isGPUTestBlacklisted(s_gpu);
}
}
}
} }
} // QTestPrivate
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -58,8 +58,7 @@ QT_BEGIN_NAMESPACE
namespace QTestPrivate { namespace QTestPrivate {
// Export functions so they can also be used by QQuickTest // Export functions so they can also be used by QQuickTest
Q_TESTLIB_EXPORT void parseBlackList(); Q_TESTLIB_EXPORT void parseBlackList();
Q_TESTLIB_EXPORT void parseGpuBlackList(); Q_TESTLIB_EXPORT void checkBlackList(const char *slot, const char *data);
Q_TESTLIB_EXPORT void checkBlackLists(const char *slot, const char *data);
} }
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -1103,7 +1103,7 @@ bool TestMethods::invokeTest(int index, const char *data, WatchDog *watchDog) co
if (!data || !qstrcmp(data, table.testData(curDataIndex)->dataTag())) { if (!data || !qstrcmp(data, table.testData(curDataIndex)->dataTag())) {
foundFunction = true; foundFunction = true;
QTestPrivate::checkBlackLists(name.constData(), dataCount ? table.testData(curDataIndex)->dataTag() : 0); QTestPrivate::checkBlackList(name.constData(), dataCount ? table.testData(curDataIndex)->dataTag() : 0);
QTestDataSetter s(curDataIndex >= dataCount ? static_cast<QTestData *>(0) QTestDataSetter s(curDataIndex >= dataCount ? static_cast<QTestData *>(0)
: table.testData(curDataIndex)); : table.testData(curDataIndex));
@ -1813,8 +1813,6 @@ void QTest::qInit(QObject *testObject, int argc, char **argv)
#endif #endif
QTestPrivate::parseBlackList(); QTestPrivate::parseBlackList();
QTestPrivate::parseGpuBlackList();
QTestResult::reset(); QTestResult::reset();
QTEST_ASSERT(testObject); QTEST_ASSERT(testObject);