mirror of
https://github.com/python/cpython.git
synced 2025-08-07 18:38:38 +00:00
gh-112536: Add --tsan test for reasonable TSAN execution times. (gh-116601)
This commit is contained in:
parent
16349868d3
commit
ebf29b3a02
5 changed files with 39 additions and 0 deletions
|
@ -164,6 +164,7 @@ class Namespace(argparse.Namespace):
|
||||||
self.match_tests: TestFilter = []
|
self.match_tests: TestFilter = []
|
||||||
self.pgo = False
|
self.pgo = False
|
||||||
self.pgo_extended = False
|
self.pgo_extended = False
|
||||||
|
self.tsan = False
|
||||||
self.worker_json = None
|
self.worker_json = None
|
||||||
self.start = None
|
self.start = None
|
||||||
self.timeout = None
|
self.timeout = None
|
||||||
|
@ -333,6 +334,8 @@ def _create_parser():
|
||||||
help='enable Profile Guided Optimization (PGO) training')
|
help='enable Profile Guided Optimization (PGO) training')
|
||||||
group.add_argument('--pgo-extended', action='store_true',
|
group.add_argument('--pgo-extended', action='store_true',
|
||||||
help='enable extended PGO training (slower training)')
|
help='enable extended PGO training (slower training)')
|
||||||
|
group.add_argument('--tsan', dest='tsan', action='store_true',
|
||||||
|
help='run a subset of test cases that are proper for the TSAN test')
|
||||||
group.add_argument('--fail-env-changed', action='store_true',
|
group.add_argument('--fail-env-changed', action='store_true',
|
||||||
help='if a test file alters the environment, mark '
|
help='if a test file alters the environment, mark '
|
||||||
'the test as failed')
|
'the test as failed')
|
||||||
|
|
|
@ -18,6 +18,7 @@ from .results import TestResults, EXITCODE_INTERRUPTED
|
||||||
from .runtests import RunTests, HuntRefleak
|
from .runtests import RunTests, HuntRefleak
|
||||||
from .setup import setup_process, setup_test_dir
|
from .setup import setup_process, setup_test_dir
|
||||||
from .single import run_single_test, PROGRESS_MIN_TIME
|
from .single import run_single_test, PROGRESS_MIN_TIME
|
||||||
|
from .tsan import setup_tsan_tests
|
||||||
from .utils import (
|
from .utils import (
|
||||||
StrPath, StrJSON, TestName, TestList, TestTuple, TestFilter,
|
StrPath, StrJSON, TestName, TestList, TestTuple, TestFilter,
|
||||||
strip_py_suffix, count, format_duration,
|
strip_py_suffix, count, format_duration,
|
||||||
|
@ -56,6 +57,7 @@ class Regrtest:
|
||||||
self.quiet: bool = ns.quiet
|
self.quiet: bool = ns.quiet
|
||||||
self.pgo: bool = ns.pgo
|
self.pgo: bool = ns.pgo
|
||||||
self.pgo_extended: bool = ns.pgo_extended
|
self.pgo_extended: bool = ns.pgo_extended
|
||||||
|
self.tsan: bool = ns.tsan
|
||||||
|
|
||||||
# Test results
|
# Test results
|
||||||
self.results: TestResults = TestResults()
|
self.results: TestResults = TestResults()
|
||||||
|
@ -183,6 +185,9 @@ class Regrtest:
|
||||||
# add default PGO tests if no tests are specified
|
# add default PGO tests if no tests are specified
|
||||||
setup_pgo_tests(self.cmdline_args, self.pgo_extended)
|
setup_pgo_tests(self.cmdline_args, self.pgo_extended)
|
||||||
|
|
||||||
|
if self.tsan:
|
||||||
|
setup_tsan_tests(self.cmdline_args)
|
||||||
|
|
||||||
exclude_tests = set()
|
exclude_tests = set()
|
||||||
if self.exclude:
|
if self.exclude:
|
||||||
for arg in self.cmdline_args:
|
for arg in self.cmdline_args:
|
||||||
|
|
24
Lib/test/libregrtest/tsan.py
Normal file
24
Lib/test/libregrtest/tsan.py
Normal file
|
@ -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[:]
|
|
@ -0,0 +1,2 @@
|
||||||
|
Add --tsan to test.regrtest for running TSAN tests in reasonable execution
|
||||||
|
times. Patch by Donghee Na.
|
5
Tools/tsan/supressions.txt
Normal file
5
Tools/tsan/supressions.txt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
## reference: https://github.com/google/sanitizers/wiki/ThreadSanitizerSuppressions
|
||||||
|
race:get_allocator_unlocked
|
||||||
|
race:set_allocator_unlocked
|
||||||
|
race:mi_heap_visit_pages
|
||||||
|
race:_mi_heap_delayed_free_partial
|
Loading…
Add table
Add a link
Reference in a new issue