GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-112536: Add --tsan test for reasonable TSAN execution times. (gh-1… · vstinner/cpython@66f349d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Lib/test/libregrtest
    • cmdline.py
    • main.py
    • tsan.py
  • Misc/NEWS.d/next/Tests
    • 2024-03-11-23-20-28.gh-issue-112536.Qv1RrX.rst
  • Tools/tsan
    • supressions.txt
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Lib/test/libregrtest/cmdline.py‎

Copy file name to clipboardExpand all lines: Lib/test/libregrtest/cmdline.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ def __init__(self, **kwargs) -> None:
164164
self.match_tests: TestFilter = []
165165
self.pgo = False
166166
self.pgo_extended = False
167+
self.tsan = False
167168
self.worker_json = None
168169
self.start = None
169170
self.timeout = None
@@ -333,6 +334,8 @@ def _create_parser():
333334
help='enable Profile Guided Optimization (PGO) training')
334335
group.add_argument('--pgo-extended', action='store_true',
335336
help='enable extended PGO training (slower training)')
337+
group.add_argument('--tsan', dest='tsan', action='store_true',
338+
help='run a subset of test cases that are proper for the TSAN test')
336339
group.add_argument('--fail-env-changed', action='store_true',
337340
help='if a test file alters the environment, mark '
338341
'the test as failed')
Collapse file

‎Lib/test/libregrtest/main.py‎

Copy file name to clipboardExpand all lines: Lib/test/libregrtest/main.py
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from .runtests import RunTests, HuntRefleak
1919
from .setup import setup_process, setup_test_dir
2020
from .single import run_single_test, PROGRESS_MIN_TIME
21+
from .tsan import setup_tsan_tests
2122
from .utils import (
2223
StrPath, StrJSON, TestName, TestList, TestTuple, TestFilter,
2324
strip_py_suffix, count, format_duration,
@@ -56,6 +57,7 @@ def __init__(self, ns: Namespace, _add_python_opts: bool = False):
5657
self.quiet: bool = ns.quiet
5758
self.pgo: bool = ns.pgo
5859
self.pgo_extended: bool = ns.pgo_extended
60+
self.tsan: bool = ns.tsan
5961

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

188+
if self.tsan:
189+
setup_tsan_tests(self.cmdline_args)
190+
186191
exclude_tests = set()
187192
if self.exclude:
188193
for arg in self.cmdline_args:
Collapse file

‎Lib/test/libregrtest/tsan.py‎

Copy file name to clipboard
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Set of tests run by default if --tsan is specified. The tests below were
2+
# chosen because they use threads and run in a reasonable amount of time.
3+
4+
TSAN_TESTS = [
5+
'test_code',
6+
'test_enum',
7+
'test_functools',
8+
'test_httpservers',
9+
'test_imaplib',
10+
'test_importlib',
11+
'test_io',
12+
'test_logging',
13+
'test_ssl',
14+
'test_syslog',
15+
'test_thread',
16+
'test_threadedtempfile',
17+
'test_threading_local',
18+
'test_threadsignals',
19+
]
20+
21+
22+
def setup_tsan_tests(cmdline_args):
23+
if not cmdline_args:
24+
cmdline_args[:] = TSAN_TESTS[:]
Collapse file

‎Misc/NEWS.d/next/Tests/2024-03-11-23-20-28.gh-issue-112536.Qv1RrX.rst‎

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add --tsan to test.regrtest for running TSAN tests in reasonable execution
2+
times. Patch by Donghee Na.
Collapse file

‎Tools/tsan/supressions.txt‎

Copy file name to clipboard
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## reference: https://github.com/google/sanitizers/wiki/ThreadSanitizerSuppressions
2+
race:get_allocator_unlocked
3+
race:set_allocator_unlocked
4+
race:mi_heap_visit_pages
5+
race:_mi_heap_delayed_free_partial

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.