diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2017-10-10 13:43:15 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2017-10-11 13:31:43 +0000 |
commit | ffd822b968037716bf1c6adadef6919b1b90e8b4 (patch) | |
tree | e184e9fe1d8693b007d3fc5f9b7ebc71e230d1ad | |
parent | 98ef376fb6053ab4171fa9b7c98916f0dbb1b798 (diff) |
Force QT_LOGGING_RULES in testlib's selftest
On some systems (e.g. Debian/buster) a standard Qt package may install
a qtlogging.ini file, e.g. in /etc/xdg/QtProject/, which suppresses
QDEBUG output. A ~/.config/QtProject/qtlogging.ini could interfere
similarly. This can break the selftest, when run with expected_*
files generated without such interference. Likewise, if those
expected_* files are generated on a system such similar, they won't
work on CI. Given that this caused confusion and delay with
integrating the latest set of updates to the expected_* files, it
seemed best to save others from similar bafflement.
So set a standard value for QT_LOGGING_RULES in both the selftest and
the generator script, so we get consistency.
Change-Id: I649e2f1f6ead21edf8af051aaee286e369fed064
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
-rwxr-xr-x | tests/auto/testlib/selftests/generate_expected_output.py | 8 | ||||
-rw-r--r-- | tests/auto/testlib/selftests/tst_selftests.cpp | 4 |
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 a3a66da98b..6c14d75ea6 100755 --- a/tests/auto/testlib/selftests/generate_expected_output.py +++ b/tests/auto/testlib/selftests/generate_expected_output.py @@ -252,7 +252,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.qpa.screen=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 64f324e26c..9bb3c9b2d4 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -568,6 +568,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.qpa.screen=false")); } return result; } |