QTestLib: Add data parameter to SKIP message if any

When using GPU_BLACKLIST, a blacklisted test is volontary skipped
early in the process to avoid crashes or undefined bahaviors. Thus
the name of the running test only contains the slot name and doesn't
show which data was eventually used.

If a test is skipped while running with different data, the skip message
currently doesn't tell which data was run either.

To identify the skipped test, when the test is run with data, the data
is now amended to the slot name in the skip message.

Change-Id: I7acdc8951fa2c60d170cc77c0fbd842255746b35
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
bb10
Caroline Chao 2015-06-08 15:07:43 +02:00
parent 1dfc16f6da
commit 9545bee98a
1 changed files with 5 additions and 3 deletions

View File

@ -166,11 +166,13 @@ static std::set<QByteArray> *gpuFeatures = 0;
Q_TESTLIB_EXPORT std::set<QByteArray> *(*qgpu_features_ptr)(const QString &) = 0;
static bool isGPUTestBlacklisted(const char *slot)
static bool isGPUTestBlacklisted(const char *slot, const char *data = 0)
{
const QByteArray disableKey = QByteArrayLiteral("disable_") + QByteArray(slot);
if (gpuFeatures->find(disableKey) != gpuFeatures->end()) {
const QByteArray msg = QByteArrayLiteral("Skipped due to GPU blacklist: ") + disableKey;
QByteArray msg = QByteArrayLiteral("Skipped due to GPU blacklist: ") + disableKey;
if (data)
msg += QByteArrayLiteral(":") + QByteArray(data);
QTest::qSkip(msg.constData(), __FILE__, __LINE__);
return true;
}
@ -242,7 +244,7 @@ void checkBlackLists(const char *slot, const char *data)
// not sufficient since these are expected to crash or behave in undefined ways.
if (!ignore && gpuFeatures) {
QByteArray s_gpu = slot;
ignore = isGPUTestBlacklisted(s_gpu);
ignore = isGPUTestBlacklisted(s_gpu, data);
if (!ignore && data) {
s_gpu += ':';
s_gpu += data;