Skip to content

Commit c0219ca

Browse files
tridgeclaude
andcommitted
runtests: add --exclude / RSYNC_EXCLUDE to skip tests entirely
Some tests cannot run in certain build/CI environments. In particular the protected-regular test self-re-execs under "unshare --map-users" to exercise fs.protected_regular handling, and that user-namespace path hangs in a restricted buildd chroot (e.g. Launchpad/sbuild), tripping the per-test timeout and failing the whole "make check". Add an --exclude option (comma-separated test names/globs), with an RSYNC_EXCLUDE environment fallback so it can be set without touching the make/check command line. Excluded tests are dropped before running -- they are neither executed nor reported as skipped. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 68df17a commit c0219ca

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

runtests.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import argparse
2626
import concurrent.futures
27+
import fnmatch
2728
import glob
2829
import os
2930
import subprocess
@@ -35,6 +36,12 @@ def parse_args():
3536
p = argparse.ArgumentParser(description='Run rsync test suite')
3637
p.add_argument('tests', nargs='*', metavar='TEST',
3738
help='Test names or patterns to run (default: all)')
39+
p.add_argument('--exclude', default=None, metavar='LIST',
40+
help='Comma-separated test names/globs to skip entirely: '
41+
'they are not run and not reported as skipped. Useful '
42+
'for tests that cannot work in a given build/CI '
43+
'environment (e.g. a restricted buildd chroot). '
44+
'Falls back to the RSYNC_EXCLUDE environment variable.')
3845
p.add_argument('-j', '--parallel', type=int, default=1, metavar='N',
3946
help='Run up to N tests in parallel (default: 1)')
4047
p.add_argument('--valgrind', action='store_true',
@@ -313,6 +320,8 @@ def main():
313320
args.log_level = int(os.environ.get('loglevel', '1'))
314321
if args.expect_skipped is None:
315322
args.expect_skipped = os.environ.get('RSYNC_EXPECT_SKIPPED', 'IGNORE')
323+
if args.exclude is None:
324+
args.exclude = os.environ.get('RSYNC_EXCLUDE', '')
316325
if os.environ.get('whichtests'):
317326
args.tests = [os.environ['whichtests']]
318327

@@ -424,6 +433,16 @@ def main():
424433
tests = collect_tests(suitedir, args.tests)
425434
full_run = len(args.tests) == 0
426435

436+
# Drop excluded tests entirely (matched by basename against name/glob).
437+
excl = [e.strip() for e in args.exclude.split(',') if e.strip()]
438+
if excl:
439+
before = len(tests)
440+
tests = [t for t in tests
441+
if not any(fnmatch.fnmatch(_testbase(t), pat) for pat in excl)]
442+
if before != len(tests):
443+
print(f"Excluding {before - len(tests)} test(s) matching: "
444+
f"{', '.join(excl)}")
445+
427446
# Record test order for consistent skipped-list output
428447
test_order = {_testbase(t): i for i, t in enumerate(tests)}
429448

0 commit comments

Comments
 (0)