# HG changeset patch # User Matt Mackall # Date 1255377173 18000 # 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 -r 3b93032516b3 -r a25af3af941c tests/run-tests.py --- a/tests/run-tests.py Fri Oct 09 16:27:05 2009 +0200 +++ b/tests/run-tests.py Mon Oct 12 14:52:53 2009 -0500 @@ -90,6 +90,8 @@ 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 @@ 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