Show More
@@ -339,7 +339,7 b' class Test(unittest.TestCase):' | |||||
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 | debug=False, nodiff=False, diffviewer=None): | |
343 | """Create a test from parameters. |
|
343 | """Create a test from parameters. | |
344 |
|
344 | |||
345 | options are parsed command line options that control test execution. |
|
345 | options are parsed command line options that control test execution. | |
@@ -358,6 +358,11 b' class Test(unittest.TestCase):' | |||||
358 |
|
358 | |||
359 | debug mode will make the test execute verbosely, with unfiltered |
|
359 | debug mode will make the test execute verbosely, with unfiltered | |
360 | output. |
|
360 | output. | |
|
361 | ||||
|
362 | nodiff will suppress the printing of a diff when output changes. | |||
|
363 | ||||
|
364 | diffviewer is the program that should be used to display diffs. Only | |||
|
365 | used when output changes. | |||
361 | """ |
|
366 | """ | |
362 |
|
367 | |||
363 | self.path = path |
|
368 | self.path = path | |
@@ -371,6 +376,8 b' class Test(unittest.TestCase):' | |||||
371 | self._abort = abort |
|
376 | self._abort = abort | |
372 | self._keeptmpdir = keeptmpdir |
|
377 | self._keeptmpdir = keeptmpdir | |
373 | self._debug = debug |
|
378 | self._debug = debug | |
|
379 | self._nodiff = nodiff | |||
|
380 | self._diffviewer = diffviewer | |||
374 | self._daemonpids = [] |
|
381 | self._daemonpids = [] | |
375 |
|
382 | |||
376 | self._finished = None |
|
383 | self._finished = None | |
@@ -472,8 +479,6 b' class Test(unittest.TestCase):' | |||||
472 |
|
479 | |||
473 | This will return a tuple describing the result of the test. |
|
480 | This will return a tuple describing the result of the test. | |
474 | """ |
|
481 | """ | |
475 | options = self._options |
|
|||
476 |
|
||||
477 | replacements, port = self._getreplacements() |
|
482 | replacements, port = self._getreplacements() | |
478 | env = self._getenv(port) |
|
483 | env = self._getenv(port) | |
479 | self._daemonpids.append(env['DAEMON_PIDS']) |
|
484 | self._daemonpids.append(env['DAEMON_PIDS']) | |
@@ -512,10 +517,10 b' class Test(unittest.TestCase):' | |||||
512 | self.fail('timed out', ret) |
|
517 | self.fail('timed out', ret) | |
513 | elif out != self._refout: |
|
518 | elif out != self._refout: | |
514 | info = {} |
|
519 | info = {} | |
515 |
if not |
|
520 | if not self._nodiff: | |
516 | iolock.acquire() |
|
521 | iolock.acquire() | |
517 |
if |
|
522 | if self._diffviewer: | |
518 |
os.system("%s %s %s" % ( |
|
523 | os.system("%s %s %s" % (self._diffviewer, self._refpath, | |
519 | self.errpath)) |
|
524 | self.errpath)) | |
520 | else: |
|
525 | else: | |
521 | info = showdiff(self._refout, out, self._refpath, |
|
526 | info = showdiff(self._refout, out, self._refpath, | |
@@ -530,7 +535,7 b' class Test(unittest.TestCase):' | |||||
530 | msg += 'output changed' |
|
535 | msg += 'output changed' | |
531 |
|
536 | |||
532 | if (ret != 0 or out != self._refout) and not self._skipped \ |
|
537 | if (ret != 0 or out != self._refout) and not self._skipped \ | |
533 |
and not |
|
538 | and not self._debug: | |
534 | f = open(self.errpath, 'wb') |
|
539 | f = open(self.errpath, 'wb') | |
535 | for line in out: |
|
540 | for line in out: | |
536 | f.write(line) |
|
541 | f.write(line) | |
@@ -637,7 +642,7 b' class Test(unittest.TestCase):' | |||||
637 |
|
642 | |||
638 | def fail(self, msg, ret): |
|
643 | def fail(self, msg, ret): | |
639 | warned = ret is False |
|
644 | warned = ret is False | |
640 |
if not self._ |
|
645 | if not self._nodiff: | |
641 | log("\n%s: %s %s" % (warned and 'Warning' or 'ERROR', self.name, |
|
646 | log("\n%s: %s %s" % (warned and 'Warning' or 'ERROR', self.name, | |
642 | msg)) |
|
647 | msg)) | |
643 | if (not ret and self._options.interactive and |
|
648 | if (not ret and self._options.interactive and | |
@@ -1496,7 +1501,9 b' class TestRunner(object):' | |||||
1496 |
|
1501 | |||
1497 | return testcls(self.options, refpath, count, tmpdir, self.abort, |
|
1502 | return testcls(self.options, refpath, count, tmpdir, self.abort, | |
1498 | keeptmpdir=self.options.keep_tmpdir, |
|
1503 | keeptmpdir=self.options.keep_tmpdir, | |
1499 |
debug=self.options.debug |
|
1504 | debug=self.options.debug, | |
|
1505 | nodiff = self.options.nodiff, | |||
|
1506 | diffviewer=self.options.view) | |||
1500 |
|
1507 | |||
1501 | def _cleanup(self): |
|
1508 | def _cleanup(self): | |
1502 | """Clean up state from this test invocation.""" |
|
1509 | """Clean up state from this test invocation.""" |
General Comments 0
You need to be logged in to leave comments.
Login now