From 619f8eec497538a3efb6cd36b12b16c6ce02cd88 Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 25 Aug 2010 15:21:58 +0200 Subject: Use a remote test server during dev, plus some housekeeping --- tests/arthur/.gitignore | 2 ++ tests/arthur/baselineserver/.gitignore | 2 ++ tests/arthur/baselineserver/src/baselineserver.cpp | 24 +++++++++++++--------- tests/arthur/baselineserver/src/baselineserver.h | 1 + tests/arthur/common/baselineprotocol.cpp | 4 ++-- tests/auto/lancelot/.gitignore | 1 + 6 files changed, 22 insertions(+), 12 deletions(-) create mode 100644 tests/arthur/.gitignore create mode 100644 tests/arthur/baselineserver/.gitignore create mode 100644 tests/auto/lancelot/.gitignore diff --git a/tests/arthur/.gitignore b/tests/arthur/.gitignore new file mode 100644 index 0000000..7f0c1fa --- /dev/null +++ b/tests/arthur/.gitignore @@ -0,0 +1,2 @@ +bin/shower +lance/lance diff --git a/tests/arthur/baselineserver/.gitignore b/tests/arthur/baselineserver/.gitignore new file mode 100644 index 0000000..cc513e0 --- /dev/null +++ b/tests/arthur/baselineserver/.gitignore @@ -0,0 +1,2 @@ +storage +bin/baselineserver diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index bba2cd8..f7293a2 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -79,24 +79,28 @@ BaselineHandler::BaselineHandler(int socketDescriptor) proto.socket.setSocketDescriptor(socketDescriptor); } +QString BaselineHandler::logtime() +{ + return QTime::currentTime().toString(QLatin1String("mm:ss.zzz")); +} void BaselineHandler::receiveRequest() { if (!connectionEstablished) { if (!proto.acceptConnection(&plat)) { - qWarning() << runId << "Accepting new connection failed. " << proto.errorMessage(); + qWarning() << runId << logtime() << "Accepting new connection failed. " << proto.errorMessage(); QThread::currentThread()->exit(1); return; } connectionEstablished = true; - qDebug() << runId << "Connection established with" << plat.hostname << "Qt version:" << plat.qtVersion << plat.buildKey; + qDebug() << runId << logtime() << "Connection established with" << plat.hostname << "Qt version:" << plat.qtVersion << plat.buildKey; return; } QByteArray block; BaselineProtocol::Command cmd; if (!proto.receiveBlock(&cmd, &block)) { - qWarning() << runId << "Command reception failed. "<< proto.errorMessage(); + qWarning() << runId << logtime() << "Command reception failed. "<< proto.errorMessage(); QThread::currentThread()->exit(1); return; } @@ -112,7 +116,7 @@ void BaselineHandler::receiveRequest() storeImage(block, false); break; default: - qWarning() << runId << "Unknown command received. " << proto.errorMessage(); + qWarning() << runId << logtime() << "Unknown command received. " << proto.errorMessage(); QThread::currentThread()->exit(1); } } @@ -120,11 +124,11 @@ void BaselineHandler::receiveRequest() void BaselineHandler::provideBaseline(const QByteArray &caseId) { - qDebug() << runId << "Received request for baseline" << caseId; + qDebug() << runId << logtime() << "Received request for baseline" << caseId; QFile file(pathForCaseId(caseId)); if (!file.open(QIODevice::ReadOnly)) { - qDebug() << runId << "baseline not found."; + qDebug() << runId << logtime() << "baseline not found."; proto.sendBlock(BaselineProtocol::BaselineNotPresent, caseId); return; } @@ -142,13 +146,13 @@ void BaselineHandler::storeImage(const QByteArray &imageBlock, bool isBaseline) ds >> caseId; //# For futuresafeness, should make caseId FS-safe - but revertable... QFile file(pathForCaseId(caseId, isBaseline)); - qDebug() << runId << "Received" << (isBaseline ? "baseline" : "mismatched") << "image for:" << caseId << "Storing in" << file.fileName(); + qDebug() << runId << logtime() << "Received" << (isBaseline ? "baseline" : "mismatched") << "image for:" << caseId << "Storing in" << file.fileName(); QString path = file.fileName().section(QDir::separator(), 0, -2); QDir cwd; if (!cwd.exists(path)) cwd.mkpath(path); if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - qWarning() << runId << "Failed to store" << file.fileName(); + qWarning() << runId << logtime() << "Failed to store" << file.fileName(); return; } file.write(imageBlock.constData()+buf.pos(), imageBlock.size()-buf.pos()); @@ -159,13 +163,13 @@ void BaselineHandler::storeImage(const QByteArray &imageBlock, bool isBaseline) + QHostInfo::localDomainName().toLatin1() + ':' + QFileInfo(file).absoluteFilePath().toLatin1(); proto.sendBlock(BaselineProtocol::Ack, msg); - qDebug() << runId << "Storing done."; + qDebug() << runId << logtime() << "Storing done."; } void BaselineHandler::receiveDisconnect() { - qDebug() << runId << "Client disconnected."; + qDebug() << runId << logtime() << "Client disconnected."; QThread::currentThread()->exit(0); } diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h index 8cd9f56..9d32e5d 100644 --- a/tests/arthur/baselineserver/src/baselineserver.h +++ b/tests/arthur/baselineserver/src/baselineserver.h @@ -64,6 +64,7 @@ private: void provideBaseline(const QByteArray &caseId); void storeImage(const QByteArray &imageBlock, bool isBaseline); QString pathForCaseId(const QByteArray &caseId, bool isBaseline = true); + QString logtime(); BaselineProtocol proto; PlatformInfo plat; diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index fb4f06d..83b7adc 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -37,8 +37,8 @@ BaselineProtocol::~BaselineProtocol() bool BaselineProtocol::connect() { errMsg.clear(); - //TBD: determine server address; for now localhost - QLatin1String serverName("localhost"); + //###TBD: determine server address; for now local devhost + QLatin1String serverName("chimera.europe.nokia.com"); socket.connectToHost(serverName, ServerPort); diff --git a/tests/auto/lancelot/.gitignore b/tests/auto/lancelot/.gitignore new file mode 100644 index 0000000..0a70416 --- /dev/null +++ b/tests/auto/lancelot/.gitignore @@ -0,0 +1 @@ +tst_lancelot -- cgit v0.12