summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/arthur/baselineserver/src/baselineserver.cpp27
-rw-r--r--tests/auto/lancelot/tst_lancelot.cpp28
2 files changed, 45 insertions, 10 deletions
diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp
index 416b58f..0399224 100644
--- a/tests/arthur/baselineserver/src/baselineserver.cpp
+++ b/tests/arthur/baselineserver/src/baselineserver.cpp
@@ -98,8 +98,8 @@ void BaselineServer::heartbeat()
if (me.lastModified() == meLastMod)
return;
- // (could close() here to avoid accepting new connections, to avoid livelock)
- // also, could check for a timeout to force exit, to avoid hung threads blocking
+ //# (could close() here to avoid accepting new connections, to avoid livelock)
+ //# also, could check for a timeout to force exit, to avoid hung threads blocking
bool isServing = false;
foreach(BaselineThread *thread, findChildren<BaselineThread *>()) {
if (thread->isRunning()) {
@@ -305,10 +305,13 @@ void BaselineHandler::mapPlatformInfo()
if (host.isEmpty() || host == QLS("localhost")) {
host = plat.value(PI_HostAddress);
} else {
- // remove index postfix typical of vm hostnames
- host.remove(QRegExp(QLS("\\d+$")));
- if (host.endsWith(QLC('-')))
- host.chop(1);
+ //# Site specific, should be in a config file
+ if (!host.startsWith(QLS("oldhcp"))) {
+ // remove index postfix typical of vm hostnames
+ host.remove(QRegExp(QLS("\\d+$")));
+ if (host.endsWith(QLC('-')))
+ host.chop(1);
+ }
}
if (host.isEmpty())
host = QLS("unknownhost");
@@ -352,12 +355,16 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline, boo
QString BaselineHandler::clearAllBaselines(const QString &context)
{
+ int tot = 0;
+ int failed = 0;
QDirIterator it(BaselineServer::storagePath() + QLC('/') + context,
QStringList() << QLS("*.png") << QLS("*.metadata"));
- while (it.hasNext())
- QFile::remove(it.next());
-
- return QLS("All baselines cleared from context ") + context;
+ while (it.hasNext()) {
+ tot++;
+ if (!QFile::remove(it.next()))
+ failed++;
+ }
+ 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)
diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp
index 8467672..0c5d787 100644
--- a/tests/auto/lancelot/tst_lancelot.cpp
+++ b/tests/auto/lancelot/tst_lancelot.cpp
@@ -63,6 +63,8 @@ Q_OBJECT
public:
tst_Lancelot();
+ static bool simfail;
+
private:
ImageItem render(const ImageItem &item);
void paint(QPaintDevice *device, const QStringList &script, const QString &filePath);
@@ -91,6 +93,8 @@ private slots:
#endif
};
+bool tst_Lancelot::simfail = false;
+
tst_Lancelot::tst_Lancelot()
{
}
@@ -290,12 +294,36 @@ void tst_Lancelot::paint(QPaintDevice *device, const QStringList &script, const
{
QPainter p(device);
PaintCommands pcmd(script, 800, 800);
+ //pcmd.setShouldDrawText(false);
pcmd.setType(ImageType);
pcmd.setPainter(&p);
pcmd.setFilePath(filePath);
pcmd.runCommands();
+
+ if (simfail) {
+ p.drawLine(0, 0, 800, 800);
+ simfail = false;
+ }
+
p.end();
}
+#define main rmain
QTEST_MAIN(tst_Lancelot)
+#undef main
+
+int main(int argc, char *argv[])
+{
+ char *fargv[20];
+ int fargc = 0;
+ for (int i = 0; i < qMin(argc, 19); i++) {
+ if (!qstrcmp(argv[i], "-simfail"))
+ tst_Lancelot::simfail = true;
+ else
+ fargv[fargc++] = argv[i];
+ }
+ fargv[fargc] = 0;
+ return rmain(fargc, fargv);
+}
+
#include "tst_lancelot.moc"