diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-08-30 18:36:46 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-01 03:10:39 +0200 |
commit | b17e9b3d94dc041ed80854076d2053e2c750eb50 (patch) | |
tree | a9835f6e982f071a59653d5dfb8680309c13159f /src/testlib/qtestlog.cpp | |
parent | a4878db8df3fbaf9d222ec1206813b16dcdd90c7 (diff) |
Simplify qtestlib logging code, part 1
Both the old and new XML loggers produce the Complete and Light XML log
formats, while only the new logger produces Xunit XML logs. The
disadvantage of the new logger is that it is more complex and doesn't
produce a partial log if the test fails to terminate gracefully. This
behaviour arises because Xunit format output cannot be written correctly
until all tests have been executed.
This commit removes the Complete and Light XML formats from the new
logger, using the old logger to produce those formats and the new logger
to produce only Xunit XML. Prior to this commit, the qtestlib selftests
demonstrate that the old and new loggers produce identical output for
Complete and Light XML.
This commit also removes the undocumented -flush command-line option,
which was used rather obscurely to select between the old and new
loggers.
The newer logger will be renamed to QXunitTestLogger in a subsequent
commit.
Change-Id: Id304f5b411bdd520409ee233f6bc34e8917942ab
Reviewed-on: http://codereview.qt.nokia.com/3923
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'src/testlib/qtestlog.cpp')
-rw-r--r-- | src/testlib/qtestlog.cpp | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 0a87a4ce14..77ddae65be 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -83,7 +83,6 @@ namespace QTest { static IgnoreResultList *ignoreResultList = 0; static QTestLog::LogMode logMode = QTestLog::Plain; - static QTestLog::FlushMode flushMode = QTestLog::NoFlush; static int verbosity = 0; static int maxWarnings = 2002; @@ -173,22 +172,16 @@ namespace QTest { QTest::testLogger = new QPlainTestLogger; break; case QTestLog::XML: - if (QTest::flushMode == QTestLog::FlushOn) - QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Complete); - else - QTest::testLogger = new QTestLogger(QTestLogger::TLF_XML); + QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Complete); break; case QTestLog::LightXML: - if (QTest::flushMode == QTestLog::FlushOn) - QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Light); - else - QTest::testLogger = new QTestLogger(QTestLogger::TLF_LightXml); + QTest::testLogger = new QXmlTestLogger(QXmlTestLogger::Light); break; case QTestLog::XunitXML: - QTest::testLogger = new QTestLogger(QTestLogger::TLF_XunitXml); + QTest::testLogger = new QTestLogger(); + break; } } - } void QTestLog::enterTestFunction(const char* function) @@ -368,9 +361,4 @@ void QTestLog::setMaxWarnings(int m) QTest::maxWarnings = m <= 0 ? INT_MAX : m + 2; } -void QTestLog::setFlushMode(FlushMode mode) -{ - QTest::flushMode = mode; -} - QT_END_NAMESPACE |