Show More
@@ -386,89 +386,6 b' def killdaemons(pidfile):' | |||||
386 | return killmod.killdaemons(pidfile, tryhard=False, remove=True, |
|
386 | return killmod.killdaemons(pidfile, tryhard=False, remove=True, | |
387 | logfn=vlog) |
|
387 | logfn=vlog) | |
388 |
|
388 | |||
389 | def installhg(runner): |
|
|||
390 | vlog("# Performing temporary installation of HG") |
|
|||
391 | installerrs = os.path.join("tests", "install.err") |
|
|||
392 | compiler = '' |
|
|||
393 | if runner.options.compiler: |
|
|||
394 | compiler = '--compiler ' + runner.options.compiler |
|
|||
395 | pure = runner.options.pure and "--pure" or "" |
|
|||
396 | py3 = '' |
|
|||
397 | if sys.version_info[0] == 3: |
|
|||
398 | py3 = '--c2to3' |
|
|||
399 |
|
||||
400 | # Run installer in hg root |
|
|||
401 | script = os.path.realpath(sys.argv[0]) |
|
|||
402 | hgroot = os.path.dirname(os.path.dirname(script)) |
|
|||
403 | os.chdir(hgroot) |
|
|||
404 | nohome = '--home=""' |
|
|||
405 | if os.name == 'nt': |
|
|||
406 | # The --home="" trick works only on OS where os.sep == '/' |
|
|||
407 | # because of a distutils convert_path() fast-path. Avoid it at |
|
|||
408 | # least on Windows for now, deal with .pydistutils.cfg bugs |
|
|||
409 | # when they happen. |
|
|||
410 | nohome = '' |
|
|||
411 | cmd = ('%(exe)s setup.py %(py3)s %(pure)s clean --all' |
|
|||
412 | ' build %(compiler)s --build-base="%(base)s"' |
|
|||
413 | ' install --force --prefix="%(prefix)s" --install-lib="%(libdir)s"' |
|
|||
414 | ' --install-scripts="%(bindir)s" %(nohome)s >%(logfile)s 2>&1' |
|
|||
415 | % {'exe': sys.executable, 'py3': py3, 'pure': pure, |
|
|||
416 | 'compiler': compiler, 'base': os.path.join(runner.hgtmp, "build"), |
|
|||
417 | 'prefix': runner.inst, 'libdir': runner.pythondir, |
|
|||
418 | 'bindir': runner.bindir, |
|
|||
419 | 'nohome': nohome, 'logfile': installerrs}) |
|
|||
420 | vlog("# Running", cmd) |
|
|||
421 | if os.system(cmd) == 0: |
|
|||
422 | if not runner.options.verbose: |
|
|||
423 | os.remove(installerrs) |
|
|||
424 | else: |
|
|||
425 | f = open(installerrs) |
|
|||
426 | for line in f: |
|
|||
427 | print line, |
|
|||
428 | f.close() |
|
|||
429 | sys.exit(1) |
|
|||
430 | os.chdir(runner.testdir) |
|
|||
431 |
|
||||
432 | runner.usecorrectpython() |
|
|||
433 |
|
||||
434 | if runner.options.py3k_warnings and not runner.options.anycoverage: |
|
|||
435 | vlog("# Updating hg command to enable Py3k Warnings switch") |
|
|||
436 | f = open(os.path.join(runner.bindir, 'hg'), 'r') |
|
|||
437 | lines = [line.rstrip() for line in f] |
|
|||
438 | lines[0] += ' -3' |
|
|||
439 | f.close() |
|
|||
440 | f = open(os.path.join(runner.bindir, 'hg'), 'w') |
|
|||
441 | for line in lines: |
|
|||
442 | f.write(line + '\n') |
|
|||
443 | f.close() |
|
|||
444 |
|
||||
445 | hgbat = os.path.join(runner.bindir, 'hg.bat') |
|
|||
446 | if os.path.isfile(hgbat): |
|
|||
447 | # hg.bat expects to be put in bin/scripts while run-tests.py |
|
|||
448 | # installation layout put it in bin/ directly. Fix it |
|
|||
449 | f = open(hgbat, 'rb') |
|
|||
450 | data = f.read() |
|
|||
451 | f.close() |
|
|||
452 | if '"%~dp0..\python" "%~dp0hg" %*' in data: |
|
|||
453 | data = data.replace('"%~dp0..\python" "%~dp0hg" %*', |
|
|||
454 | '"%~dp0python" "%~dp0hg" %*') |
|
|||
455 | f = open(hgbat, 'wb') |
|
|||
456 | f.write(data) |
|
|||
457 | f.close() |
|
|||
458 | else: |
|
|||
459 | print 'WARNING: cannot fix hg.bat reference to python.exe' |
|
|||
460 |
|
||||
461 | if runner.options.anycoverage: |
|
|||
462 | custom = os.path.join(runner.testdir, 'sitecustomize.py') |
|
|||
463 | target = os.path.join(runner.pythondir, 'sitecustomize.py') |
|
|||
464 | vlog('# Installing coverage trigger to %s' % target) |
|
|||
465 | shutil.copyfile(custom, target) |
|
|||
466 | rc = os.path.join(runner.testdir, '.coveragerc') |
|
|||
467 | vlog('# Installing coverage rc to %s' % rc) |
|
|||
468 | os.environ['COVERAGE_PROCESS_START'] = rc |
|
|||
469 | fn = os.path.join(runner.inst, '..', '.coverage') |
|
|||
470 | os.environ['COVERAGE_FILE'] = fn |
|
|||
471 |
|
||||
472 | def outputtimes(options): |
|
389 | def outputtimes(options): | |
473 | vlog('# Producing time report') |
|
390 | vlog('# Producing time report') | |
474 | times.sort(key=lambda t: (t[1], t[0]), reverse=True) |
|
391 | times.sort(key=lambda t: (t[1], t[0]), reverse=True) | |
@@ -1182,7 +1099,7 b' def scheduletests(runner, tests):' | |||||
1182 | def runtests(runner, tests): |
|
1099 | def runtests(runner, tests): | |
1183 | try: |
|
1100 | try: | |
1184 | if runner.inst: |
|
1101 | if runner.inst: | |
1185 |
installhg( |
|
1102 | runner.installhg() | |
1186 | _checkhglib(runner, "Testing") |
|
1103 | _checkhglib(runner, "Testing") | |
1187 | else: |
|
1104 | else: | |
1188 | runner.usecorrectpython() |
|
1105 | runner.usecorrectpython() | |
@@ -1299,6 +1216,91 b' class TestRunner(object):' | |||||
1299 | if not findprogram(pyexename): |
|
1216 | if not findprogram(pyexename): | |
1300 | print "WARNING: Cannot find %s in search path" % pyexename |
|
1217 | print "WARNING: Cannot find %s in search path" % pyexename | |
1301 |
|
1218 | |||
|
1219 | def installhg(self): | |||
|
1220 | vlog("# Performing temporary installation of HG") | |||
|
1221 | installerrs = os.path.join("tests", "install.err") | |||
|
1222 | compiler = '' | |||
|
1223 | if self.options.compiler: | |||
|
1224 | compiler = '--compiler ' + self.options.compiler | |||
|
1225 | pure = self.options.pure and "--pure" or "" | |||
|
1226 | py3 = '' | |||
|
1227 | if sys.version_info[0] == 3: | |||
|
1228 | py3 = '--c2to3' | |||
|
1229 | ||||
|
1230 | # Run installer in hg root | |||
|
1231 | script = os.path.realpath(sys.argv[0]) | |||
|
1232 | hgroot = os.path.dirname(os.path.dirname(script)) | |||
|
1233 | os.chdir(hgroot) | |||
|
1234 | nohome = '--home=""' | |||
|
1235 | if os.name == 'nt': | |||
|
1236 | # The --home="" trick works only on OS where os.sep == '/' | |||
|
1237 | # because of a distutils convert_path() fast-path. Avoid it at | |||
|
1238 | # least on Windows for now, deal with .pydistutils.cfg bugs | |||
|
1239 | # when they happen. | |||
|
1240 | nohome = '' | |||
|
1241 | cmd = ('%(exe)s setup.py %(py3)s %(pure)s clean --all' | |||
|
1242 | ' build %(compiler)s --build-base="%(base)s"' | |||
|
1243 | ' install --force --prefix="%(prefix)s"' | |||
|
1244 | ' --install-lib="%(libdir)s"' | |||
|
1245 | ' --install-scripts="%(bindir)s" %(nohome)s >%(logfile)s 2>&1' | |||
|
1246 | % {'exe': sys.executable, 'py3': py3, 'pure': pure, | |||
|
1247 | 'compiler': compiler, | |||
|
1248 | 'base': os.path.join(self.hgtmp, "build"), | |||
|
1249 | 'prefix': self.inst, 'libdir': self.pythondir, | |||
|
1250 | 'bindir': self.bindir, | |||
|
1251 | 'nohome': nohome, 'logfile': installerrs}) | |||
|
1252 | vlog("# Running", cmd) | |||
|
1253 | if os.system(cmd) == 0: | |||
|
1254 | if not self.options.verbose: | |||
|
1255 | os.remove(installerrs) | |||
|
1256 | else: | |||
|
1257 | f = open(installerrs) | |||
|
1258 | for line in f: | |||
|
1259 | print line, | |||
|
1260 | f.close() | |||
|
1261 | sys.exit(1) | |||
|
1262 | os.chdir(self.testdir) | |||
|
1263 | ||||
|
1264 | self.usecorrectpython() | |||
|
1265 | ||||
|
1266 | if self.options.py3k_warnings and not self.options.anycoverage: | |||
|
1267 | vlog("# Updating hg command to enable Py3k Warnings switch") | |||
|
1268 | f = open(os.path.join(self.bindir, 'hg'), 'r') | |||
|
1269 | lines = [line.rstrip() for line in f] | |||
|
1270 | lines[0] += ' -3' | |||
|
1271 | f.close() | |||
|
1272 | f = open(os.path.join(self.bindir, 'hg'), 'w') | |||
|
1273 | for line in lines: | |||
|
1274 | f.write(line + '\n') | |||
|
1275 | f.close() | |||
|
1276 | ||||
|
1277 | hgbat = os.path.join(self.bindir, 'hg.bat') | |||
|
1278 | if os.path.isfile(hgbat): | |||
|
1279 | # hg.bat expects to be put in bin/scripts while run-tests.py | |||
|
1280 | # installation layout put it in bin/ directly. Fix it | |||
|
1281 | f = open(hgbat, 'rb') | |||
|
1282 | data = f.read() | |||
|
1283 | f.close() | |||
|
1284 | if '"%~dp0..\python" "%~dp0hg" %*' in data: | |||
|
1285 | data = data.replace('"%~dp0..\python" "%~dp0hg" %*', | |||
|
1286 | '"%~dp0python" "%~dp0hg" %*') | |||
|
1287 | f = open(hgbat, 'wb') | |||
|
1288 | f.write(data) | |||
|
1289 | f.close() | |||
|
1290 | else: | |||
|
1291 | print 'WARNING: cannot fix hg.bat reference to python.exe' | |||
|
1292 | ||||
|
1293 | if self.options.anycoverage: | |||
|
1294 | custom = os.path.join(self.testdir, 'sitecustomize.py') | |||
|
1295 | target = os.path.join(self.pythondir, 'sitecustomize.py') | |||
|
1296 | vlog('# Installing coverage trigger to %s' % target) | |||
|
1297 | shutil.copyfile(custom, target) | |||
|
1298 | rc = os.path.join(self.testdir, '.coveragerc') | |||
|
1299 | vlog('# Installing coverage rc to %s' % rc) | |||
|
1300 | os.environ['COVERAGE_PROCESS_START'] = rc | |||
|
1301 | fn = os.path.join(self.inst, '..', '.coverage') | |||
|
1302 | os.environ['COVERAGE_FILE'] = fn | |||
|
1303 | ||||
1302 | def main(args, parser=None): |
|
1304 | def main(args, parser=None): | |
1303 | runner = TestRunner() |
|
1305 | runner = TestRunner() | |
1304 |
|
1306 |
General Comments 0
You need to be logged in to leave comments.
Login now