From 5a7409a423ac55a97b0ff9044b392c5847c2833c Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 3 May 2011 13:32:23 +0200 Subject: Make autotest more resilient against network timeout (cherry picked from commit 50be38737507f5c23b4d050e635a200024164a13) --- tests/arthur/common/baselineprotocol.cpp | 10 ++++++---- tests/arthur/common/baselineprotocol.h | 2 +- tests/auto/lancelot/tst_lancelot.cpp | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index d5e533abba..8879b78670 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -424,15 +424,17 @@ bool BaselineProtocol::requestBaselineChecksums(const QString &testFunction, Ima it->testFunction = testFunction; QByteArray block; - QDataStream ds(&block, QIODevice::ReadWrite); + QDataStream ds(&block, QIODevice::WriteOnly); ds << *itemList; if (!sendBlock(RequestBaselineChecksums, block)) return false; + Command cmd; - if (!receiveBlock(&cmd, &block)) + QByteArray rcvBlock; + if (!receiveBlock(&cmd, &rcvBlock) || cmd != BaselineProtocol::Ack) return false; - ds.device()->seek(0); - ds >> *itemList; + QDataStream rds(&rcvBlock, QIODevice::ReadOnly); + rds >> *itemList; return true; } diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h index 8a99ace6ee..bc1a3eb7b6 100644 --- a/tests/arthur/common/baselineprotocol.h +++ b/tests/arthur/common/baselineprotocol.h @@ -146,7 +146,7 @@ public: enum Constant { ProtocolVersion = 5, ServerPort = 54129, - Timeout = 5000 + Timeout = 15000 }; enum Command { diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 972166514a..2eb3f200ed 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -254,7 +254,8 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format) if (baseline.status == ImageItem::BaselineNotFound) { - proto.submitNewBaseline(rendered, 0); + if (!proto.submitNewBaseline(rendered, 0)) + QWARN("Failed to submit new baseline: " + proto.errorMessage().toLatin1()); QSKIP("Baseline not found; new baseline created.", SkipSingle); } -- cgit v1.2.3