Skip to content

Commit 6194e97

Browse files
committed
pythongh-90791: Enable test___all__ on ASAN build
* Only skip modules and tests related to X11 on ASAN builds: run other tests with ASAN. * Use print(flush=True) to see output earlier when it's redirected to a pipe. * Update issue reference: replace bpo-46633 with pythongh-90791.
1 parent 1a1bfc2 commit 6194e97

File tree

6 files changed

+30
-11
lines changed

6 files changed

+30
-11
lines changed

Lib/test/test___all__.py

+25-8
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,19 @@
1212

1313

1414
if support.check_sanitizer(address=True, memory=True):
15-
# bpo-46633: test___all__ is skipped because importing some modules
16-
# directly can trigger known problems with ASAN (like tk).
17-
raise unittest.SkipTest("workaround ASAN build issues on loading tests "
18-
"like tk")
15+
SKIP_MODULES = frozenset((
16+
# gh-90791: Tests involving libX11 can SEGFAULT on ASAN/MSAN builds.
17+
# Skip modules, packages and tests using '_tkinter'.
18+
'_tkinter',
19+
'tkinter',
20+
'test_tkinter',
21+
'test_ttk',
22+
'test_ttk_textonly',
23+
'idlelib',
24+
'test_idle',
25+
))
26+
else:
27+
SKIP_MODULES = ()
1928

2029

2130
class NoAll(RuntimeError):
@@ -83,15 +92,23 @@ def walk_modules(self, basedir, modpath):
8392
for fn in sorted(os.listdir(basedir)):
8493
path = os.path.join(basedir, fn)
8594
if os.path.isdir(path):
95+
if fn in SKIP_MODULES:
96+
continue
8697
pkg_init = os.path.join(path, '__init__.py')
8798
if os.path.exists(pkg_init):
8899
yield pkg_init, modpath + fn
89100
for p, m in self.walk_modules(path, modpath + fn + "."):
90101
yield p, m
91102
continue
92-
if not fn.endswith('.py') or fn == '__init__.py':
103+
104+
if fn == '__init__.py':
105+
continue
106+
if not fn.endswith('.py'):
107+
continue
108+
modname = fn.removesuffix('.py')
109+
if modname in SKIP_MODULES:
93110
continue
94-
yield path, modpath + fn[:-3]
111+
yield path, modpath + modname
95112

96113
def test_all(self):
97114
# List of denied modules and packages
@@ -119,14 +136,14 @@ def test_all(self):
119136
if denied:
120137
continue
121138
if support.verbose:
122-
print(modname)
139+
print(f"Check {modname}", flush=True)
123140
try:
124141
# This heuristic speeds up the process by removing, de facto,
125142
# most test modules (and avoiding the auto-executing ones).
126143
with open(path, "rb") as f:
127144
if b"__all__" not in f.read():
128145
raise NoAll(modname)
129-
self.check_all(modname)
146+
self.check_all(modname)
130147
except NoAll:
131148
ignored.append(modname)
132149
except FailedImport:

Lib/test/test_concurrent_futures.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535

3636
if support.check_sanitizer(address=True, memory=True):
37-
# bpo-46633: Skip the test because it is too slow when Python is built
37+
# gh-90791: Skip the test because it is too slow when Python is built
3838
# with ASAN/MSAN: between 5 and 20 minutes on GitHub Actions.
3939
raise unittest.SkipTest("test too slow on ASAN/MSAN build")
4040

Lib/test/test_idle.py

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from test.support import check_sanitizer
44

55
if check_sanitizer(address=True, memory=True):
6+
# See gh-90791 for details
67
raise unittest.SkipTest("Tests involving libX11 can SEGFAULT on ASAN/MSAN builds")
78

89
# Skip test_idle if _tkinter, tkinter, or idlelib are missing.

Lib/test/test_peg_generator/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
if support.check_sanitizer(address=True, memory=True):
8-
# bpo-46633: Skip the test because it is too slow when Python is built
8+
# gh-90791: Skip the test because it is too slow when Python is built
99
# with ASAN/MSAN: between 5 and 20 minutes on GitHub Actions.
1010
raise unittest.SkipTest("test too slow on ASAN/MSAN build")
1111

Lib/test/test_tkinter/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111

1212
if check_sanitizer(address=True, memory=True):
13+
# See gh-90791 for details
1314
raise unittest.SkipTest("Tests involving libX11 can SEGFAULT on ASAN/MSAN builds")
1415

1516
# Skip test if _tkinter wasn't built.

Lib/test/test_tools/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
if support.check_sanitizer(address=True, memory=True):
11-
# bpo-46633: Skip the test because it is too slow when Python is built
11+
# gh-90791: Skip the test because it is too slow when Python is built
1212
# with ASAN/MSAN: between 5 and 20 minutes on GitHub Actions.
1313
raise unittest.SkipTest("test too slow on ASAN/MSAN build")
1414

0 commit comments

Comments
 (0)