summaryrefslogtreecommitdiffstats
path: root/src/testlib/qplaintestlogger.cpp
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2012-02-27 16:31:03 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-28 05:56:03 +0100
commitcbc777374a26134e87054b2292a800d4b3835d82 (patch)
treee71eaa141bbb4a502eeae11e6823220725723d85 /src/testlib/qplaintestlogger.cpp
parent8cacf68cdf5a8211811ca8a30a75f6979682cb1f (diff)
testlib: Improve the silent logging mode
Previously the silent logging mode suppressed passes, skips and internal testlib info messages, but did not suppress debugging output, making it hard to see the fails in a noisy test. This commit changes silent mode so that it suppresses all output except test failures and fatal errors, making silent mode truly useful for seeing just the important test output. This commit also adds a selftest to verify the behaviour of silent mode. Change-Id: I75420aead03682306210746a87e2a3b608b58fc6 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'src/testlib/qplaintestlogger.cpp')
-rw-r--r--src/testlib/qplaintestlogger.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp
index ca86387216..2f87e08c3c 100644
--- a/src/testlib/qplaintestlogger.cpp
+++ b/src/testlib/qplaintestlogger.cpp
@@ -371,8 +371,9 @@ void QPlainTestLogger::leaveTestFunction()
void QPlainTestLogger::addIncident(IncidentTypes type, const char *description,
const char *file, int line)
{
- // suppress PASS in silent mode
- if (type == QAbstractTestLogger::Pass && QTestLog::verboseLevel() < 0)
+ // suppress PASS and XFAIL in silent mode
+ if ((type == QAbstractTestLogger::Pass || type == QAbstractTestLogger::XFail)
+ && QTestLog::verboseLevel() < 0)
return;
printMessage(QTest::incidentType2String(type), description, file, line);
@@ -380,15 +381,18 @@ void QPlainTestLogger::addIncident(IncidentTypes type, const char *description,
void QPlainTestLogger::addBenchmarkResult(const QBenchmarkResult &result)
{
+ // suppress benchmark results in silent mode
+ if (QTestLog::verboseLevel() < 0)
+ return;
+
printBenchmarkResult(result);
}
void QPlainTestLogger::addMessage(MessageTypes type, const char *message,
const char *file, int line)
{
- // suppress PASS in silent mode
- if ((type == QAbstractTestLogger::Skip || type == QAbstractTestLogger::Info)
- && QTestLog::verboseLevel() < 0)
+ // suppress non-fatal messages in silent mode
+ if (type != QAbstractTestLogger::QFatal && QTestLog::verboseLevel() < 0)
return;
printMessage(QTest::messageType2String(type), message, file, line);