fix version check to allow automatic package version bumping

This commit is contained in:
Michael Zanetti 2014-06-14 18:01:19 +02:00
parent bbfa2ff1d9
commit eec2461622

View File

@ -68,14 +68,18 @@ void TestVersioning::apiChangeBumpsVersion()
QByteArray oldVersion = oldApiFile.readLine().trimmed(); QByteArray oldVersion = oldApiFile.readLine().trimmed();
QByteArray oldApi = oldApiFile.readAll(); QByteArray oldApi = oldApiFile.readAll();
qDebug() << "version" << oldVersion << newVersion; QString newVersionStripped = newVersion;
newVersionStripped = newVersionStripped.remove(QRegExp("\\+[0-9\\.~a-f]*"));
if (oldVersion == newVersion && oldApi == newApi) { qDebug() << "JSON API version:" << oldVersion;
qDebug() << "Binary version:" << newVersion << "(" + newVersionStripped + ")";
if (oldVersion == newVersionStripped && oldApi == newApi) {
// All fine. no changes // All fine. no changes
return; return;
} }
if (oldVersion == newVersion && oldApi != newApi) { if (oldVersion == newVersionStripped && oldApi != newApi) {
QVERIFY2(false, "JSONRPC API has changed but version is still the same. You need to bump the API version."); QVERIFY2(false, "JSONRPC API has changed but version is still the same. You need to bump the API version.");
} }
@ -94,7 +98,7 @@ void TestVersioning::apiChangeBumpsVersion()
p.waitForFinished(); p.waitForFinished();
qDebug() << p.readAll(); qDebug() << p.readAll();
if (oldVersion != newVersion && oldApi == newApi) { if (oldVersion != newVersionStripped && oldApi == newApi) {
QVERIFY2(false, QString("Version has changed. Update %1.").arg(oldFilePath).toLatin1().data()); QVERIFY2(false, QString("Version has changed. Update %1.").arg(oldFilePath).toLatin1().data());
} else { } else {
QVERIFY2(false, QString("JSONRPC API has changed. Update %1.").arg(oldFilePath).toLatin1().data()); QVERIFY2(false, QString("JSONRPC API has changed. Update %1.").arg(oldFilePath).toLatin1().data());