summaryrefslogtreecommitdiffstats
path: root/tests/arthur
diff options
context:
space:
mode:
authoraavit <qt-info@nokia.com>2010-11-19 13:51:40 (GMT)
committeraavit <qt-info@nokia.com>2010-11-19 13:51:40 (GMT)
commit0b63c90f5f4f5d1948e63c12f8b9b3395d316809 (patch)
tree3fa24c606877a0d6d1a23110b42f99c3aac7dcf2 /tests/arthur
parent8034cab2cce55b43dcc1100d0b22f8c85eb733c2 (diff)
downloadQt-0b63c90f5f4f5d1948e63c12f8b9b3395d316809.zip
Qt-0b63c90f5f4f5d1948e63c12f8b9b3395d316809.tar.gz
Qt-0b63c90f5f4f5d1948e63c12f8b9b3395d316809.tar.bz2
Added command to clear all baselines
Diffstat (limited to 'tests/arthur')
-rw-r--r--tests/arthur/baselineserver/src/baselineserver.cpp42
-rw-r--r--tests/arthur/baselineserver/src/baselineserver.h3
-rw-r--r--tests/arthur/baselineserver/src/htmlpage.cpp26
3 files changed, 18 insertions, 53 deletions
diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp
index 7679f13..416b58f 100644
--- a/tests/arthur/baselineserver/src/baselineserver.cpp
+++ b/tests/arthur/baselineserver/src/baselineserver.cpp
@@ -51,6 +51,7 @@
#include <QHostInfo>
#include <QTextStream>
#include <QProcess>
+#include <QDirIterator>
QString BaselineServer::storage;
@@ -349,43 +350,14 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline, boo
}
-QString BaselineHandler::updateAllBaselines(const QString &host, const QString &id,
- const QString &engine, const QString &format)
+QString BaselineHandler::clearAllBaselines(const QString &context)
{
-#if 0
- QString basePath(BaselineServer::storagePath());
- QString srcDir(basePath + host + QLC('/') + itemSubPath(engine, format, false) + id);
- QString dstDir(basePath + host + QLC('/') + itemSubPath(engine, format));
-
- QDir dir(srcDir);
- QStringList nameFilter;
- nameFilter << "*.metadata" << "*.png";
- QStringList fileList = dir.entryList(nameFilter, QDir::Files | QDir::NoDotAndDotDot);
-
- // remove the generated _fuzzycompared.png and _compared.png files from the list
- QMutableStringListIterator it(fileList);
- while (it.hasNext()) {
- it.next();
- if (it.value().endsWith(QLS("compared.png")))
- it.remove();
- }
+ QDirIterator it(BaselineServer::storagePath() + QLC('/') + context,
+ QStringList() << QLS("*.png") << QLS("*.metadata"));
+ while (it.hasNext())
+ QFile::remove(it.next());
- QString res;
- QProcess proc;
- proc.setWorkingDirectory(srcDir);
- proc.setProcessChannelMode(QProcess::MergedChannels);
- proc.start(QLS("cp"), QStringList() << QLS("-f") << fileList << dstDir);
- proc.waitForFinished();
- if (proc.exitCode() == 0)
- res = QLS("Successfully updated baseline for all failed tests.");
- else
- res = QString("Error updating baseline: %1<br>"
- "Command output: <pre>%2</pre>").arg(proc.errorString(), proc.readAll().constData());
-
- return res;
-#else
- return QString();
-#endif
+ return QLS("All baselines cleared from context ") + context;
}
QString BaselineHandler::updateSingleBaseline(const QString &oldBaseline, const QString &newBaseline)
diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h
index d49aedb..c5cb45e 100644
--- a/tests/arthur/baselineserver/src/baselineserver.h
+++ b/tests/arthur/baselineserver/src/baselineserver.h
@@ -100,8 +100,7 @@ public:
BaselineHandler(int socketDescriptor = -1);
void testPathMapping();
- static QString updateAllBaselines(const QString &host, const QString &id,
- const QString &engine, const QString &format);
+ static QString clearAllBaselines(const QString &context);
static QString updateSingleBaseline(const QString &oldBaseline, const QString &newBaseline);
static QString blacklistTest(const QString &context, const QString &itemId, bool removeFromBlacklist = false);
diff --git a/tests/arthur/baselineserver/src/htmlpage.cpp b/tests/arthur/baselineserver/src/htmlpage.cpp
index f75da88..fdbdfb8 100644
--- a/tests/arthur/baselineserver/src/htmlpage.cpp
+++ b/tests/arthur/baselineserver/src/htmlpage.cpp
@@ -89,19 +89,16 @@ void HTMLPage::writeHeader(const ImageItem &item)
out.setDevice(&file);
out << "<html><body><h1>Lancelot results from run " << id << "</h1>\n\n";
- out << "<h3>Platform Info:</h3>\n";
+ out << "<p><h3>Platform Info:</h3>\n";
out << "<table>\n";
foreach (QString key, plat.keys())
out << "<tr><td>" << key << "</td><td>" << plat.value(key) << "</td></tr>\n";
- out << "</table>\n";
-
-#if 0
- out << "<h3><a href=\"/cgi-bin/server.cgi?cmd=updateAllBaselines&id="<< id << "&host=" << plat.hostName
- << "&engine=" << item.engineAsString() << "&format=" << item.formatAsString()
- << "&url=" << pageUrl
- << "\">Update all baselines</a><br>";
-#endif
- out << "<table border=\"2\">\n"
+ out << "</table></p>\n\n";
+
+ out << "<p><a href=\"/cgi-bin/server.cgi?cmd=clearAllBaselines&context=" << ctx << "&url=" << pageUrl
+ << "\"><b><big>Clear all baselines</big></b></a></h3> (They will be recreated by the next run)</p>\n\n";
+
+ out << "<p><table border=\"2\">\n"
"<tr>\n"
"<td><b>Script</b></td>\n"
"<td><b>Baseline</b></td>\n"
@@ -114,7 +111,7 @@ void HTMLPage::writeHeader(const ImageItem &item)
void HTMLPage::writeFooter()
{
- out << "</table>\n</body></html>\n";
+ out << "</table></p>\n</body></html>\n";
}
@@ -207,11 +204,8 @@ void HTMLPage::handleCGIQuery(const QString &query)
if (command == QLS("updateSingleBaseline")) {
s << BaselineHandler::updateSingleBaseline(cgiUrl.queryItemValue(QLS("oldBaseline")),
cgiUrl.queryItemValue(QLS("newBaseline")));
- } else if (command == QLS("updateAllBaselines")) {
- s << BaselineHandler::updateAllBaselines(cgiUrl.queryItemValue(QLS("host")),
- cgiUrl.queryItemValue(QLS("id")),
- cgiUrl.queryItemValue(QLS("engine")),
- cgiUrl.queryItemValue(QLS("format")));
+ } else if (command == QLS("clearAllBaselines")) {
+ s << BaselineHandler::clearAllBaselines(cgiUrl.queryItemValue(QLS("context")));
} else if (command == QLS("blacklist")) {
// blacklist a test
s << BaselineHandler::blacklistTest(cgiUrl.queryItemValue(QLS("context")),