gh-112536: Add TSAN builds on Github Actions (#116872)

This commit is contained in:
Donghee Na 2024-03-16 19:10:37 +09:00 committed by GitHub
parent a1c4923d65
commit 20578a1f68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 93 additions and 0 deletions

View file

@ -50,6 +50,11 @@ def skip_unless_reliable_fork(test):
return test
skip_if_tsan_fork = unittest.skipIf(
support.check_sanitizer(thread=True),
"TSAN doesn't support threads after fork")
def requires_subinterpreters(meth):
"""Decorator to skip a test if subinterpreters are not supported."""
return unittest.skipIf(interpreters is None,
@ -634,6 +639,7 @@ class ThreadTests(BaseTestCase):
self.assertTrue(t.daemon)
@skip_unless_reliable_fork
@skip_if_tsan_fork
def test_dummy_thread_after_fork(self):
# Issue #14308: a dummy thread in the active list doesn't mess up
# the after-fork mechanism.
@ -703,6 +709,7 @@ class ThreadTests(BaseTestCase):
@skip_unless_reliable_fork
@unittest.skipUnless(hasattr(os, 'waitpid'), "test needs os.waitpid()")
@skip_if_tsan_fork
def test_main_thread_after_fork(self):
code = """if 1:
import os, threading
@ -1271,6 +1278,7 @@ class ThreadJoinOnShutdown(BaseTestCase):
self._run_and_join(script)
@skip_unless_reliable_fork
@skip_if_tsan_fork
def test_3_join_in_forked_from_thread(self):
# Like the test above, but fork() was called from a worker thread
# In the forked process, the main Thread object must be marked as stopped.