testlib: Don't set QT_LOGGING_TO_CONSOLE

QtTestLib has its own message handler installed via qInstallMessageHandler,
so there is no need to set QT_LOGGING_TO_CONSOLE to force stderr output,
as that's what QPlainTestLogger::outputMessage uses anyways.

And in the case of using other testlib outputs such as XML, we're not going
to hit any of the code paths that would check QT_LOGGING_TO_CONSOLE.

The only relevant exception is Windows, which checks stderrHasConsoleAttached(),
which is affected by QT_LOGGING_TO_CONSOLE, but Qt Creator actually has an
explicit inversion of this existing code, to prevent it from setting
QT_LOGGING_TO_CONSOLE, so that output ends up in OutputDebugStringA
and can be read and distinguished from the debugger's output.
See QTCREATORBUG-16161.

Change-Id: Ia8a9b00b221ec5691b52485586f172c9261bf299
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Tor Arne Vestbø 2018-02-08 15:10:34 +01:00
parent 24a93798b8
commit 0b48fcee70

View File

@ -1667,15 +1667,8 @@ static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo)
}
#endif // Q_OS_WIN) && !Q_OS_WINRT
static void qputenvIfEmpty(const char *name, const QByteArray &value)
{
if (qEnvironmentVariableIsEmpty(name))
qputenv(name, value);
}
static void initEnvironment()
{
qputenvIfEmpty("QT_LOGGING_TO_CONSOLE", "1");
qputenv("QT_QTESTLIB_RUNNING", "1");
}