mirror of
https://github.com/python/cpython.git
synced 2025-08-15 14:20:55 +00:00
[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>
This commit is contained in:
parent
2ac1b48a04
commit
fcb230180f
8 changed files with 64 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue