##// END OF EJS Templates
run-tests: drop options.child and users
Matt Mackall -
r19279:3868c9ab default
parent child Browse files
Show More
@@ -137,8 +137,6 b' def parseargs():'
137 help="always run tests listed in the specified whitelist file")
137 help="always run tests listed in the specified whitelist file")
138 parser.add_option("-C", "--annotate", action="store_true",
138 parser.add_option("-C", "--annotate", action="store_true",
139 help="output files annotated with coverage")
139 help="output files annotated with coverage")
140 parser.add_option("--child", type="int",
141 help="run as child process, summary to given fd")
142 parser.add_option("-c", "--cover", action="store_true",
140 parser.add_option("-c", "--cover", action="store_true",
143 help="print a test coverage report")
141 help="print a test coverage report")
144 parser.add_option("-d", "--debug", action="store_true",
142 parser.add_option("-d", "--debug", action="store_true",
@@ -242,10 +240,7 b' def parseargs():'
242
240
243 global verbose
241 global verbose
244 if options.verbose:
242 if options.verbose:
245 if options.jobs > 1 or options.child is not None:
243 verbose = ''
246 verbose = "[%d]" % os.getpid()
247 else:
248 verbose = ''
249
244
250 if options.tmpdir:
245 if options.tmpdir:
251 options.tmpdir = os.path.expanduser(options.tmpdir)
246 options.tmpdir = os.path.expanduser(options.tmpdir)
@@ -272,8 +267,7 b' def parseargs():'
272 if options.blacklist:
267 if options.blacklist:
273 options.blacklist = parselistfiles(options.blacklist, 'blacklist')
268 options.blacklist = parselistfiles(options.blacklist, 'blacklist')
274 if options.whitelist:
269 if options.whitelist:
275 options.whitelisted = parselistfiles(options.whitelist, 'whitelist',
270 options.whitelisted = parselistfiles(options.whitelist, 'whitelist')
276 warn=options.child is None)
277 else:
271 else:
278 options.whitelisted = {}
272 options.whitelisted = {}
279
273
@@ -568,9 +562,6 b' def outputcoverage(options):'
568 vlog('# Running: %s' % cmd)
562 vlog('# Running: %s' % cmd)
569 os.system(cmd)
563 os.system(cmd)
570
564
571 if options.child:
572 return
573
574 covrun('-c')
565 covrun('-c')
575 omit = ','.join(os.path.join(x, '*') for x in [BINDIR, TESTDIR])
566 omit = ','.join(os.path.join(x, '*') for x in [BINDIR, TESTDIR])
576 covrun('-i', '-r', '"--omit=%s"' % omit) # report
567 covrun('-i', '-r', '"--omit=%s"' % omit) # report
@@ -1133,30 +1124,22 b' def runtests(options, tests):'
1133 skipped = len(results['s'])
1124 skipped = len(results['s'])
1134 ignored = len(results['i'])
1125 ignored = len(results['i'])
1135
1126
1136 if options.child:
1127 print
1137 fp = os.fdopen(options.child, 'wb')
1128 for s in results['s']:
1138 pickle.dump(results, fp, pickle.HIGHEST_PROTOCOL)
1129 print "Skipped %s: %s" % s
1139 if options.time:
1130 for s in results['!']:
1140 pickle.dump(times, fp, pickle.HIGHEST_PROTOCOL)
1131 print "Failed %s: %s" % s
1141 fp.close()
1132 _checkhglib("Tested")
1142 else:
1133 print "# Ran %d tests, %d skipped, %d failed." % (
1143 print
1134 tested, skipped + ignored, failed)
1144 for s in results['s']:
1135 if options.time:
1145 print "Skipped %s: %s" % s
1136 outputtimes(options)
1146 for s in results['!']:
1147 print "Failed %s: %s" % s
1148 _checkhglib("Tested")
1149 print "# Ran %d tests, %d skipped, %d failed." % (
1150 tested, skipped + ignored, failed)
1151 if options.time:
1152 outputtimes(options)
1153
1137
1154 if options.anycoverage:
1138 if options.anycoverage:
1155 outputcoverage(options)
1139 outputcoverage(options)
1156 except KeyboardInterrupt:
1140 except KeyboardInterrupt:
1157 failed = True
1141 failed = True
1158 if not options.child:
1142 print "\ninterrupted!"
1159 print "\ninterrupted!"
1160
1143
1161 if failed:
1144 if failed:
1162 sys.exit(1)
1145 sys.exit(1)
@@ -1166,15 +1149,14 b" testtypes = [('.py', pytest, '.out'),"
1166
1149
1167 def main():
1150 def main():
1168 (options, args) = parseargs()
1151 (options, args) = parseargs()
1169 if not options.child:
1152 os.umask(022)
1170 os.umask(022)
1171
1153
1172 checktools()
1154 checktools()
1173
1155
1174 if len(args) == 0:
1156 if len(args) == 0:
1175 args = [t for t in os.listdir(".")
1157 args = [t for t in os.listdir(".")
1176 if t.startswith("test-")
1158 if t.startswith("test-")
1177 and (t.endswith(".py") or t.endswith(".t"))]
1159 and (t.endswith(".py") or t.endswith(".t"))]
1178
1160
1179 tests = args
1161 tests = args
1180
1162
@@ -1193,8 +1175,7 b' def main():'
1193 global TESTDIR, HGTMP, INST, BINDIR, PYTHONDIR, COVERAGE_FILE
1175 global TESTDIR, HGTMP, INST, BINDIR, PYTHONDIR, COVERAGE_FILE
1194 TESTDIR = os.environ["TESTDIR"] = os.getcwd()
1176 TESTDIR = os.environ["TESTDIR"] = os.getcwd()
1195 if options.tmpdir:
1177 if options.tmpdir:
1196 if not options.child:
1178 options.keep_tmpdir = True
1197 options.keep_tmpdir = True
1198 tmpdir = options.tmpdir
1179 tmpdir = options.tmpdir
1199 if os.path.exists(tmpdir):
1180 if os.path.exists(tmpdir):
1200 # Meaning of tmpdir has changed since 1.3: we used to create
1181 # Meaning of tmpdir has changed since 1.3: we used to create
@@ -1235,22 +1216,21 b' def main():'
1235 os.environ["BINDIR"] = BINDIR
1216 os.environ["BINDIR"] = BINDIR
1236 os.environ["PYTHON"] = PYTHON
1217 os.environ["PYTHON"] = PYTHON
1237
1218
1238 if not options.child:
1219 path = [BINDIR] + os.environ["PATH"].split(os.pathsep)
1239 path = [BINDIR] + os.environ["PATH"].split(os.pathsep)
1220 os.environ["PATH"] = os.pathsep.join(path)
1240 os.environ["PATH"] = os.pathsep.join(path)
1241
1221
1242 # Include TESTDIR in PYTHONPATH so that out-of-tree extensions
1222 # Include TESTDIR in PYTHONPATH so that out-of-tree extensions
1243 # can run .../tests/run-tests.py test-foo where test-foo
1223 # can run .../tests/run-tests.py test-foo where test-foo
1244 # adds an extension to HGRC
1224 # adds an extension to HGRC
1245 pypath = [PYTHONDIR, TESTDIR]
1225 pypath = [PYTHONDIR, TESTDIR]
1246 # We have to augment PYTHONPATH, rather than simply replacing
1226 # We have to augment PYTHONPATH, rather than simply replacing
1247 # it, in case external libraries are only available via current
1227 # it, in case external libraries are only available via current
1248 # PYTHONPATH. (In particular, the Subversion bindings on OS X
1228 # PYTHONPATH. (In particular, the Subversion bindings on OS X
1249 # are in /opt/subversion.)
1229 # are in /opt/subversion.)
1250 oldpypath = os.environ.get(IMPL_PATH)
1230 oldpypath = os.environ.get(IMPL_PATH)
1251 if oldpypath:
1231 if oldpypath:
1252 pypath.append(oldpypath)
1232 pypath.append(oldpypath)
1253 os.environ[IMPL_PATH] = os.pathsep.join(pypath)
1233 os.environ[IMPL_PATH] = os.pathsep.join(pypath)
1254
1234
1255 COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
1235 COVERAGE_FILE = os.path.join(TESTDIR, ".coverage")
1256
1236
General Comments 0
You need to be logged in to leave comments. Login now