From 49f8dd1ca4dcde5b225acdd8c3d6450f3f048ac2 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 7 Jun 2026 12:59:49 +1000 Subject: [PATCH] runtests: stop discovering obsolete *.test shell tests The shell testsuite was removed in 1f689ec0 (rewritten in Python); only *_test.py remain, yet collect_tests still globbed *.test and _testbase mapped foo.test and foo_test.py to the same canonical name. Harmless on a master tree (no .test files), but when an older tree's *.test files are present -- e.g. fleettest --testsuite-repo building a 3.4.x release whose shell suite still exists -- both glob to the same test name and scratch dir and race under -j, producing spurious failures. Drop .test discovery entirely. --- runtests.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/runtests.py b/runtests.py index 3a1c7485..574da01b 100755 --- a/runtests.py +++ b/runtests.py @@ -191,35 +191,31 @@ _PY_TEST_SUFFIX = '_test.py' def _is_test_path(path): - base = os.path.basename(path) - return base.endswith('.test') or base.endswith(_PY_TEST_SUFFIX) + return os.path.basename(path).endswith(_PY_TEST_SUFFIX) def _testbase(path): """Strip the test extension to get the canonical test name.""" base = os.path.basename(path) - if base.endswith('.test'): - return base[:-len('.test')] if base.endswith(_PY_TEST_SUFFIX): return base[:-len(_PY_TEST_SUFFIX)] return base def collect_tests(suitedir, patterns): - """Collect test scripts (.test or _test.py) matching the given patterns.""" + """Collect test scripts (_test.py) matching the given patterns.""" if not patterns: - candidates = (glob.glob(os.path.join(suitedir, '*.test')) - + glob.glob(os.path.join(suitedir, '*' + _PY_TEST_SUFFIX))) + candidates = glob.glob(os.path.join(suitedir, '*' + _PY_TEST_SUFFIX)) tests = sorted(p for p in candidates if _is_test_path(p)) else: seen = set() tests = [] for pat in patterns: # Accept either bare name ("mkpath"), explicit extension, or glob. - if pat.endswith('.test') or pat.endswith('.py'): + if pat.endswith('.py'): pats = [pat] else: - pats = [pat + '.test', pat + _PY_TEST_SUFFIX] + pats = [pat + _PY_TEST_SUFFIX] for p in pats: for m in sorted(glob.glob(os.path.join(suitedir, p))): if _is_test_path(m) and m not in seen: