summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-03-09 12:03:01 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-03-14 14:28:14 +0000
commit49051ef831126e2fae26ac2bc8c9aee5bd3a48aa (patch)
tree334f1cb70b14ffc0c1b9f979bab4527fc075db50 /tests
parent19e0fc747ea3acf069c8c26c8fb2f1941bc916f2 (diff)
testlib: Silence all Qt logging in selftests
Otherwise random debug messages from Qt might mess up the expected vs actual results. Task-number: QTQAINFRA-1631 Change-Id: I855d31274f8261f8b125df23409353f7101be0e4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 3ae03c3585df7247f5699eeaa70e1bedf47f6d5b)
Diffstat (limited to 'tests')
-rwxr-xr-xtests/auto/testlib/selftests/generate_expected_output.py8
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp4
2 files changed, 11 insertions, 1 deletions
diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py
index 202c4cc426..1ee767cc97 100755
--- a/tests/auto/testlib/selftests/generate_expected_output.py
+++ b/tests/auto/testlib/selftests/generate_expected_output.py
@@ -186,7 +186,13 @@ def generateTestData(testname, clean,
def main(name, *args):
"""Minimal argument parsing and driver for the real work"""
- os.environ['LC_ALL'] = 'C'
+ os.environ.update(
+ LC_ALL = 'C', # Use standard locale
+ # 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.*=false')
+
herePath = os.getcwd()
cleaner = Cleaner(herePath, name)
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index e7123fc059..8164c53b67 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -567,6 +567,10 @@ static QProcessEnvironment processEnvironment()
if (useVariable)
result.insert(key, systemEnvironment.value(key));
}
+ // 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.*=false"));
}
return result;
}