summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestlog.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-01-17 16:03:03 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-03-05 22:29:57 +0000
commit18da1dac20c7d27342e987586a16d125e39197c9 (patch)
tree099503358097e5dfadebfbcfdeabb75cc6b26121 /src/testlib/qtestlog.cpp
parent83864b315ff48bca33c39e1bdc03e522f68214fd (diff)
testlib: Prevent Apple test logger from stomping on other loggers
We were potentially adding the Apple test logger multiple times, and we didn't consider whether the existing loggers were logging to file or not when circumventing them. We now don't use the Apple logger if it would touch stderr and some other logger is using stdout. In the case of no explicit logger being specified on the command line, we allow the Apple logger to take priority over the default plain test logger. Change-Id: I31bbec4f4b3ab84ba9a2be35e8e5db08fee071a7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/testlib/qtestlog.cpp')
-rw-r--r--src/testlib/qtestlog.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index 80f905e962..57bb7d95a7 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -460,6 +460,11 @@ void QTestLog::addLogger(LogMode mode, const char *filename)
case QTestLog::TAP:
logger = new QTapTestLogger(filename);
break;
+#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
+ case QTestLog::Apple:
+ logger = new QAppleTestLogger;
+ break;
+#endif
#if defined(HAVE_XCTEST)
case QTestLog::XCTest:
logger = new QXcodeTestLogger;
@@ -467,14 +472,6 @@ void QTestLog::addLogger(LogMode mode, const char *filename)
#endif
}
-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
- // Logger that also feeds messages to AUL. It needs to wrap the existing
- // logger, as it needs to be able to short circuit the existing logger
- // in case AUL prints to stderr.
- if (QAppleTestLogger::debugLoggingEnabled())
- logger = new QAppleTestLogger(logger);
-#endif
-
QTEST_ASSERT(logger);
QTest::loggers.append(logger);
}