Mercurial > public > mercurial-scm > hg
comparison tests/run-tests.py @ 20821:3d1d16b19e7d
tests: add run-tests --changed option for running tests changed in revisions
Convenient when polishing patches and changing details of how they change test
output.
This will probably break in weird ways for revsets with special quoting ... but
it is good enough for run-tests.
Usage example:
yes | ./run-tests.py -li --changed qparent
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Fri, 28 Feb 2014 02:09:00 +0100 |
parents | 60c175c1e708 |
children | 723e41ad59b4 |
comparison
equal
deleted
inserted
replaced
20820:f8e531a3a77c | 20821:3d1d16b19e7d |
---|---|
139 # keep these sorted | 139 # keep these sorted |
140 parser.add_option("--blacklist", action="append", | 140 parser.add_option("--blacklist", action="append", |
141 help="skip tests listed in the specified blacklist file") | 141 help="skip tests listed in the specified blacklist file") |
142 parser.add_option("--whitelist", action="append", | 142 parser.add_option("--whitelist", action="append", |
143 help="always run tests listed in the specified whitelist file") | 143 help="always run tests listed in the specified whitelist file") |
144 parser.add_option("--changed", type="string", | |
145 help="run tests that are changed in parent rev or working directory") | |
144 parser.add_option("-C", "--annotate", action="store_true", | 146 parser.add_option("-C", "--annotate", action="store_true", |
145 help="output files annotated with coverage") | 147 help="output files annotated with coverage") |
146 parser.add_option("-c", "--cover", action="store_true", | 148 parser.add_option("-c", "--cover", action="store_true", |
147 help="print a test coverage report") | 149 help="print a test coverage report") |
148 parser.add_option("-d", "--debug", action="store_true", | 150 parser.add_option("-d", "--debug", action="store_true", |
1179 os.umask(022) | 1181 os.umask(022) |
1180 | 1182 |
1181 checktools() | 1183 checktools() |
1182 | 1184 |
1183 if not args: | 1185 if not args: |
1184 args = os.listdir(".") | 1186 if options.changed: |
1187 proc = Popen4('hg st --rev "%s" -man0 .' % options.changed, | |
1188 None, 0) | |
1189 stdout, stderr = proc.communicate() | |
1190 args = stdout.strip('\0').split('\0') | |
1191 else: | |
1192 args = os.listdir(".") | |
1185 | 1193 |
1186 tests = [t for t in args | 1194 tests = [t for t in args |
1187 if t.startswith("test-") | 1195 if t.startswith("test-") |
1188 and (t.endswith(".py") or t.endswith(".t"))] | 1196 and (t.endswith(".py") or t.endswith(".t"))] |
1189 | 1197 |