diff options
author | Victor Stinner <vstinner@python.org> | 2023-08-22 13:52:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-22 13:52:32 (GMT) |
commit | a541e01537cc07b326cc37cc29412b816bc2b4fc (patch) | |
tree | 8eb092061d63d1ebc4b4360c36758ad5a8154be0 | |
parent | 893215a4e7f59eabb8ccdf188c4b9b1de5bd8966 (diff) | |
download | cpython-a541e01537cc07b326cc37cc29412b816bc2b4fc.zip cpython-a541e01537cc07b326cc37cc29412b816bc2b4fc.tar.gz cpython-a541e01537cc07b326cc37cc29412b816bc2b4fc.tar.bz2 |
gh-90791: Enable test___all__ on ASAN build (#108286)
* 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 gh-90791.
-rw-r--r-- | Lib/test/test___all__.py | 33 | ||||
-rw-r--r-- | Lib/test/test_concurrent_futures.py | 2 | ||||
-rw-r--r-- | Lib/test/test_idle.py | 1 | ||||
-rw-r--r-- | Lib/test/test_peg_generator/__init__.py | 2 | ||||
-rw-r--r-- | Lib/test/test_tkinter/__init__.py | 1 | ||||
-rw-r--r-- | Lib/test/test_tools/__init__.py | 2 |
6 files changed, 30 insertions, 11 deletions
diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py index 2163f16..c87cde4 100644 --- a/Lib/test/test___all__.py +++ b/Lib/test/test___all__.py @@ -12,10 +12,19 @@ except ModuleNotFoundError: if support.check_sanitizer(address=True, memory=True): - # bpo-46633: test___all__ is skipped because importing some modules - # directly can trigger known problems with ASAN (like tk). - raise unittest.SkipTest("workaround ASAN build issues on loading tests " - "like tk") + SKIP_MODULES = frozenset(( + # gh-90791: Tests involving libX11 can SEGFAULT on ASAN/MSAN builds. + # Skip modules, packages and tests using '_tkinter'. + '_tkinter', + 'tkinter', + 'test_tkinter', + 'test_ttk', + 'test_ttk_textonly', + 'idlelib', + 'test_idle', + )) +else: + SKIP_MODULES = () class NoAll(RuntimeError): @@ -83,15 +92,23 @@ class AllTest(unittest.TestCase): for fn in sorted(os.listdir(basedir)): path = os.path.join(basedir, fn) if os.path.isdir(path): + if fn in SKIP_MODULES: + continue pkg_init = os.path.join(path, '__init__.py') if os.path.exists(pkg_init): yield pkg_init, modpath + fn for p, m in self.walk_modules(path, modpath + fn + "."): yield p, m continue - if not fn.endswith('.py') or fn == '__init__.py': + + if fn == '__init__.py': + continue + if not fn.endswith('.py'): + continue + modname = fn.removesuffix('.py') + if modname in SKIP_MODULES: continue - yield path, modpath + fn[:-3] + yield path, modpath + modname def test_all(self): # List of denied modules and packages @@ -119,14 +136,14 @@ class AllTest(unittest.TestCase): if denied: continue if support.verbose: - print(modname) + print(f"Check {modname}", flush=True) try: # This heuristic speeds up the process by removing, de facto, # most test modules (and avoiding the auto-executing ones). with open(path, "rb") as f: if b"__all__" not in f.read(): raise NoAll(modname) - self.check_all(modname) + self.check_all(modname) except NoAll: ignored.append(modname) except FailedImport: diff --git a/Lib/test/test_concurrent_futures.py b/Lib/test/test_concurrent_futures.py index 39dbe23..0f0ea61 100644 --- a/Lib/test/test_concurrent_futures.py +++ b/Lib/test/test_concurrent_futures.py @@ -34,7 +34,7 @@ import multiprocessing as mp if support.check_sanitizer(address=True, memory=True): - # bpo-46633: Skip the test because it is too slow when Python is built + # gh-90791: Skip the test because it is too slow when Python is built # with ASAN/MSAN: between 5 and 20 minutes on GitHub Actions. raise unittest.SkipTest("test too slow on ASAN/MSAN build") diff --git a/Lib/test/test_idle.py b/Lib/test/test_idle.py index ebb1e8e..3d8b7ec 100644 --- a/Lib/test/test_idle.py +++ b/Lib/test/test_idle.py @@ -3,6 +3,7 @@ from test.support.import_helper import import_module from test.support import check_sanitizer if check_sanitizer(address=True, memory=True): + # See gh-90791 for details raise unittest.SkipTest("Tests involving libX11 can SEGFAULT on ASAN/MSAN builds") # Skip test_idle if _tkinter, tkinter, or idlelib are missing. diff --git a/Lib/test/test_peg_generator/__init__.py b/Lib/test/test_peg_generator/__init__.py index 77f72fc..87281eb 100644 --- a/Lib/test/test_peg_generator/__init__.py +++ b/Lib/test/test_peg_generator/__init__.py @@ -5,7 +5,7 @@ from test.support import load_package_tests if support.check_sanitizer(address=True, memory=True): - # bpo-46633: Skip the test because it is too slow when Python is built + # gh-90791: Skip the test because it is too slow when Python is built # with ASAN/MSAN: between 5 and 20 minutes on GitHub Actions. raise unittest.SkipTest("test too slow on ASAN/MSAN build") diff --git a/Lib/test/test_tkinter/__init__.py b/Lib/test/test_tkinter/__init__.py index b1181bc..aa196c1 100644 --- a/Lib/test/test_tkinter/__init__.py +++ b/Lib/test/test_tkinter/__init__.py @@ -10,6 +10,7 @@ from test.support import ( if check_sanitizer(address=True, memory=True): + # See gh-90791 for details raise unittest.SkipTest("Tests involving libX11 can SEGFAULT on ASAN/MSAN builds") # Skip test if _tkinter wasn't built. diff --git a/Lib/test/test_tools/__init__.py b/Lib/test/test_tools/__init__.py index 2102b9f..dde5d84 100644 --- a/Lib/test/test_tools/__init__.py +++ b/Lib/test/test_tools/__init__.py @@ -8,7 +8,7 @@ from test.support import import_helper if support.check_sanitizer(address=True, memory=True): - # bpo-46633: Skip the test because it is too slow when Python is built + # gh-90791: Skip the test because it is too slow when Python is built # with ASAN/MSAN: between 5 and 20 minutes on GitHub Actions. raise unittest.SkipTest("test too slow on ASAN/MSAN build") |