Show More
@@ -388,10 +388,10 b' def killdaemons(pidfile):' | |||||
388 | return killmod.killdaemons(pidfile, tryhard=False, remove=True, |
|
388 | return killmod.killdaemons(pidfile, tryhard=False, remove=True, | |
389 | logfn=vlog) |
|
389 | logfn=vlog) | |
390 |
|
390 | |||
391 | def cleanup(options): |
|
391 | def cleanup(runner, options): | |
392 | if not options.keep_tmpdir: |
|
392 | if not options.keep_tmpdir: | |
393 |
vlog("# Cleaning up HGTMP", |
|
393 | vlog("# Cleaning up HGTMP", runner.hgtmp) | |
394 |
shutil.rmtree( |
|
394 | shutil.rmtree(runner.hgtmp, True) | |
395 | for f in createdfiles: |
|
395 | for f in createdfiles: | |
396 | try: |
|
396 | try: | |
397 | os.remove(f) |
|
397 | os.remove(f) | |
@@ -459,7 +459,7 b' def installhg(runner, options):' | |||||
459 | ' install --force --prefix="%(prefix)s" --install-lib="%(libdir)s"' |
|
459 | ' install --force --prefix="%(prefix)s" --install-lib="%(libdir)s"' | |
460 | ' --install-scripts="%(bindir)s" %(nohome)s >%(logfile)s 2>&1' |
|
460 | ' --install-scripts="%(bindir)s" %(nohome)s >%(logfile)s 2>&1' | |
461 | % {'exe': sys.executable, 'py3': py3, 'pure': pure, |
|
461 | % {'exe': sys.executable, 'py3': py3, 'pure': pure, | |
462 |
'compiler': compiler, 'base': os.path.join( |
|
462 | 'compiler': compiler, 'base': os.path.join(runner.hgtmp, "build"), | |
463 | 'prefix': INST, 'libdir': PYTHONDIR, 'bindir': BINDIR, |
|
463 | 'prefix': INST, 'libdir': PYTHONDIR, 'bindir': BINDIR, | |
464 | 'nohome': nohome, 'logfile': installerrs}) |
|
464 | 'nohome': nohome, 'logfile': installerrs}) | |
465 | vlog("# Running", cmd) |
|
465 | vlog("# Running", cmd) | |
@@ -551,11 +551,11 b' class Test(object):' | |||||
551 | runs cannot be run concurrently. |
|
551 | runs cannot be run concurrently. | |
552 | """ |
|
552 | """ | |
553 |
|
553 | |||
554 |
def __init__(self, |
|
554 | def __init__(self, runner, test, options, count, refpath): | |
555 | path = os.path.join(testdir, test) |
|
555 | path = os.path.join(runner.testdir, test) | |
556 | errpath = os.path.join(testdir, '%s.err' % test) |
|
556 | errpath = os.path.join(runner.testdir, '%s.err' % test) | |
557 |
|
557 | |||
558 | self._testdir = testdir |
|
558 | self._testdir = runner.testdir | |
559 | self._test = test |
|
559 | self._test = test | |
560 | self._path = path |
|
560 | self._path = path | |
561 | self._options = options |
|
561 | self._options = options | |
@@ -575,7 +575,7 b' class Test(object):' | |||||
575 | else: |
|
575 | else: | |
576 | self._refout = [] |
|
576 | self._refout = [] | |
577 |
|
577 | |||
578 |
self._threadtmp = os.path.join( |
|
578 | self._threadtmp = os.path.join(runner.hgtmp, 'child%d' % count) | |
579 | os.mkdir(self._threadtmp) |
|
579 | os.mkdir(self._threadtmp) | |
580 |
|
580 | |||
581 | def cleanup(self): |
|
581 | def cleanup(self): | |
@@ -1103,7 +1103,7 b' def gettest(runner, test, options, count' | |||||
1103 | refpath = os.path.join(runner.testdir, test + out) |
|
1103 | refpath = os.path.join(runner.testdir, test + out) | |
1104 | break |
|
1104 | break | |
1105 |
|
1105 | |||
1106 |
return testcls(runner |
|
1106 | return testcls(runner, test, options, count, refpath) | |
1107 |
|
1107 | |||
1108 | wifexited = getattr(os, "WIFEXITED", lambda x: False) |
|
1108 | wifexited = getattr(os, "WIFEXITED", lambda x: False) | |
1109 | def run(cmd, wd, options, replacements, env): |
|
1109 | def run(cmd, wd, options, replacements, env): | |
@@ -1286,6 +1286,7 b' class TestRunner(object):' | |||||
1286 | """ |
|
1286 | """ | |
1287 | def __init__(self): |
|
1287 | def __init__(self): | |
1288 | self.testdir = None |
|
1288 | self.testdir = None | |
|
1289 | self.hgtmp = None | |||
1289 |
|
1290 | |||
1290 | def main(args, parser=None): |
|
1291 | def main(args, parser=None): | |
1291 | runner = TestRunner() |
|
1292 | runner = TestRunner() | |
@@ -1333,7 +1334,7 b' def main(args, parser=None):' | |||||
1333 | # we do the randomness ourself to know what seed is used |
|
1334 | # we do the randomness ourself to know what seed is used | |
1334 | os.environ['PYTHONHASHSEED'] = str(random.getrandbits(32)) |
|
1335 | os.environ['PYTHONHASHSEED'] = str(random.getrandbits(32)) | |
1335 |
|
1336 | |||
1336 |
global |
|
1337 | global INST, BINDIR, TMPBINDIR, PYTHONDIR, COVERAGE_FILE | |
1337 | runner.testdir = os.environ['TESTDIR'] = os.getcwd() |
|
1338 | runner.testdir = os.environ['TESTDIR'] = os.getcwd() | |
1338 | if options.tmpdir: |
|
1339 | if options.tmpdir: | |
1339 | options.keep_tmpdir = True |
|
1340 | options.keep_tmpdir = True | |
@@ -1358,12 +1359,12 b' def main(args, parser=None):' | |||||
1358 | # in all lowercase, which causes troubles with paths (issue3490) |
|
1359 | # in all lowercase, which causes troubles with paths (issue3490) | |
1359 | d = os.getenv('TMP') |
|
1360 | d = os.getenv('TMP') | |
1360 | tmpdir = tempfile.mkdtemp('', 'hgtests.', d) |
|
1361 | tmpdir = tempfile.mkdtemp('', 'hgtests.', d) | |
1361 |
|
|
1362 | runner.hgtmp = os.environ['HGTMP'] = os.path.realpath(tmpdir) | |
1362 |
|
1363 | |||
1363 | if options.with_hg: |
|
1364 | if options.with_hg: | |
1364 | INST = None |
|
1365 | INST = None | |
1365 | BINDIR = os.path.dirname(os.path.realpath(options.with_hg)) |
|
1366 | BINDIR = os.path.dirname(os.path.realpath(options.with_hg)) | |
1366 |
TMPBINDIR = os.path.join( |
|
1367 | TMPBINDIR = os.path.join(runner.hgtmp, 'install', 'bin') | |
1367 | os.makedirs(TMPBINDIR) |
|
1368 | os.makedirs(TMPBINDIR) | |
1368 |
|
1369 | |||
1369 | # This looks redundant with how Python initializes sys.path from |
|
1370 | # This looks redundant with how Python initializes sys.path from | |
@@ -1373,7 +1374,7 b' def main(args, parser=None):' | |||||
1373 | # ... which means it's not really redundant at all. |
|
1374 | # ... which means it's not really redundant at all. | |
1374 | PYTHONDIR = BINDIR |
|
1375 | PYTHONDIR = BINDIR | |
1375 | else: |
|
1376 | else: | |
1376 |
INST = os.path.join( |
|
1377 | INST = os.path.join(runner.hgtmp, "install") | |
1377 | BINDIR = os.environ["BINDIR"] = os.path.join(INST, "bin") |
|
1378 | BINDIR = os.environ["BINDIR"] = os.path.join(INST, "bin") | |
1378 | TMPBINDIR = BINDIR |
|
1379 | TMPBINDIR = BINDIR | |
1379 | PYTHONDIR = os.path.join(INST, "lib", "python") |
|
1380 | PYTHONDIR = os.path.join(INST, "lib", "python") | |
@@ -1404,7 +1405,7 b' def main(args, parser=None):' | |||||
1404 | COVERAGE_FILE = os.path.join(runner.testdir, ".coverage") |
|
1405 | COVERAGE_FILE = os.path.join(runner.testdir, ".coverage") | |
1405 |
|
1406 | |||
1406 | vlog("# Using TESTDIR", runner.testdir) |
|
1407 | vlog("# Using TESTDIR", runner.testdir) | |
1407 |
vlog("# Using HGTMP", |
|
1408 | vlog("# Using HGTMP", runner.hgtmp) | |
1408 | vlog("# Using PATH", os.environ["PATH"]) |
|
1409 | vlog("# Using PATH", os.environ["PATH"]) | |
1409 | vlog("# Using", IMPL_PATH, os.environ[IMPL_PATH]) |
|
1410 | vlog("# Using", IMPL_PATH, os.environ[IMPL_PATH]) | |
1410 |
|
1411 | |||
@@ -1412,7 +1413,7 b' def main(args, parser=None):' | |||||
1412 | return runtests(runner, options, tests) or 0 |
|
1413 | return runtests(runner, options, tests) or 0 | |
1413 | finally: |
|
1414 | finally: | |
1414 | time.sleep(.1) |
|
1415 | time.sleep(.1) | |
1415 | cleanup(options) |
|
1416 | cleanup(runner, options) | |
1416 |
|
1417 | |||
1417 | if __name__ == '__main__': |
|
1418 | if __name__ == '__main__': | |
1418 | sys.exit(main(sys.argv[1:])) |
|
1419 | sys.exit(main(sys.argv[1:])) |
General Comments 0
You need to be logged in to leave comments.
Login now