From 4672ff71c5c02b13b6435594cc55638d428053ab Mon Sep 17 00:00:00 2001
From: aavit 
Date: Wed, 19 Jan 2011 15:31:25 +0100
Subject: Re-added the update-all-baselines command
---
 tests/arthur/baselineserver/src/baselineserver.cpp | 34 ++++++++++------------
 tests/arthur/baselineserver/src/baselineserver.h   |  2 +-
 tests/arthur/baselineserver/src/report.cpp         | 26 +++++++++++++----
 tests/arthur/baselineserver/src/report.h           |  2 +-
 4 files changed, 38 insertions(+), 26 deletions(-)
diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp
index 8aaa8ff..75309a4 100644
--- a/tests/arthur/baselineserver/src/baselineserver.cpp
+++ b/tests/arthur/baselineserver/src/baselineserver.cpp
@@ -426,27 +426,25 @@ QString BaselineHandler::clearAllBaselines(const QString &context)
     return QString(QLS("%1 of %2 baselines cleared from context ")).arg((tot-failed)/2).arg(tot/2) + context;
 }
 
-QString BaselineHandler::updateSingleBaseline(const QString &oldBaseline, const QString &newBaseline)
+QString BaselineHandler::updateBaselines(const QString &context, const QString &mismatchContext, const QString &itemId)
 {
-    QString res;
-    QString basePath(BaselineServer::storagePath() + QLC('/'));
-    QString srcBase(basePath + newBaseline.left(newBaseline.length() - 3));
-    QString dstDir(basePath + oldBaseline.left(oldBaseline.lastIndexOf(QLC('/'))));
-
-    QProcess proc;
-    proc.setProcessChannelMode(QProcess::MergedChannels);
-    proc.start(QLS("cp"), QStringList() << QLS("-f") << srcBase + QLS(FileFormat) << srcBase + QLS(MetadataFileExt) << dstDir);
-    proc.waitForFinished();
-    if (proc.exitCode() == 0)
-        res = QString("Successfully updated '%1'").arg(oldBaseline);
-    else
-        res = QString("Error updating baseline: %1
"
-                      "Command output: %2
").arg(proc.errorString(), proc.readAll().constData());
-
-    return res;
+    int tot = 0;
+    int failed = 0;
+    QString storagePrefix = BaselineServer::storagePath() + QLC('/');
+    // If itemId is set, update just that one, otherwise, update all:
+    QString filter = (itemId.isEmpty() ? QLS("*") : itemId) + QLS("_????.");  // Match any checksum. #vulnerable to changes in file naming
+    QDirIterator it(storagePrefix + mismatchContext, QStringList() << filter + QLS(FileFormat) << filter + QLS(MetadataFileExt));
+    while (it.hasNext()) {
+        tot++;
+        it.next();
+        QString oldFile = storagePrefix + context + QLC('/') + it.fileName();
+        QFile::remove(oldFile);                       // Remove existing baseline file
+        if (!QFile::copy(it.filePath(), oldFile))     // and replace it with the mismatch
+            failed++;
+    }
+    return QString(QLS("%1 of %2 baselines updated in context %3 from context %4")).arg((tot-failed)/2).arg(tot/2).arg(context, mismatchContext);
 }
 
-
 QString BaselineHandler::blacklistTest(const QString &context, const QString &itemId, bool removeFromBlacklist)
 {
     QFile file(BaselineServer::storagePath() + QLC('/') + context + QLS("/BLACKLIST"));
diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h
index a5683b2..0f14c8c 100644
--- a/tests/arthur/baselineserver/src/baselineserver.h
+++ b/tests/arthur/baselineserver/src/baselineserver.h
@@ -109,7 +109,7 @@ public:
     // CGI callbacks:
     static QString view(const QString &baseline, const QString &rendered, const QString &compared);
     static QString clearAllBaselines(const QString &context);
-    static QString updateSingleBaseline(const QString &oldBaseline, const QString &newBaseline);
+    static QString updateBaselines(const QString &context, const QString &mismatchContext, const QString &itemId);
     static QString blacklistTest(const QString &context, const QString &itemId, bool removeFromBlacklist = false);
 
 private slots:
diff --git a/tests/arthur/baselineserver/src/report.cpp b/tests/arthur/baselineserver/src/report.cpp
index c85f144..217b92c 100644
--- a/tests/arthur/baselineserver/src/report.cpp
+++ b/tests/arthur/baselineserver/src/report.cpp
@@ -154,10 +154,14 @@ void Report::writeFunctionResults(const ImageItemList &list)
     QString testFunction = list.at(0).testFunction;
     QString pageUrl = BaselineServer::baseUrl() + path;
     QString ctx = handler->pathForItem(list.at(0), true, false).section(QLC('/'), 0, -2);
+    QString misCtx = handler->pathForItem(list.at(0), false, false).section(QLC('/'), 0, -2);
+
 
     out << "\n 
Test function: " << testFunction << "
\n";
     out << "Clear all baselines (They will be recreated by the next run)
\n\n";
+        << "\">Clear all baselines for this testfunction (They will be recreated by the next run)
\n";
+    out << "Let these mismatching images be the new baselines for this testfunction
\n\n";
 
     out << "\n"
            "\n"
@@ -176,7 +180,7 @@ void Report::writeFunctionResults(const ImageItemList &list)
         QString metadata = prefix + QLS(MetadataFileExt);
         if (item.status == ImageItem::Mismatch) {
             QString rendered = handler->pathForItem(item, false, false) + QLS(FileFormat);
-            writeItem(baseline, rendered, item, ctx, metadata);
+            writeItem(baseline, rendered, item, ctx, misCtx, metadata);
         }
         else {
             out << "| image info\n"
@@ -207,7 +211,7 @@ void Report::writeFunctionResults(const ImageItemList &list)
     out << " | 
\n";
 }
 
-void Report::writeItem(const QString &baseline, const QString &rendered, const ImageItem &item, const QString &ctx, const QString &metadata)
+void Report::writeItem(const QString &baseline, const QString &rendered, const ImageItem &item, const QString &ctx, const QString &misCtx, const QString &metadata)
 {
     QString compared = generateCompared(baseline, rendered);
     QString pageUrl = BaselineServer::baseUrl() + path;
@@ -219,8 +223,13 @@ void Report::writeItem(const QString &baseline, const QString &rendered, const I
     out << "\n"
         << " Mismatch reported\n"
         << " Baseline Info\n"
+#if 0
         << " Replace baseline with rendered\n"
+        << "&newBaseline=" << rendered << "&url=" << pageUrl << "\">Let this be the new baseline\n"
+#else
+        << " Let this be the new baseline\n"
+#endif
         << " Blacklist this item\n"
         << " 
Date: Wed, 26 Jan 2011 14:52:55 +0100
Subject: Updated for new git repo structure
---
 tests/arthur/baselineserver/src/baselineserver.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp
index 75309a4..fef592e 100644
--- a/tests/arthur/baselineserver/src/baselineserver.cpp
+++ b/tests/arthur/baselineserver/src/baselineserver.cpp
@@ -178,7 +178,7 @@ bool BaselineHandler::establishConnection()
     if (branch.isEmpty()) {
         // Not run by Pulse, i.e. ad hoc run: Ok.
     }
-    else if (branch != QLS("master-integration") || !plat.value(PI_GitCommit).contains(QLS("Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration"))) {
+    else if (branch != QLS("master-integration") || !plat.value(PI_GitCommit).contains(QLS("Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into master-integration"))) {
         qDebug() << runId << logtime() << "Did not pass branch/staging repo filter, disconnecting.";
         proto.sendBlock(BaselineProtocol::Abort, QByteArray("This branch/staging repo is not assigned to be tested."));
         proto.socket.disconnectFromHost();
-- 
cgit v0.12
From 3024ff7d32e1c902580bff3fcdb0232afab43c75 Mon Sep 17 00:00:00 2001
From: aavit 
Date: Fri, 28 Jan 2011 11:52:44 +0100
Subject: Make updating single baseline work again
---
 tests/arthur/baselineserver/src/baselineserver.cpp |  4 ++--
 tests/arthur/baselineserver/src/baselineserver.h   |  2 +-
 tests/arthur/baselineserver/src/report.cpp         | 15 ++++++---------
 tests/arthur/baselineserver/src/report.h           |  3 ++-
 4 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp
index fef592e..d3710ac 100644
--- a/tests/arthur/baselineserver/src/baselineserver.cpp
+++ b/tests/arthur/baselineserver/src/baselineserver.cpp
@@ -426,13 +426,13 @@ QString BaselineHandler::clearAllBaselines(const QString &context)
     return QString(QLS("%1 of %2 baselines cleared from context ")).arg((tot-failed)/2).arg(tot/2) + context;
 }
 
-QString BaselineHandler::updateBaselines(const QString &context, const QString &mismatchContext, const QString &itemId)
+QString BaselineHandler::updateBaselines(const QString &context, const QString &mismatchContext, const QString &itemFile)
 {
     int tot = 0;
     int failed = 0;
     QString storagePrefix = BaselineServer::storagePath() + QLC('/');
     // If itemId is set, update just that one, otherwise, update all:
-    QString filter = (itemId.isEmpty() ? QLS("*") : itemId) + QLS("_????.");  // Match any checksum. #vulnerable to changes in file naming
+    QString filter = itemFile.isEmpty() ? QLS("*_????.") : itemFile;
     QDirIterator it(storagePrefix + mismatchContext, QStringList() << filter + QLS(FileFormat) << filter + QLS(MetadataFileExt));
     while (it.hasNext()) {
         tot++;
diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h
index 0f14c8c..33b2ed7 100644
--- a/tests/arthur/baselineserver/src/baselineserver.h
+++ b/tests/arthur/baselineserver/src/baselineserver.h
@@ -109,7 +109,7 @@ public:
     // CGI callbacks:
     static QString view(const QString &baseline, const QString &rendered, const QString &compared);
     static QString clearAllBaselines(const QString &context);
-    static QString updateBaselines(const QString &context, const QString &mismatchContext, const QString &itemId);
+    static QString updateBaselines(const QString &context, const QString &mismatchContext, const QString &itemFile);
     static QString blacklistTest(const QString &context, const QString &itemId, bool removeFromBlacklist = false);
 
 private slots:
diff --git a/tests/arthur/baselineserver/src/report.cpp b/tests/arthur/baselineserver/src/report.cpp
index 217b92c..88b5625 100644
--- a/tests/arthur/baselineserver/src/report.cpp
+++ b/tests/arthur/baselineserver/src/report.cpp
@@ -180,7 +180,8 @@ void Report::writeFunctionResults(const ImageItemList &list)
         QString metadata = prefix + QLS(MetadataFileExt);
         if (item.status == ImageItem::Mismatch) {
             QString rendered = handler->pathForItem(item, false, false) + QLS(FileFormat);
-            writeItem(baseline, rendered, item, ctx, misCtx, metadata);
+            QString itemFile = prefix.section(QLC('/'), -1);
+            writeItem(baseline, rendered, item, itemFile, ctx, misCtx, metadata);
         }
         else {
             out << "| image info\n"
@@ -211,7 +212,8 @@ void Report::writeFunctionResults(const ImageItemList &list)
     out << "\n";
 }
 
-void Report::writeItem(const QString &baseline, const QString &rendered, const ImageItem &item, const QString &ctx, const QString &misCtx, const QString &metadata)
+void Report::writeItem(const QString &baseline, const QString &rendered, const ImageItem &item,
+                       const QString &itemFile, const QString &ctx, const QString &misCtx, const QString &metadata)
 {
     QString compared = generateCompared(baseline, rendered);
     QString pageUrl = BaselineServer::baseUrl() + path;
@@ -223,13 +225,8 @@ void Report::writeItem(const QString &baseline, const QString &rendered, const I
     out << " | \n"
         << " Mismatch reported\n"
         << " Baseline Info\n"
-#if 0
-        << " Let this be the new baseline\n"
-#else
         << " Let this be the new baseline\n"
-#endif
+        << "&itemFile=" << itemFile << "&url=" << pageUrl << "\">Let this be the new baseline\n"
         << " Blacklist this item\n"
         << " 
Date: Tue, 1 Mar 2011 12:24:23 +0100
Subject: Build fix for shadow built Qt
---
 tests/auto/baselineexample/baselineexample.pro | 2 +-
 tests/auto/lancelot/lancelot.pro               | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/auto/baselineexample/baselineexample.pro b/tests/auto/baselineexample/baselineexample.pro
index 30feecc..13f03b8 100644
--- a/tests/auto/baselineexample/baselineexample.pro
+++ b/tests/auto/baselineexample/baselineexample.pro
@@ -15,4 +15,4 @@ TEMPLATE = app
 SOURCES += tst_baselineexample.cpp
 DEFINES += SRCDIR=\\\"$$PWD/\\\"
 
-include($$QT_SOURCE_TREE/tests/arthur/common/qbaselinetest.pri)
+include($$PWD/../../arthur/common/qbaselinetest.pri)
diff --git a/tests/auto/lancelot/lancelot.pro b/tests/auto/lancelot/lancelot.pro
index 93841a3..11beb7e 100644
--- a/tests/auto/lancelot/lancelot.pro
+++ b/tests/auto/lancelot/lancelot.pro
@@ -3,11 +3,11 @@ QT += xml svg
 contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2):QT += opengl
 
 SOURCES += tst_lancelot.cpp \
-           $$QT_SOURCE_TREE/tests/arthur/common/paintcommands.cpp
-HEADERS += $$QT_SOURCE_TREE/tests/arthur/common/paintcommands.h
-RESOURCES += $$QT_SOURCE_TREE/tests/arthur/common/images.qrc
+           $$PWD/../../arthur/common/paintcommands.cpp
+HEADERS += $$PWD/../../arthur/common/paintcommands.h
+RESOURCES += $$PWD/../../arthur/common/images.qrc
 
-include($$QT_SOURCE_TREE/tests/arthur/common/qbaselinetest.pri)
+include($$PWD/../../arthur/common/qbaselinetest.pri)
 
 !symbian:!wince*:DEFINES += SRCDIR=\\\"$$PWD\\\"
 linux-g++-maemo:DEFINES += USE_RUNTIME_DIR
-- 
cgit v0.12
From 9326d1b80e34a03bf221fca46eb46fbf6420b4d9 Mon Sep 17 00:00:00 2001
From: aavit 
Date: Fri, 4 Mar 2011 14:47:10 +0100
Subject: Improved error msg
---
 tests/arthur/common/baselineprotocol.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp
index e4445bd..cff74cc 100644
--- a/tests/arthur/common/baselineprotocol.cpp
+++ b/tests/arthur/common/baselineprotocol.cpp
@@ -310,7 +310,7 @@ bool BaselineProtocol::connect(const QString &testCase, bool *dryrun)
     }
 
     if (cmd == Abort) {
-        errMsg += QLS("Server aborted connection. Reason: ") + QString::fromLatin1(block);
+        errMsg += QLS("Server rejected connection. Reason: ") + QString::fromLatin1(block);
         return false;
     }
 
-- 
cgit v0.12
 |  |