diff options
author | Antoine Pitrou <antoine@python.org> | 2024-03-18 09:22:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-18 09:22:19 (GMT) |
commit | fcb230180faff828aa67ca2ee1aa94fc522e6daa (patch) | |
tree | 506950e0cd5d6b9aed881395189988c29b6a085c /Lib/test/test_threading.py | |
parent | 2ac1b48a044429d7a290310348b53a87b9f2033a (diff) | |
download | cpython-fcb230180faff828aa67ca2ee1aa94fc522e6daa.zip cpython-fcb230180faff828aa67ca2ee1aa94fc522e6daa.tar.gz cpython-fcb230180faff828aa67ca2ee1aa94fc522e6daa.tar.bz2 |
[3.12] gh-112536: Add --tsan test for reasonable TSAN execution times. (gh-116601) (#116929)
(cherry picked from commit ebf29b3)
Co-authored-by: Donghee Na <donghee.na@python.org>
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r-- | Lib/test/test_threading.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 00d9e59..119b41f 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -47,6 +47,8 @@ def skip_unless_reliable_fork(test): return unittest.skip("due to known OS bug related to thread+fork")(test) if support.HAVE_ASAN_FORK_BUG: return unittest.skip("libasan has a pthread_create() dead lock related to thread+fork")(test) + if support.check_sanitizer(thread=True): + return unittest.skip("TSAN doesn't support threads after fork") return test @@ -384,6 +386,10 @@ class ThreadTests(BaseTestCase): # Issue 1402: the PyGILState_Ensure / _Release functions may be called # very late on python exit: on deallocation of a running thread for # example. + if support.check_sanitizer(thread=True): + # the thread running `time.sleep(100)` below will still be alive + # at process exit + self.skipTest("TSAN would report thread leak") import_module("ctypes") rc, out, err = assert_python_failure("-c", """if 1: @@ -416,6 +422,11 @@ class ThreadTests(BaseTestCase): def test_finalize_with_trace(self): # Issue1733757 # Avoid a deadlock when sys.settrace steps into threading._shutdown + if support.check_sanitizer(thread=True): + # the thread running `time.sleep(2)` below will still be alive + # at process exit + self.skipTest("TSAN would report thread leak") + assert_python_ok("-c", """if 1: import sys, threading @@ -1223,6 +1234,11 @@ class ThreadJoinOnShutdown(BaseTestCase): # Check that a daemon thread cannot crash the interpreter on shutdown # by manipulating internal structures that are being disposed of in # the main thread. + if support.check_sanitizer(thread=True): + # some of the threads running `random_io` below will still be alive + # at process exit + self.skipTest("TSAN would report thread leak") + script = """if True: import os import random |