From bf12d2047b00eb88d96f2767b07c47bbb8df6b89 Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 7 Sep 2010 12:57:38 +0200 Subject: Improve servers storage directory structure - support different pixel formats for same engine - separate baselines per hostname --- tests/arthur/baselineserver/src/baselineserver.cpp | 21 ++++++++--------- tests/arthur/common/baselineprotocol.cpp | 26 ++++++++++++++++++++++ tests/arthur/common/baselineprotocol.h | 1 + 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index ec5793f..685fcae 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -118,7 +118,7 @@ void BaselineHandler::receiveRequest() break; default: qWarning() << runId << logtime() << "Unknown command received. " << proto.errorMessage(); - QThread::currentThread()->exit(1); + proto.sendBlock(BaselineProtocol::UnknownError, QByteArray()); } } @@ -191,15 +191,16 @@ void BaselineHandler::receiveDisconnect() QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) { - QString storePath = BaselineServer::storagePath(); - storePath += plat.buildKey.section(QLatin1Char(' '), 1, 1) + QLatin1String("_Qt-") - + plat.qtVersion + QDir::separator(); - if (isBaseline) { - storePath += QLatin1String("baselines") + QDir::separator() - + item.engineAsString() + QDir::separator(); - } else { - storePath += runId + QDir::separator(); - } + QString host = plat.hostname; + //# tbd: if "localhost", replace with smth meaningful + host.replace(QRegExp(QLatin1String("^(bq|oslo)-(.*)-\\d\\d$")), QLatin1String("vm-\\2")); + QString pathForRun = BaselineServer::storagePath() + host + QLatin1Char('/'); + + QString storePath = pathForRun; + if (isBaseline) + storePath += QString(QLatin1String("baselines_%1_%2/")).arg(item.engineAsString(), item.formatAsString()); + else + storePath += runId + QLatin1Char('/'); //#? QString itemName = item.scriptName.replace(item.scriptName.lastIndexOf('.'), '_'); return storePath + item.scriptName + QLatin1Char('.'); } diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index 24b5b8c..417474d 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -85,6 +85,32 @@ QString ImageItem::engineAsString() const return QLatin1String("Unknown"); } +QString ImageItem::formatAsString() const +{ + static const int numFormats = 16; + static const char *formatNames[numFormats] = { + "Invalid", + "Mono", + "MonoLSB", + "Indexed8", + "RGB32", + "ARGB32", + "ARGB32-Premult", + "RGB16", + "ARGB8565-Premult", + "RGB666", + "ARGB6666-Premult", + "RGB555", + "ARGB8555-Premult", + "RGB888", + "RGB444", + "ARGB4444-Premult" + }; + if (renderFormat < 0 || renderFormat >= numFormats) + return QLatin1String("UnknownFormat"); + return QLatin1String(formatNames[renderFormat]); +} + QDataStream & operator<< (QDataStream &stream, const ImageItem &ii) { stream << ii.scriptName << ii.scriptChecksum << quint8(ii.status) << quint8(ii.renderFormat) diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h index 9ec1ef4..b3e853d 100644 --- a/tests/arthur/common/baselineprotocol.h +++ b/tests/arthur/common/baselineprotocol.h @@ -32,6 +32,7 @@ public: ImageItem &operator=(const ImageItem &other); static quint64 computeChecksum(const QImage& image); QString engineAsString() const; + QString formatAsString() const; enum ItemStatus { Ok = 0, -- cgit v0.12