summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-07-05 10:54:26 (GMT)
committerGitHub <noreply@github.com>2023-07-05 10:54:26 (GMT)
commitfc2393e4177d32dab0c73f69472dc1b726dbeeaf (patch)
tree975c1b7a8c7b76bd77a3fb71aa206b5488432840 /Lib/test
parent334b95b2434880e6138d430054c3054266e6020f (diff)
downloadcpython-fc2393e4177d32dab0c73f69472dc1b726dbeeaf.zip
cpython-fc2393e4177d32dab0c73f69472dc1b726dbeeaf.tar.gz
cpython-fc2393e4177d32dab0c73f69472dc1b726dbeeaf.tar.bz2
[3.12] Display the sanitizer config in the regrtest header. (GH-105301) (#105342)
Display the sanitizer config in the regrtest header. (GH-105301) Display the sanitizers present in libregrtest. Having this in the CI output for tests with the relevant environment variable displayed will help make it easier to do what we need to create an equivalent local test run. (cherry picked from commit 852348ab65783601e0844b6647ea033668b45c11) Co-authored-by: Gregory P. Smith <greg@krypto.org>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/libregrtest/main.py20
-rw-r--r--Lib/test/support/__init__.py2
2 files changed, 21 insertions, 1 deletions
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index 3c3509d..9001ca3 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -526,6 +526,26 @@ class Regrtest:
print("== CPU count:", cpu_count)
print("== encodings: locale=%s, FS=%s"
% (locale.getencoding(), sys.getfilesystemencoding()))
+ asan = support.check_sanitizer(address=True)
+ msan = support.check_sanitizer(memory=True)
+ ubsan = support.check_sanitizer(ub=True)
+ # This makes it easier to remember what to set in your local
+ # environment when trying to reproduce a sanitizer failure.
+ if asan or msan or ubsan:
+ names = [n for n in (asan and "address",
+ msan and "memory",
+ ubsan and "undefined behavior")
+ if n]
+ print(f"== sanitizers: {', '.join(names)}")
+ a_opts = os.environ.get("ASAN_OPTIONS")
+ if asan and a_opts is not None:
+ print(f"== ASAN_OPTIONS={a_opts}")
+ m_opts = os.environ.get("ASAN_OPTIONS")
+ if msan and m_opts is not None:
+ print(f"== MSAN_OPTIONS={m_opts}")
+ ub_opts = os.environ.get("UBSAN_OPTIONS")
+ if ubsan and ub_opts is not None:
+ print(f"== UBSAN_OPTIONS={ub_opts}")
def no_tests_run(self):
return not any((self.good, self.bad, self.skipped, self.interrupted,
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 3f1cc3a..3b332f4 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -414,7 +414,7 @@ def check_sanitizer(*, address=False, memory=False, ub=False):
)
address_sanitizer = (
'-fsanitize=address' in _cflags or
- '--with-memory-sanitizer' in _config_args
+ '--with-address-sanitizer' in _config_args
)
ub_sanitizer = (
'-fsanitize=undefined' in _cflags or