diff options
author | aavit <qt-info@nokia.com> | 2010-11-10 10:29:06 (GMT) |
---|---|---|
committer | aavit <qt-info@nokia.com> | 2010-11-10 10:29:06 (GMT) |
commit | 9546ec3b4d56436bb96709dc012fdb33beed45dc (patch) | |
tree | 97d1818afb10716d8eff3b98abaaf6fa8dd57755 /tests/arthur | |
parent | d25330abf4bfe73b7c2867923c461a762747c485 (diff) | |
download | Qt-9546ec3b4d56436bb96709dc012fdb33beed45dc.zip Qt-9546ec3b4d56436bb96709dc012fdb33beed45dc.tar.gz Qt-9546ec3b4d56436bb96709dc012fdb33beed45dc.tar.bz2 |
New and much improved mapping of items to fs storage
Diffstat (limited to 'tests/arthur')
-rw-r--r-- | tests/arthur/baselineserver/src/baselineserver.cpp | 99 | ||||
-rw-r--r-- | tests/arthur/baselineserver/src/baselineserver.h | 6 | ||||
-rw-r--r-- | tests/arthur/baselineserver/src/htmlpage.cpp | 2 |
3 files changed, 68 insertions, 39 deletions
diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index 03d6499..2a2fc08 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -38,6 +38,10 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +#define QT_USE_FAST_CONCATENATION +#define QT_USE_FAST_OPERATOR_PLUS + #include "baselineserver.h" #include <QBuffer> #include <QFile> @@ -63,11 +67,9 @@ BaselineServer::BaselineServer(QObject *parent) QString BaselineServer::storagePath() { if (storage.isEmpty()) { - QByteArray envDir = qgetenv("QT_LANCELOT_DIR"); - if (!envDir.isEmpty()) - storage = QLS(envDir.append('/')); - else - storage = QLS("/var/www/"); + storage = QLS(qgetenv("QT_LANCELOT_DIR")); + if (storage.isEmpty()) + storage = QLS("/var/www"); } return storage; } @@ -278,34 +280,37 @@ void BaselineHandler::receiveDisconnect() } -QString BaselineHandler::itemSubPath(const QString &engine, const QString &format, bool isBaseline) +void BaselineHandler::mapPlatformInfo() { - if (isBaseline) - return QString(QLS("baselines_%1_%2/")).arg(engine, format); - else - return QString(QLS("mismatches_%1_%2/")).arg(engine, format); + mapped = plat; + + // Map hostname + QString host = plat.value(PI_HostName).section(QLC('.'), 0, 0); // Filter away domain, if any + if (host.isEmpty() || host == QLS("localhost")) { + host = plat.value(PI_HostAddress); + } else { + // remove index postfix typical of vm hostnames + host.remove(QRegExp(QLS("\\d+$"))); + if (host.endsWith(QLC('-'))) + host.chop(1); + } + if (host.isEmpty()) + host = QLS("unknownhost"); + mapped.insert(PI_HostName, host); + + // Map qmakespec + QString mkspec = plat.value(PI_QMakeSpec); + mapped.insert(PI_QMakeSpec, mkspec.replace(QLC('/'), QLC('_'))); + + // Map Qt version + QString ver = plat.value(PI_QtVersion); + mapped.insert(PI_QtVersion, ver.prepend(QLS("Qt-"))); //### TBD: remove patch version } QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline, bool absolute) { - if (pathForRun.isNull()) { - QString host = plat.value(PI_HostName).section(QLC('.'), 0, 0); // Filter away domain, if any - if (host.isEmpty() || host == QLS("localhost")) { - host = proto.socket.peerAddress().toString(); - if (host.isEmpty()) - host = QLS("Unknown"); - } else { - host.replace(QRegExp(QLS("^(bq|oslo?)-(.*)$")), QLS("\\2")); - host.replace(QRegExp(QLS("^(.*)-\\d+$")), QLS("vm-\\1")); - } - pathForRun = host + QLC('/'); - } - - QString storePath = pathForRun; - if (isBaseline) - storePath += itemSubPath(item.engineAsString(), item.formatAsString(), isBaseline); - else - storePath += itemSubPath(item.engineAsString(), item.formatAsString(), isBaseline) + runId + QLC('/'); + if (mapped.isEmpty()) + mapPlatformInfo(); QString itemName = item.scriptName; if (itemName.contains(QLC('.'))) @@ -313,15 +318,26 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline, boo itemName.append(QLC('_')); itemName.append(QString::number(item.scriptChecksum, 16).rightJustified(4, QLC('0'))); + QStringList path; if (absolute) - storePath.prepend(BaselineServer::storagePath()); - return storePath + itemName + QLC('.'); + path += BaselineServer::storagePath(); + path += QLS(isBaseline ? "baselines" : "mismatches"); + path += item.engineAsString() + QLC('_') + item.formatAsString(); + path += mapped.value(PI_QtVersion); + path += mapped.value(PI_QMakeSpec); + path += mapped.value(PI_HostName); + if (!isBaseline) + path += runId; + path += itemName + QLC('.'); + + return path.join(QLS("/")); } QString BaselineHandler::updateAllBaselines(const QString &host, const QString &id, const QString &engine, const QString &format) { +#if 0 QString basePath(BaselineServer::storagePath()); QString srcDir(basePath + host + QLC('/') + itemSubPath(engine, format, false) + id); QString dstDir(basePath + host + QLC('/') + itemSubPath(engine, format)); @@ -352,12 +368,15 @@ QString BaselineHandler::updateAllBaselines(const QString &host, const QString & "Command output: <pre>%2</pre>").arg(proc.errorString(), proc.readAll().constData()); return res; +#else + return QString(); +#endif } QString BaselineHandler::updateSingleBaseline(const QString &oldBaseline, const QString &newBaseline) { QString res; - QString basePath(BaselineServer::storagePath()); + QString basePath(BaselineServer::storagePath() + QLC('/')); QString srcBase(basePath + newBaseline.left(newBaseline.length() - 3)); QString dstDir(basePath + oldBaseline.left(oldBaseline.lastIndexOf(QLC('/')))); @@ -377,6 +396,7 @@ QString BaselineHandler::updateSingleBaseline(const QString &oldBaseline, const QString BaselineHandler::blacklistTest(const QString &scriptName, const QString &host, const QString &engine, const QString &format) { +#if 0 QString configFile(BaselineServer::storagePath() + host + QLC('/') + itemSubPath(engine, format) + QLS(".blacklist")); QFile file(configFile); @@ -387,11 +407,15 @@ QString BaselineHandler::blacklistTest(const QString &scriptName, const QString } else { return QLS("Unable to update blacklisted tests."); } +#else + return QString(); +#endif } QString BaselineHandler::whitelistTest(const QString &scriptName, const QString &host, const QString &engine, const QString &format) { +#if 0 QString configFile(BaselineServer::storagePath() + host + QLC('/') + itemSubPath(engine, format) + QLS(".blacklist")); QFile file(configFile); @@ -420,6 +444,9 @@ QString BaselineHandler::whitelistTest(const QString &scriptName, const QString } } return QLS("Unable to whitelist ") + scriptName + QLS(". Unable to open blacklist file."); +#else + return QString(); +#endif } void BaselineHandler::testPathMapping() @@ -433,6 +460,9 @@ void BaselineHandler::testPathMapping() << QLS("osl-mac-master-6.test.qt.nokia.com") << QLS("sv-xp-vs-010") << QLS("sv-xp-vs-011") + << QLS("sv-solaris-sparc-008") + << QLS("macbuilder-02.test.troll.no") + << QLS("bqvm1164") << QLS("chimera") << QLS("localhost"); @@ -445,11 +475,12 @@ void BaselineHandler::testPathMapping() plat.insert(PI_QtVersion, QLS("4.8.0")); plat.insert(PI_BuildKey, QLS("(nobuildkey)")); + plat.insert(PI_QMakeSpec, "linux-g++"); foreach(const QString& host, hosts) { - pathForRun = QString(); + mapped.clear(); plat.insert(PI_HostName, host); - qDebug() << "Baseline from" << host << "->" << pathForItem(item, true).remove(BaselineServer::storagePath()); - qDebug() << "Mismatch from" << host << "->" << pathForItem(item, false).remove(BaselineServer::storagePath()); + qDebug() << "Baseline from" << host << "->" << pathForItem(item, true); + qDebug() << "Mismatch from" << host << "->" << pathForItem(item, false); } } diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h index e311527..be65a9d 100644 --- a/tests/arthur/baselineserver/src/baselineserver.h +++ b/tests/arthur/baselineserver/src/baselineserver.h @@ -115,18 +115,16 @@ private slots: private: void provideBaselineChecksums(const QByteArray &itemListBlock); void storeImage(const QByteArray &itemBlock, bool isBaseline); + void mapPlatformInfo(); QString pathForItem(const ImageItem &item, bool isBaseline = true, bool absolute = true); const char *logtime(); QString computeMismatchScore(const QImage& baseline, const QImage& rendered); - QString engineForItem(const ImageItem &item); - - static QString itemSubPath(const QString &engine, const QString &format, bool isBaseline = true); BaselineProtocol proto; PlatformInfo plat; + PlatformInfo mapped; bool connectionEstablished; QString runId; - QString pathForRun; HTMLPage report; }; diff --git a/tests/arthur/baselineserver/src/htmlpage.cpp b/tests/arthur/baselineserver/src/htmlpage.cpp index ad7f8b7..29ce262 100644 --- a/tests/arthur/baselineserver/src/htmlpage.cpp +++ b/tests/arthur/baselineserver/src/htmlpage.cpp @@ -67,7 +67,7 @@ void HTMLPage::start(const QString &storagepath, const QString &runId, const Pla id = runId; plat = pinfo; address = hostAddress; - root = storagepath; + root = storagepath + QLC('/'); imageItems = itemList; QString dir = root + QLS("reports/"); QDir cwd; |