diff options
author | aavit <qt-info@nokia.com> | 2010-09-09 08:46:34 (GMT) |
---|---|---|
committer | aavit <qt-info@nokia.com> | 2010-09-09 08:46:34 (GMT) |
commit | 3c29f241cebf18f4927579e054e2906915328cac (patch) | |
tree | b6dd1463026184ff86621d3bdfa2f5508947e255 /tests | |
parent | 4d89a1dc2ea1f1dfbb6109d940496e924185fe13 (diff) | |
download | Qt-3c29f241cebf18f4927579e054e2906915328cac.zip Qt-3c29f241cebf18f4927579e054e2906915328cac.tar.gz Qt-3c29f241cebf18f4927579e054e2906915328cac.tar.bz2 |
Improved server logging and more robust client connection attempt
Also misc minor improvements all around
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/arthur/baselineserver/bin/runserver | 11 | ||||
-rw-r--r-- | tests/arthur/baselineserver/src/baselineserver.cpp | 7 | ||||
-rw-r--r-- | tests/arthur/common/baselineprotocol.cpp | 17 | ||||
-rw-r--r-- | tests/arthur/common/baselineprotocol.h | 3 | ||||
-rw-r--r-- | tests/auto/lancelot/tst_lancelot.cpp | 27 |
5 files changed, 38 insertions, 27 deletions
diff --git a/tests/arthur/baselineserver/bin/runserver b/tests/arthur/baselineserver/bin/runserver index 52feb86..48c5c1d 100755 --- a/tests/arthur/baselineserver/bin/runserver +++ b/tests/arthur/baselineserver/bin/runserver @@ -1,6 +1,13 @@ #!/bin/bash +logfile=baselineserver.log + while true; do - ./baselineserver - sleep 5 + echo >> $logfile + echo -n "***RESTARTING*** " >> $logfile + date >> $logfile + + ./baselineserver 2>&1 | tee -a $logfile + + sleep 2 done diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index 5a96b90..2eee408 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -128,7 +128,8 @@ void BaselineHandler::provideBaselineChecksums(const QByteArray &itemListBlock) ImageItemList itemList; QDataStream ds(itemListBlock); ds >> itemList; - qDebug() << runId << logtime() << "Received request for checksums for" << itemList.count() << "items"; + qDebug() << runId << logtime() << "Received request for checksums for" << itemList.count() << "items, engine" + << itemList.at(0).engineAsString() << "pixel format" << itemList.at(0).formatAsString(); for (ImageItemList::iterator i = itemList.begin(); i != itemList.end(); ++i) { if (i->scriptName.startsWith(QLatin1String("porter_duff"))) { @@ -182,7 +183,7 @@ void BaselineHandler::storeImage(const QByteArray &itemBlock, bool isBaseline) msg += " image stored in " + QHostInfo::localHostName().toLatin1() + '.' + QHostInfo::localDomainName().toLatin1() + ':' - + QFileInfo(file).absoluteFilePath().toLatin1(); + + prefix.toLatin1() + FileFormat; proto.sendBlock(BaselineProtocol::Ack, msg); } @@ -209,7 +210,7 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline) if (isBaseline) storePath += QString(QLatin1String("baselines_%1_%2/")).arg(item.engineAsString(), item.formatAsString()); else - storePath += runId + QLatin1Char('/'); + storePath += QString(QLatin1String("mismatches_%1_%2/")).arg(item.engineAsString(), item.formatAsString()) + runId + QLatin1Char('/'); QString itemName = item.scriptName; if (itemName.contains(QLatin1Char('.'))) diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index 34d1a04..01ae67a 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -3,6 +3,7 @@ #include <QImage> #include <QBuffer> #include <QHostInfo> +#include <QTest> PlatformInfo::PlatformInfo(bool useLocal) { @@ -145,11 +146,17 @@ bool BaselineProtocol::connect() if (serverName.isNull()) serverName = "chimera.europe.nokia.com"; - socket.connectToHost(serverName, ServerPort); - - if (!socket.waitForConnected(Timeout)) { - errMsg += QLatin1String("TCP connectToHost failed. Host:") + serverName + QLatin1String(" port:") + QString::number(ServerPort); - return false; + for (int i = 0; i < 2; i++) { + socket.connectToHost(serverName, ServerPort); + if (!socket.waitForConnected(Timeout)) { + if (!i && socket.error() == QAbstractSocket::ConnectionRefusedError) { + QTest::qSleep(3000); // In case the server is just restarting, we try again + continue; + } + errMsg += QLatin1String("TCP connectToHost failed. Host:") + serverName + QLatin1String(" port:") + QString::number(ServerPort); + return false; + } + break; } PlatformInfo pi(true); diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h index 5427023..062a99c 100644 --- a/tests/arthur/common/baselineprotocol.h +++ b/tests/arthur/common/baselineprotocol.h @@ -111,7 +111,4 @@ private: }; - - - #endif // BASELINEPROTOCOL_H diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 4792aa5..13a20e9 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -250,30 +250,29 @@ ImageItem tst_Lancelot::render(const ImageItem &item) { ImageItem res = item; res.imageChecksums.clear(); + res.image = QImage(); QString filePath = scriptsDir + item.scriptName; QStringList script = loadScriptFile(filePath); - if (script.isEmpty()) { - res.image = QImage(); - } else if (item.engine == ImageItem::Raster) { + if (script.isEmpty()) + return res; + + if (item.engine == ImageItem::Raster) { QImage img(800, 800, item.renderFormat); paint(&img, script, QFileInfo(filePath).absoluteFilePath()); // eh yuck (filePath stuff) res.image = img; res.imageChecksums.append(ImageItem::computeChecksum(img)); } else if (item.engine == ImageItem::OpenGL) { QGLWidget glWidget; - if (!glWidget.isValid()) { - res.image = QImage(); - res.imageChecksums.append(0); - return res; - } - glWidget.resize(800, 800); - glWidget.show(); + if (glWidget.isValid()) { + glWidget.resize(800, 800); + glWidget.show(); #ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&glWidget); + qt_x11_wait_for_window_manager(&glWidget); #endif - paint(&glWidget, script, QFileInfo(filePath).absoluteFilePath()); // eh yuck (filePath stuff) - res.image = glWidget.grabFrameBuffer().convertToFormat(item.renderFormat); - res.imageChecksums.append(ImageItem::computeChecksum(res.image)); + paint(&glWidget, script, QFileInfo(filePath).absoluteFilePath()); // eh yuck (filePath stuff) + res.image = glWidget.grabFrameBuffer().convertToFormat(item.renderFormat); + res.imageChecksums.append(ImageItem::computeChecksum(res.image)); + } } return res; |