testlib: Detect distribution name/release for blacklisting tests

Add possibility to blacklist distributions using the syntax:
"<productType>" and "<productType>-<productVersion>".

productType and productVersion are the values returned by
QSysInfo::productType() and QSysInfo::productVersion() (in lower case).

Change-Id: Iefd948127dd2133c2f2ab7aeb5b0c9749c3df6c5
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
This commit is contained in:
Caroline Chao 2015-03-17 13:06:09 +01:00
parent d1ee1c52d1
commit 1a542f2544

View File

@ -36,6 +36,7 @@
#include <QtTest/qtestcase.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qfile.h>
#include <QtCore/QSysInfo>
#include <set>
@ -121,6 +122,14 @@ static bool checkCondition(const QByteArray &condition)
++m;
}
QByteArray distributionName = QSysInfo::productType().toLower().toUtf8();
QByteArray distributionRelease = QSysInfo::productVersion().toLower().toUtf8();
if (!distributionName.isEmpty()) {
if (matches.find(distributionName) == matches.end())
matches.insert(distributionName);
matches.insert(distributionName + "-" + distributionRelease);
}
for (int i = 0; i < conds.size(); ++i) {
QByteArray c = conds.at(i);
bool result = c.startsWith('!');