testlib: Silence all Qt logging in selftests

Otherwise random debug messages from Qt might mess up the expected vs
actual results.

The setting of QT_LOGGING_RULES in initTestcase has been removed, as
the selftest overrides that for each invocation of a subtests, via
the processEnvironment() function.

Task-number: QTQAINFRA-1631
Change-Id: I855d31274f8261f8b125df23409353f7101be0e4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
bb10
Tor Arne Vestbø 2018-03-09 12:03:01 +01:00
parent 5473535344
commit 3ae03c3585
2 changed files with 2 additions and 3 deletions

View File

@ -257,7 +257,7 @@ def main(name, *args):
# Avoid interference from any qtlogging.ini files, e.g. in
# /etc/xdg/QtProject/, (must match tst_selftests.cpp's
# processEnvironment()'s value):
QT_LOGGING_RULES = '*.debug=true;qt.qpa.screen=false')
QT_LOGGING_RULES = '*.debug=true;qt.*=false')
herePath = os.getcwd()
cleaner = Cleaner(herePath, name)

View File

@ -404,7 +404,6 @@ tst_Selftests::tst_Selftests()
void tst_Selftests::initTestCase()
{
QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString()));
qputenv("QT_LOGGING_RULES", QByteArrayLiteral("*.debug=false")); // Silence any debug output
//Detect the location of the sub programs
QString subProgram = QLatin1String("float/float");
#if defined(Q_OS_WIN)
@ -644,7 +643,7 @@ static QProcessEnvironment processEnvironment()
// Avoid interference from any qtlogging.ini files, e.g. in /etc/xdg/QtProject/:
result.insert(QStringLiteral("QT_LOGGING_RULES"),
// Must match generate_expected_output.py's main()'s value:
QStringLiteral("*.debug=true;qt.qpa.screen=false"));
QStringLiteral("*.debug=true;qt.*=false"));
}
return result;
}