qtestblacklist: only generate the distro and version once
We were looking up distro and version, in order to conditionally add them to keywords if missing, on every keyword line of each BLACKLIST that we parsed. In particular, this meant the static holding the list of keywords couldn't be const. Move the distro-handling to an intemediary function that adds to the raw keywords and supplies one-off initialization for the list of conditions to match. Change-Id: Ia383ec060e24b7f72d2c8fd6ae65816318daafd0 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>bb10
parent
07667b4390
commit
832715a679
|
|
@ -135,19 +135,26 @@ static QSet<QByteArray> keywords()
|
|||
return set;
|
||||
}
|
||||
|
||||
static bool checkCondition(const QByteArray &condition)
|
||||
static QSet<QByteArray> activeConditions()
|
||||
{
|
||||
static QSet<QByteArray> matchedConditions = keywords();
|
||||
QList<QByteArray> conds = condition.split(' ');
|
||||
QSet<QByteArray> result = keywords();
|
||||
|
||||
QByteArray distributionName = QSysInfo::productType().toLower().toUtf8();
|
||||
QByteArray distributionRelease = QSysInfo::productVersion().toLower().toUtf8();
|
||||
if (!distributionName.isEmpty()) {
|
||||
if (matchedConditions.find(distributionName) == matchedConditions.end())
|
||||
matchedConditions.insert(distributionName);
|
||||
matchedConditions.insert(distributionName + "-" + distributionRelease);
|
||||
if (result.find(distributionName) == result.end())
|
||||
result.insert(distributionName);
|
||||
result.insert(distributionName + "-" + distributionRelease);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool checkCondition(const QByteArray &condition)
|
||||
{
|
||||
static const QSet<QByteArray> matchedConditions = activeConditions();
|
||||
QList<QByteArray> conds = condition.split(' ');
|
||||
|
||||
for (int i = 0; i < conds.size(); ++i) {
|
||||
QByteArray c = conds.at(i);
|
||||
bool result = c.startsWith('!');
|
||||
|
|
|
|||
Loading…
Reference in New Issue