Mercurial > hg
comparison tests/run-tests.py @ 9582:a25af3af941c
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").
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 12 Oct 2009 14:52:53 -0500 |
parents | 25858f9e65e8 |
children | f8b4df4b033d |
comparison
equal
deleted
inserted
replaced
9581:3b93032516b3 | 9582:a25af3af941c |
---|---|
88 parser.add_option("-i", "--interactive", action="store_true", | 88 parser.add_option("-i", "--interactive", action="store_true", |
89 help="prompt to accept changed output") | 89 help="prompt to accept changed output") |
90 parser.add_option("-j", "--jobs", type="int", | 90 parser.add_option("-j", "--jobs", type="int", |
91 help="number of jobs to run in parallel" | 91 help="number of jobs to run in parallel" |
92 " (default: $%s or %d)" % defaults['jobs']) | 92 " (default: $%s or %d)" % defaults['jobs']) |
93 parser.add_option("-k", "--keywords", | |
94 help="run tests matching keywords") | |
93 parser.add_option("--keep-tmpdir", action="store_true", | 95 parser.add_option("--keep-tmpdir", action="store_true", |
94 help="keep temporary directory after running tests" | 96 help="keep temporary directory after running tests" |
95 " (best used with --tmpdir)") | 97 " (best used with --tmpdir)") |
96 parser.add_option("-R", "--restart", action="store_true", | 98 parser.add_option("-R", "--restart", action="store_true", |
97 help="restart at last error") | 99 help="restart at last error") |
686 print "running all tests" | 688 print "running all tests" |
687 tests = orig | 689 tests = orig |
688 | 690 |
689 skips = [] | 691 skips = [] |
690 fails = [] | 692 fails = [] |
693 | |
691 for test in tests: | 694 for test in tests: |
692 if options.retest and not os.path.exists(test + ".err"): | 695 if options.retest and not os.path.exists(test + ".err"): |
693 skipped += 1 | 696 skipped += 1 |
694 continue | 697 continue |
698 | |
699 if options.keywords: | |
700 t = open(test).read().lower() + test.lower() | |
701 for k in options.keywords.lower().split(): | |
702 if k in t: | |
703 break | |
704 else: | |
705 skipped +=1 | |
706 continue | |
707 | |
695 ret = runone(options, test, skips, fails) | 708 ret = runone(options, test, skips, fails) |
696 if ret is None: | 709 if ret is None: |
697 skipped += 1 | 710 skipped += 1 |
698 elif not ret: | 711 elif not ret: |
699 if options.interactive: | 712 if options.interactive: |