summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2012-02-17 13:39:30 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-20 08:05:58 +0100
commiteb52d78e90ad8870a055f586d9d14d7068acd95b (patch)
treef9a9bcb5df79f3e7a67e6e6b52e8bbec3b227202 /tests/auto/testlib/selftests
parent4cb09aea6a4f26f36961da8934819e823cfe2d4d (diff)
testlib: Report one test result per benchmark test.
Prior to this commit, a benchmark test could report 0..n passes and 0..m fails or skips, where n is the number of accumulation iterations used to collect benchmark data and m is the number of times the test function was invoked. Depending on the type of benchmark measurer being used, this could result in a very large volume of test output and inconsistent pass, fail and skip counts between test runs. This commit changes the behaviour so that each benchmark test reports one pass, fail or skip, regardless of the number of iterations used to collect benchmark data. This commit also prevents benchmark data being reported in the test output if the benchmark test failed or skipped, as any benchmark data is of dubious value in such cases. The latter change in behaviour requires a minor modification to the badxml selftest, which now tests quoting of literal strings in xml test output for both passing and failing benchmarks. Finally, this commit also adds a new selftest specifically for verifying correct behaviour for benchmarks that fail or skip. Task-number: QTBUG-24313 Change-Id: I3426dc659a7511b62fd183a031c7235bc753f497 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/testlib/selftests')
-rw-r--r--tests/auto/testlib/selftests/badxml/tst_badxml.cpp9
-rw-r--r--tests/auto/testlib/selftests/benchlibcounting/benchlibcounting.pro7
-rw-r--r--tests/auto/testlib/selftests/benchlibcounting/tst_benchlibcounting.cpp76
-rw-r--r--tests/auto/testlib/selftests/expected_badxml.lightxml60
-rw-r--r--tests/auto/testlib/selftests/expected_badxml.txt42
-rw-r--r--tests/auto/testlib/selftests/expected_badxml.xml60
-rw-r--r--tests/auto/testlib/selftests/expected_badxml.xunitxml26
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibcallgrind.txt3
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibcounting.lightxml24
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibcounting.txt13
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibcounting.xml27
-rw-r--r--tests/auto/testlib/selftests/expected_benchlibcounting.xunitxml20
-rw-r--r--tests/auto/testlib/selftests/expected_benchliboptions.txt8
-rw-r--r--tests/auto/testlib/selftests/selftests.pri1
-rw-r--r--tests/auto/testlib/selftests/selftests.qrc4
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp4
16 files changed, 314 insertions, 70 deletions
diff --git a/tests/auto/testlib/selftests/badxml/tst_badxml.cpp b/tests/auto/testlib/selftests/badxml/tst_badxml.cpp
index 1c9a0d9493..1a143e5243 100644
--- a/tests/auto/testlib/selftests/badxml/tst_badxml.cpp
+++ b/tests/auto/testlib/selftests/badxml/tst_badxml.cpp
@@ -106,15 +106,18 @@ void tst_BadXml::badDataTag() const
QBENCHMARK {
}
- QFAIL("a failure");
+ QFETCH(bool, shouldFail);
+ if (shouldFail)
+ QFAIL("a failure");
}
void tst_BadXml::badDataTag_data() const
{
- QTest::addColumn<int>("dummy");
+ QTest::addColumn<bool>("shouldFail");
foreach (char const* str, badStrings()) {
- QTest::newRow(str) << 0;
+ QTest::newRow(qPrintable(QString("fail %1").arg(str))) << true;
+ QTest::newRow(qPrintable(QString("pass %1").arg(str))) << false;
}
}
diff --git a/tests/auto/testlib/selftests/benchlibcounting/benchlibcounting.pro b/tests/auto/testlib/selftests/benchlibcounting/benchlibcounting.pro
new file mode 100644
index 0000000000..b495995eac
--- /dev/null
+++ b/tests/auto/testlib/selftests/benchlibcounting/benchlibcounting.pro
@@ -0,0 +1,7 @@
+SOURCES += tst_benchlibcounting.cpp
+QT = core testlib
+
+mac:CONFIG -= app_bundle
+CONFIG -= debug_and_release_target
+
+TARGET = benchlibcounting
diff --git a/tests/auto/testlib/selftests/benchlibcounting/tst_benchlibcounting.cpp b/tests/auto/testlib/selftests/benchlibcounting/tst_benchlibcounting.cpp
new file mode 100644
index 0000000000..847bc1a81d
--- /dev/null
+++ b/tests/auto/testlib/selftests/benchlibcounting/tst_benchlibcounting.cpp
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QCoreApplication>
+#include <QtTest/QtTest>
+
+class tst_BenchlibCounting : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void passingBenchmark();
+ void skippingBenchmark();
+ void failingBenchmark();
+};
+
+void tst_BenchlibCounting::passingBenchmark()
+{
+ QBENCHMARK {
+ }
+}
+
+void tst_BenchlibCounting::skippingBenchmark()
+{
+ QBENCHMARK {
+ QSKIP("This is a skipping benchmark");
+ }
+}
+
+void tst_BenchlibCounting::failingBenchmark()
+{
+ QBENCHMARK {
+ QFAIL("This is a failing benchmark");
+ };
+}
+
+QTEST_MAIN(tst_BenchlibCounting)
+#include "tst_benchlibcounting.moc"
diff --git a/tests/auto/testlib/selftests/expected_badxml.lightxml b/tests/auto/testlib/selftests/expected_badxml.lightxml
index a8cdf56dc1..08ba497efa 100644
--- a/tests/auto/testlib/selftests/expected_badxml.lightxml
+++ b/tests/auto/testlib/selftests/expected_badxml.lightxml
@@ -7,41 +7,69 @@
</TestFunction>
<TestFunction name="badDataTag">
<Message type="qdebug" file="" line="0">
- <DataTag><![CDATA[end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
+ <DataTag><![CDATA[fail end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
<Description><![CDATA[a message]]></Description>
</Message>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109">
- <DataTag><![CDATA[end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="111">
+ <DataTag><![CDATA[fail end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
<Description><![CDATA[a failure]]></Description>
</Incident>
-<BenchmarkResult metric="Events" tag="end cdata ]]&gt; text ]]&gt; more text" value="0" iterations="1" />
<Message type="qdebug" file="" line="0">
- <DataTag><![CDATA[quotes " text" more text]]></DataTag>
+ <DataTag><![CDATA[pass end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
<Description><![CDATA[a message]]></Description>
</Message>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109">
- <DataTag><![CDATA[quotes " text" more text]]></DataTag>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[pass end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
+</Incident>
+<BenchmarkResult metric="Events" tag="pass end cdata ]]&gt; text ]]&gt; more text" value="0" iterations="1" />
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[fail quotes " text" more text]]></DataTag>
+ <Description><![CDATA[a message]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="111">
+ <DataTag><![CDATA[fail quotes " text" more text]]></DataTag>
<Description><![CDATA[a failure]]></Description>
</Incident>
-<BenchmarkResult metric="Events" tag="quotes &quot; text&quot; more text" value="0" iterations="1" />
<Message type="qdebug" file="" line="0">
- <DataTag><![CDATA[xml close > open < tags < text]]></DataTag>
+ <DataTag><![CDATA[pass quotes " text" more text]]></DataTag>
+ <Description><![CDATA[a message]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[pass quotes " text" more text]]></DataTag>
+</Incident>
+<BenchmarkResult metric="Events" tag="pass quotes &quot; text&quot; more text" value="0" iterations="1" />
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[fail xml close > open < tags < text]]></DataTag>
<Description><![CDATA[a message]]></Description>
</Message>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109">
- <DataTag><![CDATA[xml close > open < tags < text]]></DataTag>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="111">
+ <DataTag><![CDATA[fail xml close > open < tags < text]]></DataTag>
<Description><![CDATA[a failure]]></Description>
</Incident>
-<BenchmarkResult metric="Events" tag="xml close &gt; open &lt; tags &lt; text" value="0" iterations="1" />
<Message type="qdebug" file="" line="0">
- <DataTag><![CDATA[all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag>
+ <DataTag><![CDATA[pass xml close > open < tags < text]]></DataTag>
<Description><![CDATA[a message]]></Description>
</Message>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109">
- <DataTag><![CDATA[all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[pass xml close > open < tags < text]]></DataTag>
+</Incident>
+<BenchmarkResult metric="Events" tag="pass xml close &gt; open &lt; tags &lt; text" value="0" iterations="1" />
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[fail all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag>
+ <Description><![CDATA[a message]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="111">
+ <DataTag><![CDATA[fail all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag>
<Description><![CDATA[a failure]]></Description>
</Incident>
-<BenchmarkResult metric="Events" tag="all &gt; &quot; mixed ]]&gt; up &gt; &quot; in &lt; the ]]&gt; hopes &lt; of triggering &quot;&lt; ]]&gt; bugs" value="0" iterations="1" />
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[pass all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag>
+ <Description><![CDATA[a message]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[pass all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag>
+</Incident>
+<BenchmarkResult metric="Events" tag="pass all &gt; &quot; mixed ]]&gt; up &gt; &quot; in &lt; the ]]&gt; hopes &lt; of triggering &quot;&lt; ]]&gt; bugs" value="0" iterations="1" />
</TestFunction>
<TestFunction name="badMessage">
<Message type="qdebug" file="" line="0">
diff --git a/tests/auto/testlib/selftests/expected_badxml.txt b/tests/auto/testlib/selftests/expected_badxml.txt
index d4f4432066..68d333ec30 100644
--- a/tests/auto/testlib/selftests/expected_badxml.txt
+++ b/tests/auto/testlib/selftests/expected_badxml.txt
@@ -1,25 +1,33 @@
********* Start testing of tst_BadXml *********
Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
PASS : tst_BadXml::initTestCase()
-QDEBUG : tst_BadXml::badDataTag(end cdata ]]> text ]]> more text) a message
-FAIL! : tst_BadXml::badDataTag(end cdata ]]> text ]]> more text) a failure
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp(109)]
-RESULT : tst_BadXml::badDataTag():"end cdata ]]> text ]]> more text":
+QDEBUG : tst_BadXml::badDataTag(fail end cdata ]]> text ]]> more text) a message
+FAIL! : tst_BadXml::badDataTag(fail end cdata ]]> text ]]> more text) a failure
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp(111)]
+QDEBUG : tst_BadXml::badDataTag(pass end cdata ]]> text ]]> more text) a message
+PASS : tst_BadXml::badDataTag(pass end cdata ]]> text ]]> more text)
+RESULT : tst_BadXml::badDataTag():"pass end cdata ]]> text ]]> more text":
0 events per iteration (total: 0, iterations: 1)
-QDEBUG : tst_BadXml::badDataTag(quotes " text" more text) a message
-FAIL! : tst_BadXml::badDataTag(quotes " text" more text) a failure
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp(109)]
-RESULT : tst_BadXml::badDataTag():"quotes " text" more text":
+QDEBUG : tst_BadXml::badDataTag(fail quotes " text" more text) a message
+FAIL! : tst_BadXml::badDataTag(fail quotes " text" more text) a failure
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp(111)]
+QDEBUG : tst_BadXml::badDataTag(pass quotes " text" more text) a message
+PASS : tst_BadXml::badDataTag(pass quotes " text" more text)
+RESULT : tst_BadXml::badDataTag():"pass quotes " text" more text":
0 events per iteration (total: 0, iterations: 1)
-QDEBUG : tst_BadXml::badDataTag(xml close > open < tags < text) a message
-FAIL! : tst_BadXml::badDataTag(xml close > open < tags < text) a failure
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp(109)]
-RESULT : tst_BadXml::badDataTag():"xml close > open < tags < text":
+QDEBUG : tst_BadXml::badDataTag(fail xml close > open < tags < text) a message
+FAIL! : tst_BadXml::badDataTag(fail xml close > open < tags < text) a failure
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp(111)]
+QDEBUG : tst_BadXml::badDataTag(pass xml close > open < tags < text) a message
+PASS : tst_BadXml::badDataTag(pass xml close > open < tags < text)
+RESULT : tst_BadXml::badDataTag():"pass xml close > open < tags < text":
0 events per iteration (total: 0, iterations: 1)
-QDEBUG : tst_BadXml::badDataTag(all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs) a message
-FAIL! : tst_BadXml::badDataTag(all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs) a failure
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp(109)]
-RESULT : tst_BadXml::badDataTag():"all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs":
+QDEBUG : tst_BadXml::badDataTag(fail all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs) a message
+FAIL! : tst_BadXml::badDataTag(fail all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs) a failure
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp(111)]
+QDEBUG : tst_BadXml::badDataTag(pass all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs) a message
+PASS : tst_BadXml::badDataTag(pass all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs)
+RESULT : tst_BadXml::badDataTag():"pass all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs":
0 events per iteration (total: 0, iterations: 1)
QDEBUG : tst_BadXml::badMessage(string 0) end cdata ]]> text ]]> more text
PASS : tst_BadXml::badMessage(string 0)
@@ -31,5 +39,5 @@ QDEBUG : tst_BadXml::badMessage(string 3) all > " mixed ]]> up > " in < the ]]>
PASS : tst_BadXml::badMessage(string 3)
FAIL! : tst_BadXml::failWithNoFile() failure message
PASS : tst_BadXml::cleanupTestCase()
-Totals: 6 passed, 5 failed, 0 skipped
+Totals: 10 passed, 5 failed, 0 skipped
********* Finished testing of tst_BadXml *********
diff --git a/tests/auto/testlib/selftests/expected_badxml.xml b/tests/auto/testlib/selftests/expected_badxml.xml
index 9f083d3917..849bc07bfc 100644
--- a/tests/auto/testlib/selftests/expected_badxml.xml
+++ b/tests/auto/testlib/selftests/expected_badxml.xml
@@ -9,41 +9,69 @@
</TestFunction>
<TestFunction name="badDataTag">
<Message type="qdebug" file="" line="0">
- <DataTag><![CDATA[end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
+ <DataTag><![CDATA[fail end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
<Description><![CDATA[a message]]></Description>
</Message>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109">
- <DataTag><![CDATA[end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="111">
+ <DataTag><![CDATA[fail end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
<Description><![CDATA[a failure]]></Description>
</Incident>
-<BenchmarkResult metric="Events" tag="end cdata ]]&gt; text ]]&gt; more text" value="0" iterations="1" />
<Message type="qdebug" file="" line="0">
- <DataTag><![CDATA[quotes " text" more text]]></DataTag>
+ <DataTag><![CDATA[pass end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
<Description><![CDATA[a message]]></Description>
</Message>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109">
- <DataTag><![CDATA[quotes " text" more text]]></DataTag>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[pass end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
+</Incident>
+<BenchmarkResult metric="Events" tag="pass end cdata ]]&gt; text ]]&gt; more text" value="0" iterations="1" />
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[fail quotes " text" more text]]></DataTag>
+ <Description><![CDATA[a message]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="111">
+ <DataTag><![CDATA[fail quotes " text" more text]]></DataTag>
<Description><![CDATA[a failure]]></Description>
</Incident>
-<BenchmarkResult metric="Events" tag="quotes &quot; text&quot; more text" value="0" iterations="1" />
<Message type="qdebug" file="" line="0">
- <DataTag><![CDATA[xml close > open < tags < text]]></DataTag>
+ <DataTag><![CDATA[pass quotes " text" more text]]></DataTag>
+ <Description><![CDATA[a message]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[pass quotes " text" more text]]></DataTag>
+</Incident>
+<BenchmarkResult metric="Events" tag="pass quotes &quot; text&quot; more text" value="0" iterations="1" />
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[fail xml close > open < tags < text]]></DataTag>
<Description><![CDATA[a message]]></Description>
</Message>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109">
- <DataTag><![CDATA[xml close > open < tags < text]]></DataTag>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="111">
+ <DataTag><![CDATA[fail xml close > open < tags < text]]></DataTag>
<Description><![CDATA[a failure]]></Description>
</Incident>
-<BenchmarkResult metric="Events" tag="xml close &gt; open &lt; tags &lt; text" value="0" iterations="1" />
<Message type="qdebug" file="" line="0">
- <DataTag><![CDATA[all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag>
+ <DataTag><![CDATA[pass xml close > open < tags < text]]></DataTag>
<Description><![CDATA[a message]]></Description>
</Message>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109">
- <DataTag><![CDATA[all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[pass xml close > open < tags < text]]></DataTag>
+</Incident>
+<BenchmarkResult metric="Events" tag="pass xml close &gt; open &lt; tags &lt; text" value="0" iterations="1" />
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[fail all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag>
+ <Description><![CDATA[a message]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="111">
+ <DataTag><![CDATA[fail all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag>
<Description><![CDATA[a failure]]></Description>
</Incident>
-<BenchmarkResult metric="Events" tag="all &gt; &quot; mixed ]]&gt; up &gt; &quot; in &lt; the ]]&gt; hopes &lt; of triggering &quot;&lt; ]]&gt; bugs" value="0" iterations="1" />
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[pass all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag>
+ <Description><![CDATA[a message]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[pass all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag>
+</Incident>
+<BenchmarkResult metric="Events" tag="pass all &gt; &quot; mixed ]]&gt; up &gt; &quot; in &lt; the ]]&gt; hopes &lt; of triggering &quot;&lt; ]]&gt; bugs" value="0" iterations="1" />
</TestFunction>
<TestFunction name="badMessage">
<Message type="qdebug" file="" line="0">
diff --git a/tests/auto/testlib/selftests/expected_badxml.xunitxml b/tests/auto/testlib/selftests/expected_badxml.xunitxml
index 724aed59e7..939e887a88 100644
--- a/tests/auto/testlib/selftests/expected_badxml.xunitxml
+++ b/tests/auto/testlib/selftests/expected_badxml.xunitxml
@@ -1,19 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<testsuite errors="8" failures="5" tests="5" name="tst_BadXml">
+<testsuite errors="12" failures="5" tests="5" name="tst_BadXml">
<properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
</properties>
<testcase result="pass" name="initTestCase"/>
<testcase result="fail" name="badDataTag">
- <!-- tag="end cdata ]]&gt; text ]]&gt; more text" message="a message" type="qdebug" -->
- <failure tag="end cdata ]]&gt; text ]]&gt; more text" message="a failure" result="fail"/>
- <!-- tag="quotes &quot; text&quot; more text" message="a message" type="qdebug" -->
- <failure tag="quotes &quot; text&quot; more text" message="a failure" result="fail"/>
- <!-- tag="xml close &gt; open &lt; tags &lt; text" message="a message" type="qdebug" -->
- <failure tag="xml close &gt; open &lt; tags &lt; text" message="a failure" result="fail"/>
- <!-- tag="all &gt; &quot; mixed ]]&gt; up &gt; &quot; in &lt; the ]]&gt; hopes &lt; of triggering &quot;&lt; ]]&gt; bugs" message="a message" type="qdebug" -->
- <failure tag="all &gt; &quot; mixed ]]&gt; up &gt; &quot; in &lt; the ]]&gt; hopes &lt; of triggering &quot;&lt; ]]&gt; bugs" message="a failure" result="fail"/>
+ <!-- tag="fail end cdata ]]&gt; text ]]&gt; more text" message="a message" type="qdebug" -->
+ <failure tag="fail end cdata ]]&gt; text ]]&gt; more text" message="a failure" result="fail"/>
+ <!-- tag="pass end cdata ]]&gt; text ]]&gt; more text" message="a message" type="qdebug" -->
+ <!-- tag="fail quotes &quot; text&quot; more text" message="a message" type="qdebug" -->
+ <failure tag="fail quotes &quot; text&quot; more text" message="a failure" result="fail"/>
+ <!-- tag="pass quotes &quot; text&quot; more text" message="a message" type="qdebug" -->
+ <!-- tag="fail xml close &gt; open &lt; tags &lt; text" message="a message" type="qdebug" -->
+ <failure tag="fail xml close &gt; open &lt; tags &lt; text" message="a failure" result="fail"/>
+ <!-- tag="pass xml close &gt; open &lt; tags &lt; text" message="a message" type="qdebug" -->
+ <!-- tag="fail all &gt; &quot; mixed ]]&gt; up &gt; &quot; in &lt; the ]]&gt; hopes &lt; of triggering &quot;&lt; ]]&gt; bugs" message="a message" type="qdebug" -->
+ <failure tag="fail all &gt; &quot; mixed ]]&gt; up &gt; &quot; in &lt; the ]]&gt; hopes &lt; of triggering &quot;&lt; ]]&gt; bugs" message="a failure" result="fail"/>
+ <!-- tag="pass all &gt; &quot; mixed ]]&gt; up &gt; &quot; in &lt; the ]]&gt; hopes &lt; of triggering &quot;&lt; ]]&gt; bugs" message="a message" type="qdebug" -->
</testcase>
<testcase result="pass" name="badMessage">
<!-- tag="string 0" message="end cdata ]]&gt; text ]]&gt; more text" type="qdebug" -->
@@ -30,6 +34,10 @@
<![CDATA[a message]]>
<![CDATA[a message]]>
<![CDATA[a message]]>
+<![CDATA[a message]]>
+<![CDATA[a message]]>
+<![CDATA[a message]]>
+<![CDATA[a message]]>
<![CDATA[end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]>
<![CDATA[quotes " text" more text]]>
<![CDATA[xml close > open < tags < text]]>
diff --git a/tests/auto/testlib/selftests/expected_benchlibcallgrind.txt b/tests/auto/testlib/selftests/expected_benchlibcallgrind.txt
index 714b67fa77..13e9a39aff 100644
--- a/tests/auto/testlib/selftests/expected_benchlibcallgrind.txt
+++ b/tests/auto/testlib/selftests/expected_benchlibcallgrind.txt
@@ -2,9 +2,8 @@
Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
PASS : tst_BenchlibCallgrind::initTestCase()
PASS : tst_BenchlibCallgrind::twoHundredMillionInstructions()
-PASS : tst_BenchlibCallgrind::twoHundredMillionInstructions()
RESULT : tst_BenchlibCallgrind::twoHundredMillionInstructions():
200,000,158 instruction reads per iteration (total: 200,000,158, iterations: 1)
PASS : tst_BenchlibCallgrind::cleanupTestCase()
-Totals: 4 passed, 0 failed, 0 skipped
+Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of tst_BenchlibCallgrind *********
diff --git a/tests/auto/testlib/selftests/expected_benchlibcounting.lightxml b/tests/auto/testlib/selftests/expected_benchlibcounting.lightxml
new file mode 100644
index 0000000000..5c436a53e0
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_benchlibcounting.lightxml
@@ -0,0 +1,24 @@
+<Environment>
+ <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
+</Environment>
+<TestFunction name="initTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
+<TestFunction name="passingBenchmark">
+<Incident type="pass" file="" line="0" />
+<BenchmarkResult metric="Events" tag="" value="0" iterations="1" />
+</TestFunction>
+<TestFunction name="skippingBenchmark">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/benchlibcounting/tst_benchlibcounting.cpp" line="64">
+ <Description><![CDATA[This is a skipping benchmark]]></Description>
+</Message>
+</TestFunction>
+<TestFunction name="failingBenchmark">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/benchlibcounting/tst_benchlibcounting.cpp" line="71">
+ <Description><![CDATA[This is a failing benchmark]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="cleanupTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
diff --git a/tests/auto/testlib/selftests/expected_benchlibcounting.txt b/tests/auto/testlib/selftests/expected_benchlibcounting.txt
new file mode 100644
index 0000000000..e1af40b9e0
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_benchlibcounting.txt
@@ -0,0 +1,13 @@
+********* Start testing of tst_BenchlibCounting *********
+Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
+PASS : tst_BenchlibCounting::initTestCase()
+PASS : tst_BenchlibCounting::passingBenchmark()
+RESULT : tst_BenchlibCounting::passingBenchmark():
+ 0 events per iteration (total: 0, iterations: 1)
+SKIP : tst_BenchlibCounting::skippingBenchmark() This is a skipping benchmark
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/benchlibcounting/tst_benchlibcounting.cpp(64)]
+FAIL! : tst_BenchlibCounting::failingBenchmark() This is a failing benchmark
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/benchlibcounting/tst_benchlibcounting.cpp(71)]
+PASS : tst_BenchlibCounting::cleanupTestCase()
+Totals: 3 passed, 1 failed, 1 skipped
+********* Finished testing of tst_BenchlibCounting *********
diff --git a/tests/auto/testlib/selftests/expected_benchlibcounting.xml b/tests/auto/testlib/selftests/expected_benchlibcounting.xml
new file mode 100644
index 0000000000..5bf71fbf8e
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_benchlibcounting.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<TestCase name="tst_BenchlibCounting">
+<Environment>
+ <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
+</Environment>
+<TestFunction name="initTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
+<TestFunction name="passingBenchmark">
+<Incident type="pass" file="" line="0" />
+<BenchmarkResult metric="Events" tag="" value="0" iterations="1" />
+</TestFunction>
+<TestFunction name="skippingBenchmark">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/benchlibcounting/tst_benchlibcounting.cpp" line="64">
+ <Description><![CDATA[This is a skipping benchmark]]></Description>
+</Message>
+</TestFunction>
+<TestFunction name="failingBenchmark">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/benchlibcounting/tst_benchlibcounting.cpp" line="71">
+ <Description><![CDATA[This is a failing benchmark]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="cleanupTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
+</TestCase>
diff --git a/tests/auto/testlib/selftests/expected_benchlibcounting.xunitxml b/tests/auto/testlib/selftests/expected_benchlibcounting.xunitxml
new file mode 100644
index 0000000000..83e429aa3a
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_benchlibcounting.xunitxml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuite errors="1" failures="1" tests="5" name="tst_BenchlibCounting">
+ <properties>
+ <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
+ <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
+ </properties>
+ <testcase result="pass" name="initTestCase"/>
+ <testcase result="pass" name="passingBenchmark">
+ </testcase>
+ <testcase name="skippingBenchmark">
+ <!-- message="This is a skipping benchmark" type="skip" -->
+ </testcase>
+ <testcase result="fail" name="failingBenchmark">
+ <failure message="This is a failing benchmark" result="fail"/>
+ </testcase>
+ <testcase result="pass" name="cleanupTestCase"/>
+ <system-err>
+<![CDATA[This is a skipping benchmark]]>
+ </system-err>
+</testsuite>
diff --git a/tests/auto/testlib/selftests/expected_benchliboptions.txt b/tests/auto/testlib/selftests/expected_benchliboptions.txt
index 6d6d91c25e..ef9f0c5ad0 100644
--- a/tests/auto/testlib/selftests/expected_benchliboptions.txt
+++ b/tests/auto/testlib/selftests/expected_benchliboptions.txt
@@ -20,14 +20,8 @@ Totals: 3 passed, 0 failed, 0 skipped
Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
PASS : tst_BenchlibOneHundredMinimum::initTestCase()
PASS : tst_BenchlibOneHundredMinimum::threeEvents()
-PASS : tst_BenchlibOneHundredMinimum::threeEvents()
-PASS : tst_BenchlibOneHundredMinimum::threeEvents()
-PASS : tst_BenchlibOneHundredMinimum::threeEvents()
-PASS : tst_BenchlibOneHundredMinimum::threeEvents()
-PASS : tst_BenchlibOneHundredMinimum::threeEvents()
-PASS : tst_BenchlibOneHundredMinimum::threeEvents()
RESULT : tst_BenchlibOneHundredMinimum::threeEvents():
3.00 events per iteration (total: 192, iterations: 64)
PASS : tst_BenchlibOneHundredMinimum::cleanupTestCase()
-Totals: 9 passed, 0 failed, 0 skipped
+Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of tst_BenchlibOneHundredMinimum *********
diff --git a/tests/auto/testlib/selftests/selftests.pri b/tests/auto/testlib/selftests/selftests.pri
index 2297186f62..0809c4d497 100644
--- a/tests/auto/testlib/selftests/selftests.pri
+++ b/tests/auto/testlib/selftests/selftests.pri
@@ -3,6 +3,7 @@ SUBPROGRAMS = \
assert \
badxml \
benchlibcallgrind \
+ benchlibcounting \
benchlibeventcounter \
benchliboptions \
benchlibtickcounter \
diff --git a/tests/auto/testlib/selftests/selftests.qrc b/tests/auto/testlib/selftests/selftests.qrc
index d2f0a50824..baa539a259 100644
--- a/tests/auto/testlib/selftests/selftests.qrc
+++ b/tests/auto/testlib/selftests/selftests.qrc
@@ -10,6 +10,10 @@
<file>expected_badxml.xml</file>
<file>expected_badxml.xunitxml</file>
<file>expected_benchlibcallgrind.txt</file>
+ <file>expected_benchlibcounting.lightxml</file>
+ <file>expected_benchlibcounting.txt</file>
+ <file>expected_benchlibcounting.xml</file>
+ <file>expected_benchlibcounting.xunitxml</file>
<file>expected_benchlibeventcounter.lightxml</file>
<file>expected_benchlibeventcounter.txt</file>
<file>expected_benchlibeventcounter.xml</file>
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index 7e671a50f2..decaa55386 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -323,6 +323,7 @@ void tst_Selftests::runSubTest_data()
// Only run on platforms where callgrind is available.
<< "benchlibcallgrind"
#endif
+ << "benchlibcounting"
<< "benchlibeventcounter"
<< "benchliboptions"
<< "cmptest"
@@ -399,6 +400,9 @@ void tst_Selftests::runSubTest_data()
else if (subtest == "badxml") {
arguments << "-eventcounter";
}
+ else if (subtest == "benchlibcounting") {
+ arguments << "-eventcounter";
+ }
else if (subtest == "printdatatags") {
arguments << "-datatags";
}