gh-112536: Add --tsan test for reasonable TSAN execution times. by corona10 · Pull Request #116601 · python/cpython · GitHub
Skip to content
Merged
3 changes: 3 additions & 0 deletions Lib/test/libregrtest/cmdline.py
5 changes: 5 additions & 0 deletions Lib/test/libregrtest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from .runtests import RunTests, HuntRefleak
from .setup import setup_process, setup_test_dir
from .single import run_single_test, PROGRESS_MIN_TIME
from .tsan import setup_tsan_tests
from .utils import (
StrPath, StrJSON, TestName, TestList, TestTuple, TestFilter,
strip_py_suffix, count, format_duration,
Expand Down Expand Up @@ -56,6 +57,7 @@ def __init__(self, ns: Namespace, _add_python_opts: bool = False):
self.quiet: bool = ns.quiet
self.pgo: bool = ns.pgo
self.pgo_extended: bool = ns.pgo_extended
self.tsan: bool = ns.tsan

# Test results
self.results: TestResults = TestResults()
Expand Down Expand Up @@ -183,6 +185,9 @@ def find_tests(self, tests: TestList | None = None) -> tuple[TestTuple, TestList
# add default PGO tests if no tests are specified
setup_pgo_tests(self.cmdline_args, self.pgo_extended)

if self.tsan:
setup_tsan_tests(self.cmdline_args)

exclude_tests = set()
if self.exclude:
for arg in self.cmdline_args:
Expand Down
24 changes: 24 additions & 0 deletions Lib/test/libregrtest/tsan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Set of tests run by default if --tsan is specified. The tests below were
# chosen because they use threads and run in a reasonable amount of time.

TSAN_TESTS = [
'test_code',
'test_enum',
'test_functools',
'test_httpservers',
'test_imaplib',
'test_importlib',
'test_io',
'test_logging',
'test_ssl',
'test_syslog',
'test_thread',
'test_threadedtempfile',
'test_threading_local',
'test_threadsignals',
]


def setup_tsan_tests(cmdline_args):
if not cmdline_args:
cmdline_args[:] = TSAN_TESTS[:]
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add --tsan to test.regrtest for running TSAN tests in reasonable execution
times. Patch by Donghee Na.
5 changes: 5 additions & 0 deletions Tools/tsan/supressions.txt