summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestlog.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-09-15 15:39:36 +0200
committerLars Knoll <lars.knoll@digia.com>2014-09-21 20:58:41 +0200
commit10414444e1fdc3b91328aba19fb10bd92f6dc899 (patch)
tree382677984b22b3d96254373926859b6a7f73803e /src/testlib/qtestlog.cpp
parent23a03ebcd17be328508e749afeb2cd962296be3b (diff)
Add support for blacklisting test functions
We need to have a finer grained control over the tests we skip in our CI system. This adds a blacklisting mechanism that allows blacklisting individual test functions (or even test data) using a set of predefined matching keys for the operating system and some other relevant variables. QTestlib will search for a file called BLACKLIST in the test directory and parse it if found. The file contains a simple ini style list of functions to blacklist. For details see qtestblacklist.cpp. Change-Id: Id3fae4b264ca99970cbf9f45bfb85fa75c1fd823 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/testlib/qtestlog.cpp')
-rw-r--r--src/testlib/qtestlog.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index 708a91b557..b7ed3d0763 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -84,6 +84,7 @@ namespace QTest {
int fails = 0;
int passes = 0;
int skips = 0;
+ int blacklists = 0;
struct IgnoreResultList
{
@@ -415,6 +416,25 @@ void QTestLog::addXPass(const char *msg, const char *file, int line)
QTest::TestLoggers::addIncident(QAbstractTestLogger::XPass, msg, file, line);
}
+void QTestLog::addBPass(const char *msg)
+{
+ QTEST_ASSERT(msg);
+
+ ++QTest::blacklists;
+
+ QTest::TestLoggers::addIncident(QAbstractTestLogger::BlacklistedPass, msg);
+}
+
+void QTestLog::addBFail(const char *msg, const char *file, int line)
+{
+ QTEST_ASSERT(msg);
+ QTEST_ASSERT(file);
+
+ ++QTest::blacklists;
+
+ QTest::TestLoggers::addIncident(QAbstractTestLogger::BlacklistedFail, msg, file, line);
+}
+
void QTestLog::addSkip(const char *msg, const char *file, int line)
{
QTEST_ASSERT(msg);
@@ -552,6 +572,11 @@ int QTestLog::skipCount()
return QTest::skips;
}
+int QTestLog::blacklistCount()
+{
+ return QTest::blacklists;
+}
+
void QTestLog::resetCounters()
{
QTest::passes = 0;