# HG changeset patch # User Matt Mackall # Date 2009-10-12 19:52:53 # Node ID a25af3af941c64916922149be61de653152000d7 # Parent 3b93032516b39c3a4bf7c0c3ce4c6454f9b6bbca tests: add -k to test scripts matching keywords argument is a space-separated list of keywords that are searched for in the name and body of each test. This makes it easy to run only tests related to tags, hgweb, revert, etc. (eg -k "tag hgweb revert"). diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -90,6 +90,8 @@ def parseargs(): parser.add_option("-j", "--jobs", type="int", help="number of jobs to run in parallel" " (default: $%s or %d)" % defaults['jobs']) + parser.add_option("-k", "--keywords", + help="run tests matching keywords") parser.add_option("--keep-tmpdir", action="store_true", help="keep temporary directory after running tests" " (best used with --tmpdir)") @@ -688,10 +690,21 @@ def runtests(options, tests): skips = [] fails = [] + for test in tests: if options.retest and not os.path.exists(test + ".err"): skipped += 1 continue + + if options.keywords: + t = open(test).read().lower() + test.lower() + for k in options.keywords.lower().split(): + if k in t: + break + else: + skipped +=1 + continue + ret = runone(options, test, skips, fails) if ret is None: skipped += 1