summaryrefslogtreecommitdiff
path: root/tests/auto
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-10-28 09:33:00 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2015-10-28 09:33:00 +0100
commit94136d42805abeaf3dd9d6ded7b74e3d27fd3777 (patch)
treee6add08b343d76fe45d076a6a604e890b547daae /tests/auto
parentddf3cf7acf8e80b2e4c8018c1c8d6b6d297cc853 (diff)
parent7367d313378fb548449feda3bb0f437d29f20e8b (diff)
downloadqtxmlpatterns-94136d42805abeaf3dd9d6ded7b74e3d27fd3777.tar.gz
Merge remote-tracking branch 'origin/5.5' into 5.6
Change-Id: I41beab20e4de378725e3e2efd929ddd83460d9d8
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/xmlpatternssdk/TestCase.cpp36
-rw-r--r--tests/auto/xmlpatternssdk/TreeItem.cpp4
-rw-r--r--tests/auto/xmlpatternssdk/TreeItem.h3
-rw-r--r--tests/auto/xmlpatternsxqts/tst_suitetest.cpp9
4 files changed, 51 insertions, 1 deletions
diff --git a/tests/auto/xmlpatternssdk/TestCase.cpp b/tests/auto/xmlpatternssdk/TestCase.cpp
index d84ac06..9ae86ad 100644
--- a/tests/auto/xmlpatternssdk/TestCase.cpp
+++ b/tests/auto/xmlpatternssdk/TestCase.cpp
@@ -38,6 +38,7 @@
#include <QXmlResultItems>
#include <QXmlSerializer>
#include <private/qxmlquery_p.h>
+#include <algorithm>
#include "DebugExpressionFactory.h"
#include "ExternalSourceLoader.h"
@@ -62,9 +63,23 @@ TestCase::~TestCase()
delete m_result;
}
+static bool lessThan(const char *a, const char *b)
+{
+ return qstrcmp(a, b) < 0;
+}
+
TestResult::List TestCase::execute(const ExecutionStage stage,
TestSuite *)
{
+ ++TestCase::executions;
+
+ if ((TestCase::executions < TestCase::executeRange.first) || (TestCase::executions > TestCase::executeRange.second)) {
+ qDebug("Skipping test case #%6d", TestCase::executions);
+ return TestResult::List();
+ }
+
+ const QByteArray nm = name().toAscii();
+
if(name() == QLatin1String("Constr-cont-document-3"))
{
TestResult::List result;
@@ -95,9 +110,28 @@ TestResult::List TestCase::execute(const ExecutionStage stage,
result.append(createTestResult(TestResult::Fail, QLatin1String("Skipped this test, we crash on it.")));
return result;
}
+ else {
+ // Should be sorted in the order that std::binary_search expects
+ static const char *crashes[] = {"Constr-attr-content-4",
+ "K2-DirectConElem-12",
+ "K2-DirectConElem-50",
+ "K2-DirectConElemAttr-10",
+ "K2-DirectConElemAttr-18",
+ "K2-DirectConElemAttr-19",
+ "K2-DirectConElemAttr-20",
+ "K2-DirectConElemAttr-21"
+ };
+
+ const bool skip = std::binary_search(&crashes[0], &crashes[sizeof(crashes)/sizeof(crashes[0])], nm.constData(), lessThan);
+ if (skip) {
+ TestResult::List result;
+ result.append(createTestResult(TestResult::Fail, QLatin1String("Skipped this test, we crash on it.")));
+ return result;
+ }
+ }
- qDebug() << "Running test case: " << name();
+ qDebug("Running test case #%6d: %s", TestCase::executions, nm.constData());
return execute(stage);
Q_ASSERT(false);
diff --git a/tests/auto/xmlpatternssdk/TreeItem.cpp b/tests/auto/xmlpatternssdk/TreeItem.cpp
index 9b91f0c..6c8c265 100644
--- a/tests/auto/xmlpatternssdk/TreeItem.cpp
+++ b/tests/auto/xmlpatternssdk/TreeItem.cpp
@@ -51,4 +51,8 @@ int TreeItem::row() const
return -1;
}
+QPair<int, int> TreeItem::executeRange = qMakePair<int,int>(0,INT_MAX);
+int TreeItem::executions = 0;
+
+
// vim: et:ts=4:sw=4:sts=4
diff --git a/tests/auto/xmlpatternssdk/TreeItem.h b/tests/auto/xmlpatternssdk/TreeItem.h
index 802b09f..f6a4fa1 100644
--- a/tests/auto/xmlpatternssdk/TreeItem.h
+++ b/tests/auto/xmlpatternssdk/TreeItem.h
@@ -84,6 +84,9 @@ namespace QPatternistSDK
virtual QVariant data(const Qt::ItemDataRole role, int column) const = 0;
+ static QPair<int,int> executeRange;
+ static int executions;
+
Q_SIGNALS:
/**
* Emitted whenever this item changed. This is used for keeping
diff --git a/tests/auto/xmlpatternsxqts/tst_suitetest.cpp b/tests/auto/xmlpatternsxqts/tst_suitetest.cpp
index 4fdb7b5..4785067 100644
--- a/tests/auto/xmlpatternsxqts/tst_suitetest.cpp
+++ b/tests/auto/xmlpatternsxqts/tst_suitetest.cpp
@@ -35,6 +35,8 @@
#include <QtTest/QtTest>
#include <QProcess>
+#include <cstdlib>
+
#include "TestSuite.h"
#include "TestSuiteResult.h"
#include "XMLWriter.h"
@@ -70,6 +72,13 @@ void tst_SuiteTest::runTestSuite() const
if(m_abortRun)
QSKIP("The test suite is not available, no tests are run.");
+ QByteArray range = qgetenv("XMLPATTERNSXQTS_TESTRANGE");
+ char *endptr;
+ TreeItem::executeRange.first = strtol(range.constData(), &endptr, 10);
+ long e = 0;
+ if (endptr - range.constData() < range.size())
+ e = strtol(endptr + 1, &endptr, 10);
+ TreeItem::executeRange.second = (e == 0 ? INT_MAX : e);
QString errMsg;
const QFileInfo fi(m_catalogPath);
const QUrl catalogPath(QUrl::fromLocalFile(fi.absoluteFilePath()));