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>
This commit is contained in:
Jason McDonald 2012-02-17 13:39:30 +10:00 committed by Qt by Nokia
parent 4cb09aea6a
commit eb52d78e90
17 changed files with 342 additions and 85 deletions

View File

@ -1490,6 +1490,7 @@ static void qInvokeTestMethodDataEntry(char *slot)
{ {
/* Benchmarking: for each median iteration*/ /* Benchmarking: for each median iteration*/
bool isBenchmark = false;
int i = (QBenchmarkGlobalData::current->measurer->needsWarmupIteration()) ? -1 : 0; int i = (QBenchmarkGlobalData::current->measurer->needsWarmupIteration()) ? -1 : 0;
QList<QBenchmarkResult> results; QList<QBenchmarkResult> results;
@ -1516,25 +1517,30 @@ static void qInvokeTestMethodDataEntry(char *slot)
if (!invokeOk) if (!invokeOk)
QTestResult::addFailure("Unable to execute slot", __FILE__, __LINE__); QTestResult::addFailure("Unable to execute slot", __FILE__, __LINE__);
isBenchmark = QBenchmarkTestMethodData::current->isBenchmark();
QTestResult::finishedCurrentTestData(); QTestResult::finishedCurrentTestData();
invokeMethod(QTest::currentTestObject, "cleanup()"); invokeMethod(QTest::currentTestObject, "cleanup()");
// If the test isn't a benchmark, finalize the result after cleanup() has finished.
if (!isBenchmark)
QTestResult::finishedCurrentTestDataCleanup(); QTestResult::finishedCurrentTestDataCleanup();
// If this test method has a benchmark, repeat until all measurements are // If this test method has a benchmark, repeat until all measurements are
// acceptable. // acceptable.
// The QBENCHMARK macro increases the number of iterations for each run until // The QBENCHMARK macro increases the number of iterations for each run until
// this happens. // this happens.
} while (invokeOk } while (invokeOk && isBenchmark
&& QBenchmarkTestMethodData::current->isBenchmark() && QBenchmarkTestMethodData::current->resultsAccepted() == false
&& QBenchmarkTestMethodData::current->resultsAccepted() == false); && !QTestResult::skipCurrentTest() && !QTestResult::currentTestFailed());
QBenchmarkTestMethodData::current->endDataRun(); QBenchmarkTestMethodData::current->endDataRun();
if (!QTestResult::skipCurrentTest() && !QTestResult::currentTestFailed()) {
if (i > -1) // iteration -1 is the warmup iteration. if (i > -1) // iteration -1 is the warmup iteration.
results.append(QBenchmarkTestMethodData::current->result); results.append(QBenchmarkTestMethodData::current->result);
if (QBenchmarkTestMethodData::current->isBenchmark() && if (isBenchmark && QBenchmarkGlobalData::current->verboseOutput) {
QBenchmarkGlobalData::current->verboseOutput) {
if (i == -1) { if (i == -1) {
QTestLog::info(qPrintable( QTestLog::info(qPrintable(
QString::fromLatin1("warmup stage result : %1") QString::fromLatin1("warmup stage result : %1")
@ -1545,13 +1551,20 @@ static void qInvokeTestMethodDataEntry(char *slot)
.arg(QBenchmarkTestMethodData::current->result.value)), 0, 0); .arg(QBenchmarkTestMethodData::current->result.value)), 0, 0);
} }
} }
} while (QBenchmarkTestMethodData::current->isBenchmark() }
&& (++i < QBenchmarkGlobalData::current->adjustMedianIterationCount())); } while (isBenchmark
&& (++i < QBenchmarkGlobalData::current->adjustMedianIterationCount())
&& !QTestResult::skipCurrentTest() && !QTestResult::currentTestFailed());
if (QBenchmarkTestMethodData::current->isBenchmark() // If the test is a benchmark, finalize the result after all iterations have finished.
&& QBenchmarkTestMethodData::current->resultsAccepted()) if (isBenchmark) {
bool testPassed = !QTestResult::skipCurrentTest() && !QTestResult::currentTestFailed();
QTestResult::finishedCurrentTestDataCleanup();
// Only report benchmark figures if the test passed
if (testPassed && QBenchmarkTestMethodData::current->resultsAccepted())
QTestLog::addBenchmarkResult(qMedian(results)); QTestLog::addBenchmarkResult(qMedian(results));
} }
}
/*! /*!
\internal \internal

View File

@ -106,15 +106,18 @@ void tst_BadXml::badDataTag() const
QBENCHMARK { QBENCHMARK {
} }
QFETCH(bool, shouldFail);
if (shouldFail)
QFAIL("a failure"); QFAIL("a failure");
} }
void tst_BadXml::badDataTag_data() const void tst_BadXml::badDataTag_data() const
{ {
QTest::addColumn<int>("dummy"); QTest::addColumn<bool>("shouldFail");
foreach (char const* str, badStrings()) { 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;
} }
} }

View File

@ -0,0 +1,7 @@
SOURCES += tst_benchlibcounting.cpp
QT = core testlib
mac:CONFIG -= app_bundle
CONFIG -= debug_and_release_target
TARGET = benchlibcounting

View File

@ -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"

View File

@ -7,41 +7,69 @@
</TestFunction> </TestFunction>
<TestFunction name="badDataTag"> <TestFunction name="badDataTag">
<Message type="qdebug" file="" line="0"> <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> <Description><![CDATA[a message]]></Description>
</Message> </Message>
<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109"> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="111">
<DataTag><![CDATA[end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag> <DataTag><![CDATA[fail end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
<Description><![CDATA[a failure]]></Description> <Description><![CDATA[a failure]]></Description>
</Incident> </Incident>
<BenchmarkResult metric="Events" tag="end cdata ]]&gt; text ]]&gt; more text" value="0" iterations="1" />
<Message type="qdebug" file="" line="0"> <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> <Description><![CDATA[a message]]></Description>
</Message> </Message>
<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[quotes " text" more text]]></DataTag> <DataTag><![CDATA[pass end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
<Description><![CDATA[a failure]]></Description>
</Incident> </Incident>
<BenchmarkResult metric="Events" tag="quotes &quot; text&quot; more text" value="0" iterations="1" /> <BenchmarkResult metric="Events" tag="pass end cdata ]]&gt; text ]]&gt; more text" value="0" iterations="1" />
<Message type="qdebug" file="" line="0"> <Message type="qdebug" file="" line="0">
<DataTag><![CDATA[xml close > open < tags < text]]></DataTag> <DataTag><![CDATA[fail quotes " text" more text]]></DataTag>
<Description><![CDATA[a message]]></Description> <Description><![CDATA[a message]]></Description>
</Message> </Message>
<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109"> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="111">
<DataTag><![CDATA[xml close > open < tags < text]]></DataTag> <DataTag><![CDATA[fail quotes " text" more text]]></DataTag>
<Description><![CDATA[a failure]]></Description> <Description><![CDATA[a failure]]></Description>
</Incident> </Incident>
<BenchmarkResult metric="Events" tag="xml close &gt; open &lt; tags &lt; text" value="0" iterations="1" />
<Message type="qdebug" file="" line="0"> <Message type="qdebug" file="" line="0">
<DataTag><![CDATA[all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> <DataTag><![CDATA[pass quotes " text" more text]]></DataTag>
<Description><![CDATA[a message]]></Description> <Description><![CDATA[a message]]></Description>
</Message> </Message>
<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> <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="111">
<DataTag><![CDATA[fail xml close > open < tags < text]]></DataTag>
<Description><![CDATA[a failure]]></Description> <Description><![CDATA[a failure]]></Description>
</Incident> </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 xml close > open < tags < text]]></DataTag>
<Description><![CDATA[a message]]></Description>
</Message>
<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>
<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>
<TestFunction name="badMessage"> <TestFunction name="badMessage">
<Message type="qdebug" file="" line="0"> <Message type="qdebug" file="" line="0">

View File

@ -1,25 +1,33 @@
********* Start testing of tst_BadXml ********* ********* Start testing of tst_BadXml *********
Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@ Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
PASS : tst_BadXml::initTestCase() PASS : tst_BadXml::initTestCase()
QDEBUG : tst_BadXml::badDataTag(end cdata ]]> text ]]> more text) a message QDEBUG : tst_BadXml::badDataTag(fail end cdata ]]> text ]]> more text) a message
FAIL! : tst_BadXml::badDataTag(end cdata ]]> text ]]> more text) a failure 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(109)] Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp(111)]
RESULT : tst_BadXml::badDataTag():"end cdata ]]> text ]]> more text": 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) 0 events per iteration (total: 0, iterations: 1)
QDEBUG : tst_BadXml::badDataTag(quotes " text" more text) a message QDEBUG : tst_BadXml::badDataTag(fail quotes " text" more text) a message
FAIL! : tst_BadXml::badDataTag(quotes " text" more text) a failure 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(109)] Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp(111)]
RESULT : tst_BadXml::badDataTag():"quotes " text" more text": 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) 0 events per iteration (total: 0, iterations: 1)
QDEBUG : tst_BadXml::badDataTag(xml close > open < tags < text) a message QDEBUG : tst_BadXml::badDataTag(fail xml close > open < tags < text) a message
FAIL! : tst_BadXml::badDataTag(xml close > open < tags < text) a failure 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(109)] Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp(111)]
RESULT : tst_BadXml::badDataTag():"xml close > open < tags < text": 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) 0 events per iteration (total: 0, iterations: 1)
QDEBUG : tst_BadXml::badDataTag(all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs) a message QDEBUG : tst_BadXml::badDataTag(fail 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 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(109)] Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp(111)]
RESULT : tst_BadXml::badDataTag():"all > " mixed ]]> up > " in < the ]]> hopes < of triggering "< ]]> bugs": 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) 0 events per iteration (total: 0, iterations: 1)
QDEBUG : tst_BadXml::badMessage(string 0) end cdata ]]> text ]]> more text QDEBUG : tst_BadXml::badMessage(string 0) end cdata ]]> text ]]> more text
PASS : tst_BadXml::badMessage(string 0) 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) PASS : tst_BadXml::badMessage(string 3)
FAIL! : tst_BadXml::failWithNoFile() failure message FAIL! : tst_BadXml::failWithNoFile() failure message
PASS : tst_BadXml::cleanupTestCase() PASS : tst_BadXml::cleanupTestCase()
Totals: 6 passed, 5 failed, 0 skipped Totals: 10 passed, 5 failed, 0 skipped
********* Finished testing of tst_BadXml ********* ********* Finished testing of tst_BadXml *********

View File

@ -9,41 +9,69 @@
</TestFunction> </TestFunction>
<TestFunction name="badDataTag"> <TestFunction name="badDataTag">
<Message type="qdebug" file="" line="0"> <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> <Description><![CDATA[a message]]></Description>
</Message> </Message>
<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109"> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="111">
<DataTag><![CDATA[end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag> <DataTag><![CDATA[fail end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
<Description><![CDATA[a failure]]></Description> <Description><![CDATA[a failure]]></Description>
</Incident> </Incident>
<BenchmarkResult metric="Events" tag="end cdata ]]&gt; text ]]&gt; more text" value="0" iterations="1" />
<Message type="qdebug" file="" line="0"> <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> <Description><![CDATA[a message]]></Description>
</Message> </Message>
<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[quotes " text" more text]]></DataTag> <DataTag><![CDATA[pass end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]></DataTag>
<Description><![CDATA[a failure]]></Description>
</Incident> </Incident>
<BenchmarkResult metric="Events" tag="quotes &quot; text&quot; more text" value="0" iterations="1" /> <BenchmarkResult metric="Events" tag="pass end cdata ]]&gt; text ]]&gt; more text" value="0" iterations="1" />
<Message type="qdebug" file="" line="0"> <Message type="qdebug" file="" line="0">
<DataTag><![CDATA[xml close > open < tags < text]]></DataTag> <DataTag><![CDATA[fail quotes " text" more text]]></DataTag>
<Description><![CDATA[a message]]></Description> <Description><![CDATA[a message]]></Description>
</Message> </Message>
<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109"> <Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="111">
<DataTag><![CDATA[xml close > open < tags < text]]></DataTag> <DataTag><![CDATA[fail quotes " text" more text]]></DataTag>
<Description><![CDATA[a failure]]></Description> <Description><![CDATA[a failure]]></Description>
</Incident> </Incident>
<BenchmarkResult metric="Events" tag="xml close &gt; open &lt; tags &lt; text" value="0" iterations="1" />
<Message type="qdebug" file="" line="0"> <Message type="qdebug" file="" line="0">
<DataTag><![CDATA[all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> <DataTag><![CDATA[pass quotes " text" more text]]></DataTag>
<Description><![CDATA[a message]]></Description> <Description><![CDATA[a message]]></Description>
</Message> </Message>
<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/badxml/tst_badxml.cpp" line="109"> <Incident type="pass" file="" line="0">
<DataTag><![CDATA[all > " mixed ]]]><![CDATA[]> up > " in < the ]]]><![CDATA[]> hopes < of triggering "< ]]]><![CDATA[]> bugs]]></DataTag> <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="111">
<DataTag><![CDATA[fail xml close > open < tags < text]]></DataTag>
<Description><![CDATA[a failure]]></Description> <Description><![CDATA[a failure]]></Description>
</Incident> </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 xml close > open < tags < text]]></DataTag>
<Description><![CDATA[a message]]></Description>
</Message>
<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>
<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>
<TestFunction name="badMessage"> <TestFunction name="badMessage">
<Message type="qdebug" file="" line="0"> <Message type="qdebug" file="" line="0">

View File

@ -1,19 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?> <?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> <properties>
<property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
<property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/> <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
</properties> </properties>
<testcase result="pass" name="initTestCase"/> <testcase result="pass" name="initTestCase"/>
<testcase result="fail" name="badDataTag"> <testcase result="fail" name="badDataTag">
<!-- tag="end cdata ]]&gt; text ]]&gt; more text" message="a message" type="qdebug" --> <!-- tag="fail 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"/> <failure tag="fail end cdata ]]&gt; text ]]&gt; more text" message="a failure" result="fail"/>
<!-- tag="quotes &quot; text&quot; more text" message="a message" type="qdebug" --> <!-- tag="pass end cdata ]]&gt; text ]]&gt; more text" message="a message" type="qdebug" -->
<failure tag="quotes &quot; text&quot; more text" message="a failure" result="fail"/> <!-- tag="fail quotes &quot; text&quot; more text" message="a message" type="qdebug" -->
<!-- tag="xml close &gt; open &lt; tags &lt; text" message="a message" type="qdebug" --> <failure tag="fail quotes &quot; text&quot; more text" message="a failure" result="fail"/>
<failure tag="xml close &gt; open &lt; tags &lt; text" message="a failure" result="fail"/> <!-- tag="pass quotes &quot; text&quot; more text" message="a message" type="qdebug" -->
<!-- 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" --> <!-- tag="fail xml close &gt; open &lt; tags &lt; text" 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"/> <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>
<testcase result="pass" name="badMessage"> <testcase result="pass" name="badMessage">
<!-- tag="string 0" message="end cdata ]]&gt; text ]]&gt; more text" type="qdebug" --> <!-- 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[a message]]>
<![CDATA[a message]]>
<![CDATA[a message]]>
<![CDATA[end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]> <![CDATA[end cdata ]]]><![CDATA[]> text ]]]><![CDATA[]> more text]]>
<![CDATA[quotes " text" more text]]> <![CDATA[quotes " text" more text]]>
<![CDATA[xml close > open < tags < text]]> <![CDATA[xml close > open < tags < text]]>

View File

@ -2,9 +2,8 @@
Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@ Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
PASS : tst_BenchlibCallgrind::initTestCase() PASS : tst_BenchlibCallgrind::initTestCase()
PASS : tst_BenchlibCallgrind::twoHundredMillionInstructions() PASS : tst_BenchlibCallgrind::twoHundredMillionInstructions()
PASS : tst_BenchlibCallgrind::twoHundredMillionInstructions()
RESULT : tst_BenchlibCallgrind::twoHundredMillionInstructions(): RESULT : tst_BenchlibCallgrind::twoHundredMillionInstructions():
200,000,158 instruction reads per iteration (total: 200,000,158, iterations: 1) 200,000,158 instruction reads per iteration (total: 200,000,158, iterations: 1)
PASS : tst_BenchlibCallgrind::cleanupTestCase() PASS : tst_BenchlibCallgrind::cleanupTestCase()
Totals: 4 passed, 0 failed, 0 skipped Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of tst_BenchlibCallgrind ********* ********* Finished testing of tst_BenchlibCallgrind *********

View File

@ -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>

View File

@ -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 *********

View File

@ -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>

View File

@ -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>

View File

@ -20,14 +20,8 @@ Totals: 3 passed, 0 failed, 0 skipped
Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@ Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
PASS : tst_BenchlibOneHundredMinimum::initTestCase() 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()
PASS : tst_BenchlibOneHundredMinimum::threeEvents()
RESULT : tst_BenchlibOneHundredMinimum::threeEvents(): RESULT : tst_BenchlibOneHundredMinimum::threeEvents():
3.00 events per iteration (total: 192, iterations: 64) 3.00 events per iteration (total: 192, iterations: 64)
PASS : tst_BenchlibOneHundredMinimum::cleanupTestCase() PASS : tst_BenchlibOneHundredMinimum::cleanupTestCase()
Totals: 9 passed, 0 failed, 0 skipped Totals: 3 passed, 0 failed, 0 skipped
********* Finished testing of tst_BenchlibOneHundredMinimum ********* ********* Finished testing of tst_BenchlibOneHundredMinimum *********

View File

@ -3,6 +3,7 @@ SUBPROGRAMS = \
assert \ assert \
badxml \ badxml \
benchlibcallgrind \ benchlibcallgrind \
benchlibcounting \
benchlibeventcounter \ benchlibeventcounter \
benchliboptions \ benchliboptions \
benchlibtickcounter \ benchlibtickcounter \

View File

@ -10,6 +10,10 @@
<file>expected_badxml.xml</file> <file>expected_badxml.xml</file>
<file>expected_badxml.xunitxml</file> <file>expected_badxml.xunitxml</file>
<file>expected_benchlibcallgrind.txt</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.lightxml</file>
<file>expected_benchlibeventcounter.txt</file> <file>expected_benchlibeventcounter.txt</file>
<file>expected_benchlibeventcounter.xml</file> <file>expected_benchlibeventcounter.xml</file>

View File

@ -323,6 +323,7 @@ void tst_Selftests::runSubTest_data()
// Only run on platforms where callgrind is available. // Only run on platforms where callgrind is available.
<< "benchlibcallgrind" << "benchlibcallgrind"
#endif #endif
<< "benchlibcounting"
<< "benchlibeventcounter" << "benchlibeventcounter"
<< "benchliboptions" << "benchliboptions"
<< "cmptest" << "cmptest"
@ -399,6 +400,9 @@ void tst_Selftests::runSubTest_data()
else if (subtest == "badxml") { else if (subtest == "badxml") {
arguments << "-eventcounter"; arguments << "-eventcounter";
} }
else if (subtest == "benchlibcounting") {
arguments << "-eventcounter";
}
else if (subtest == "printdatatags") { else if (subtest == "printdatatags") {
arguments << "-datatags"; arguments << "-datatags";
} }