path: root/tests/baselineserver/src/baselineserver.h
diff options
authoraavit <>2012-08-13 14:13:40 +0200
committerThe Qt Project <>2012-09-26 04:03:48 +0200
commitaa9728450cc515c66545323646c66d826a1af50a (patch)
treee309abb926ca9fe8da2d1784d0db4a8db9305c1e /tests/baselineserver/src/baselineserver.h
parentbf05abddfd542a0568138d533d1f401d32b65e8c (diff)
Misc. updates to the lancelot autotest framework
Moving more logic into the protocol and framework, easening the burden on the autotest implementation. Implementing several new features in the server and report, like fuzzy matching and static baselines. Change-Id: Iaf070918195ae05767808a548f019d09d9d5f8c0 Reviewed-by: Paul Olav Tvete <>
Diffstat (limited to 'tests/baselineserver/src/baselineserver.h')
1 files changed, 27 insertions, 5 deletions
diff --git a/tests/baselineserver/src/baselineserver.h b/tests/baselineserver/src/baselineserver.h
index c8ce3860fb..d30a74195d 100644
--- a/tests/baselineserver/src/baselineserver.h
+++ b/tests/baselineserver/src/baselineserver.h
@@ -53,9 +53,14 @@
#include "baselineprotocol.h"
#include "report.h"
-// #seconds between update checks
+// #seconds between checks for update of the executable
#define HEARTBEAT 10
+// Timeout if no activity received from client, #seconds
#define MetadataFileExt "metadata"
+#define ThumbnailExt "thumbnail.jpg"
class BaselineServer : public QTcpServer
@@ -66,7 +71,7 @@ public:
static QString storagePath();
static QString baseUrl();
- static QString settingsFilePath();
+ static QStringList defaultPathKeys();
void incomingConnection(qintptr socketDescriptor);
@@ -81,7 +86,7 @@ private:
int lastRunIdIdx;
static QString storage;
static QString url;
- static QString settingsFile;
+ static QStringList pathKeys;
@@ -106,28 +111,38 @@ class BaselineHandler : public QObject
BaselineHandler(const QString &runId, int socketDescriptor = -1);
- void testPathMapping();
+ QString projectPath(bool absolute = true) const;
QString pathForItem(const ImageItem &item, bool isBaseline = true, bool absolute = true) const;
// CGI callbacks:
static QString view(const QString &baseline, const QString &rendered, const QString &compared);
+ static QString diffstats(const QString &baseline, const QString &rendered);
static QString clearAllBaselines(const QString &context);
static QString updateBaselines(const QString &context, const QString &mismatchContext, const QString &itemFile);
static QString blacklistTest(const QString &context, const QString &itemId, bool removeFromBlacklist = false);
+ // for debugging
+ void testPathMapping();
private slots:
void receiveRequest();
void receiveDisconnect();
+ void idleClientTimeout();
+ bool checkClient(QByteArray *errMsg, bool *dryRunMode = 0);
bool establishConnection();
void provideBaselineChecksums(const QByteArray &itemListBlock);
+ void recordMatch(const QByteArray &itemBlock);
void storeImage(const QByteArray &itemBlock, bool isBaseline);
void storeItemMetadata(const PlatformInfo &metadata, const QString &path);
PlatformInfo fetchItemMetadata(const QString &path);
PlatformInfo mapPlatformInfo(const PlatformInfo& orig) const;
const char *logtime();
- QString computeMismatchScore(const QImage& baseline, const QImage& rendered);
+ void issueMismatchNotification();
+ bool fuzzyCompare(const QString& baselinePath, const QString& mismatchPath);
+ static QString computeMismatchScore(const QImage& baseline, const QImage& rendered);
BaselineProtocol proto;
PlatformInfo clientInfo;
@@ -137,6 +152,13 @@ private:
bool connectionEstablished;
Report report;
QSettings *settings;
+ QString ruleName;
+ int fuzzLevel;
+ QTimer *idleTimer;
+// Make an identifer safer for use as filename and URL
+QString safeName(const QString& name);