Show More
@@ -338,7 +338,8 b' class Test(unittest.TestCase):' | |||||
338 | # Status code reserved for skipped tests (used by hghave). |
|
338 | # Status code reserved for skipped tests (used by hghave). | |
339 | SKIPPED_STATUS = 80 |
|
339 | SKIPPED_STATUS = 80 | |
340 |
|
340 | |||
341 |
def __init__(self, options, path, count, tmpdir, abort, keeptmpdir=False |
|
341 | def __init__(self, options, path, count, tmpdir, abort, keeptmpdir=False, | |
|
342 | debug=False): | |||
342 | """Create a test from parameters. |
|
343 | """Create a test from parameters. | |
343 |
|
344 | |||
344 | options are parsed command line options that control test execution. |
|
345 | options are parsed command line options that control test execution. | |
@@ -354,6 +355,9 b' class Test(unittest.TestCase):' | |||||
354 |
|
355 | |||
355 | keeptmpdir determines whether to keep the test's temporary directory |
|
356 | keeptmpdir determines whether to keep the test's temporary directory | |
356 | after execution. It defaults to removal (False). |
|
357 | after execution. It defaults to removal (False). | |
|
358 | ||||
|
359 | debug mode will make the test execute verbosely, with unfiltered | |||
|
360 | output. | |||
357 | """ |
|
361 | """ | |
358 |
|
362 | |||
359 | self.path = path |
|
363 | self.path = path | |
@@ -366,6 +370,7 b' class Test(unittest.TestCase):' | |||||
366 | self._threadtmp = tmpdir |
|
370 | self._threadtmp = tmpdir | |
367 | self._abort = abort |
|
371 | self._abort = abort | |
368 | self._keeptmpdir = keeptmpdir |
|
372 | self._keeptmpdir = keeptmpdir | |
|
373 | self._debug = debug | |||
369 | self._daemonpids = [] |
|
374 | self._daemonpids = [] | |
370 |
|
375 | |||
371 | self._finished = None |
|
376 | self._finished = None | |
@@ -376,7 +381,7 b' class Test(unittest.TestCase):' | |||||
376 |
|
381 | |||
377 | # If we're not in --debug mode and reference output file exists, |
|
382 | # If we're not in --debug mode and reference output file exists, | |
378 | # check test output against it. |
|
383 | # check test output against it. | |
379 |
if |
|
384 | if debug: | |
380 | self._refout = None # to match "out is None" |
|
385 | self._refout = None # to match "out is None" | |
381 | elif os.path.exists(self._refpath): |
|
386 | elif os.path.exists(self._refpath): | |
382 | f = open(self._refpath, 'r') |
|
387 | f = open(self._refpath, 'r') | |
@@ -546,7 +551,7 b' class Test(unittest.TestCase):' | |||||
546 | shutil.rmtree(self._threadtmp, True) |
|
551 | shutil.rmtree(self._threadtmp, True) | |
547 |
|
552 | |||
548 | if (self._ret != 0 or self._out != self._refout) and not self._skipped \ |
|
553 | if (self._ret != 0 or self._out != self._refout) and not self._skipped \ | |
549 |
and not self._ |
|
554 | and not self._debug and self._out: | |
550 | f = open(self.errpath, 'wb') |
|
555 | f = open(self.errpath, 'wb') | |
551 | for line in self._out: |
|
556 | for line in self._out: | |
552 | f.write(line) |
|
557 | f.write(line) | |
@@ -670,7 +675,7 b' class PythonTest(Test):' | |||||
670 | if os.name == 'nt': |
|
675 | if os.name == 'nt': | |
671 | replacements.append((r'\r\n', '\n')) |
|
676 | replacements.append((r'\r\n', '\n')) | |
672 | return run(cmd, self._testtmp, replacements, env, self._abort, |
|
677 | return run(cmd, self._testtmp, replacements, env, self._abort, | |
673 |
debug=self._ |
|
678 | debug=self._debug, timeout=self._options.timeout) | |
674 |
|
679 | |||
675 | class TTest(Test): |
|
680 | class TTest(Test): | |
676 | """A "t test" is a test backed by a .t file.""" |
|
681 | """A "t test" is a test backed by a .t file.""" | |
@@ -705,7 +710,7 b' class TTest(Test):' | |||||
705 | vlog("# Running", cmd) |
|
710 | vlog("# Running", cmd) | |
706 |
|
711 | |||
707 | exitcode, output = run(cmd, self._testtmp, replacements, env, |
|
712 | exitcode, output = run(cmd, self._testtmp, replacements, env, | |
708 |
self._abort, debug=self._ |
|
713 | self._abort, debug=self._debug, | |
709 | timeout=self._options.timeout) |
|
714 | timeout=self._options.timeout) | |
710 | # Do not merge output if skipped. Return hghave message instead. |
|
715 | # Do not merge output if skipped. Return hghave message instead. | |
711 | # Similarly, with --debug, output is None. |
|
716 | # Similarly, with --debug, output is None. | |
@@ -761,7 +766,7 b' class TTest(Test):' | |||||
761 | # can generate the surrounding doctest magic. |
|
766 | # can generate the surrounding doctest magic. | |
762 | inpython = False |
|
767 | inpython = False | |
763 |
|
768 | |||
764 |
if self._ |
|
769 | if self._debug: | |
765 | script.append('set -x\n') |
|
770 | script.append('set -x\n') | |
766 | if os.getenv('MSYSTEM'): |
|
771 | if os.getenv('MSYSTEM'): | |
767 | script.append('alias pwd="pwd -W"\n') |
|
772 | script.append('alias pwd="pwd -W"\n') | |
@@ -1490,7 +1495,8 b' class TestRunner(object):' | |||||
1490 | tmpdir = os.path.join(self.hgtmp, 'child%d' % count) |
|
1495 | tmpdir = os.path.join(self.hgtmp, 'child%d' % count) | |
1491 |
|
1496 | |||
1492 | return testcls(self.options, refpath, count, tmpdir, self.abort, |
|
1497 | return testcls(self.options, refpath, count, tmpdir, self.abort, | |
1493 |
keeptmpdir=self.options.keep_tmpdir |
|
1498 | keeptmpdir=self.options.keep_tmpdir, | |
|
1499 | debug=self.options.debug) | |||
1494 |
|
1500 | |||
1495 | def _cleanup(self): |
|
1501 | def _cleanup(self): | |
1496 | """Clean up state from this test invocation.""" |
|
1502 | """Clean up state from this test invocation.""" |
General Comments 0
You need to be logged in to leave comments.
Login now