summaryrefslogtreecommitdiffstats
path: root/src/testlib
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
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')
-rw-r--r--src/testlib/qplaintestlogger.cpp14
-rw-r--r--src/testlib/qtestcase.cpp2
2 files changed, 10 insertions, 6 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);
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index b8678ba04c..a4f1a39bbd 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1192,7 +1192,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
" *** If no output format is specified, -txt is assumed.\n"
"\n"
" Detail options:\n"
- " -silent : Only outputs warnings and failures\n"
+ " -silent : Only output failures and fatal errors in plain text output\n"
" -v1 : Print enter messages for each testfunction\n"
" -v2 : Also print out each QVERIFY/QCOMPARE/QTEST\n"
" -vs : Print every signal emitted\n"