Show More
@@ -547,13 +547,15 b' def outputcoverage(options):' | |||
|
547 | 547 | class Test(object): |
|
548 | 548 | """Encapsulates a single, runnable test.""" |
|
549 | 549 | |
|
550 |
def __init__(self, path, options, |
|
|
550 | def __init__(self, path, options, count): | |
|
551 | 551 | self._path = path |
|
552 | 552 | self._options = options |
|
553 | self._threadtmp = threadtmp | |
|
554 | 553 | |
|
555 | self.testtmp = os.path.join(threadtmp, os.path.basename(path)) | |
|
556 |
os.mkdir(self.t |
|
|
554 | self.threadtmp = os.path.join(HGTMP, 'child%d' % count) | |
|
555 | os.mkdir(self.threadtmp) | |
|
556 | ||
|
557 | self._testtmp = os.path.join(self.threadtmp, os.path.basename(path)) | |
|
558 | os.mkdir(self._testtmp) | |
|
557 | 559 | |
|
558 | 560 | self._setreplacements(count) |
|
559 | 561 | |
@@ -581,22 +583,22 b' class Test(object):' | |||
|
581 | 583 | r.append( |
|
582 | 584 | (''.join(c.isalpha() and '[%s%s]' % (c.lower(), c.upper()) or |
|
583 | 585 | c in '/\\' and r'[/\\]' or c.isdigit() and c or '\\' + c |
|
584 | for c in self.testtmp), '$TESTTMP')) | |
|
586 | for c in self._testtmp), '$TESTTMP')) | |
|
585 | 587 | else: |
|
586 | r.append((re.escape(self.testtmp), '$TESTTMP')) | |
|
588 | r.append((re.escape(self._testtmp), '$TESTTMP')) | |
|
587 | 589 | |
|
588 | 590 | self._replacements = r |
|
589 | 591 | self._port = port |
|
590 | 592 | |
|
591 | 593 | def _getenv(self): |
|
592 | 594 | env = os.environ.copy() |
|
593 | env['TESTTMP'] = self.testtmp | |
|
594 | env['HOME'] = self.testtmp | |
|
595 | env['TESTTMP'] = self._testtmp | |
|
596 | env['HOME'] = self._testtmp | |
|
595 | 597 | env["HGPORT"] = str(self._port) |
|
596 | 598 | env["HGPORT1"] = str(self._port + 1) |
|
597 | 599 | env["HGPORT2"] = str(self._port + 2) |
|
598 |
env["HGRCPATH"] = os.path.join(self. |
|
|
599 |
env["DAEMON_PIDS"] = os.path.join(self. |
|
|
600 | env["HGRCPATH"] = os.path.join(self.threadtmp, '.hgrc') | |
|
601 | env["DAEMON_PIDS"] = os.path.join(self.threadtmp, 'daemon.pids') | |
|
600 | 602 | env["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"' |
|
601 | 603 | env["HGMERGE"] = "internal:merge" |
|
602 | 604 | env["HGUSER"] = "test" |
@@ -634,7 +636,7 b' def pytest(test, wd, options, replacemen' | |||
|
634 | 636 | class PythonTest(Test): |
|
635 | 637 | """A Python-based test.""" |
|
636 | 638 | def _run(self, replacements, env): |
|
637 | return pytest(self._path, self.testtmp, self._options, replacements, | |
|
639 | return pytest(self._path, self._testtmp, self._options, replacements, | |
|
638 | 640 | env) |
|
639 | 641 | |
|
640 | 642 | needescape = re.compile(r'[\x00-\x08\x0b-\x1f\x7f-\xff]').search |
@@ -897,7 +899,7 b' class TTest(Test):' | |||
|
897 | 899 | """A "t test" is a test backed by a .t file.""" |
|
898 | 900 | |
|
899 | 901 | def _run(self, replacements, env): |
|
900 | return tsttest(self._path, self.testtmp, self._options, replacements, | |
|
902 | return tsttest(self._path, self._testtmp, self._options, replacements, | |
|
901 | 903 | env) |
|
902 | 904 | |
|
903 | 905 | wifexited = getattr(os, "WIFEXITED", lambda x: False) |
@@ -1022,11 +1024,7 b' def runone(options, test, count):' | |||
|
1022 | 1024 | if os.path.exists(err): |
|
1023 | 1025 | os.remove(err) # Remove any previous output files |
|
1024 | 1026 | |
|
1025 | # Make a tmp subdirectory to work in | |
|
1026 | threadtmp = os.path.join(HGTMP, "child%d" % count) | |
|
1027 | os.mkdir(threadtmp) | |
|
1028 | ||
|
1029 | t = runner(testpath, options, threadtmp, count) | |
|
1027 | t = runner(testpath, options, count) | |
|
1030 | 1028 | |
|
1031 | 1029 | starttime = time.time() |
|
1032 | 1030 | try: |
@@ -1102,7 +1100,7 b' def runone(options, test, count):' | |||
|
1102 | 1100 | iolock.release() |
|
1103 | 1101 | |
|
1104 | 1102 | if not options.keep_tmpdir: |
|
1105 | shutil.rmtree(threadtmp, True) | |
|
1103 | shutil.rmtree(t.threadtmp, True) | |
|
1106 | 1104 | return result |
|
1107 | 1105 | |
|
1108 | 1106 | _hgpath = None |
General Comments 0
You need to be logged in to leave comments.
Login now