summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2023-10-12 16:05:28 +0800
committerMitch Curtis <mitch.curtis@qt.io>2023-10-16 12:37:08 +0800
commit3f2b54f0a1749eb8a52e99dbba6af4839e36cb90 (patch)
treed5dd882c65d668f01d359b712d308c21f1e93494 /tests/auto/testlib
parentb470da91073fab7a51a75d0d6cd3184e297b20cf (diff)
selftests: respect ASAN_OPTIONS
Ensure that this environment variable is respected, as ASAN errors (e.g. memory leaks) can cause the selftests to fail since they expect no errors in their output. Fix an incorrect function name in a comment, while we're at it. Fixes: QTBUG-118041 Pick-to: 6.5 6.6 Change-Id: I07502101aabd8743df898ae8fe4a693c4733c4af Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/testlib')
-rwxr-xr-xtests/auto/testlib/selftests/generate_expected_output.py4
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp1
2 files changed, 3 insertions, 2 deletions
diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py
index 2a7a070640..c39c00772a 100755
--- a/tests/auto/testlib/selftests/generate_expected_output.py
+++ b/tests/auto/testlib/selftests/generate_expected_output.py
@@ -201,9 +201,9 @@ class Scanner (object):
del re
-# Keep in sync with tst_selftests.cpp's processEnvironment():
+# Keep in sync with tst_selftests.cpp's testEnvironment():
def baseEnv(platname=None,
- keep=('PATH', 'QT_QPA_PLATFORM'),
+ keep=('PATH', 'QT_QPA_PLATFORM', 'ASAN_OPTIONS'),
posix=('HOME', 'USER', 'QEMU_SET_ENV', 'QEMU_LD_PREFIX'),
nonapple=('DISPLAY', 'XAUTHORITY', 'XAUTHLOCALHOSTNAME'), # and XDG_*
# Don't actually know how to test for QNX, so this is ignored:
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index adcc32da6b..06c61e8ff2 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -931,6 +931,7 @@ static QProcessEnvironment testEnvironment()
const auto envKeys = systemEnvironment.keys();
for (const QString &key : envKeys) {
const bool useVariable = key == "PATH" || key == "QT_QPA_PLATFORM"
+ || key == "ASAN_OPTIONS"
#if defined(Q_OS_QNX)
|| key == "GRAPHICS_ROOT" || key == "TZ"
#elif defined(Q_OS_UNIX)