##// END OF EJS Templates
test-run-tests: stabilize the test (issue5735)...
Jun Wu -
r35586:87676e8e stable
parent child Browse files
Show More
@@ -659,6 +659,7 b' class Test(unittest.TestCase):'
659
659
660 def __init__(self, path, outputdir, tmpdir, keeptmpdir=False,
660 def __init__(self, path, outputdir, tmpdir, keeptmpdir=False,
661 debug=False,
661 debug=False,
662 first=False,
662 timeout=None,
663 timeout=None,
663 startport=None, extraconfigopts=None,
664 startport=None, extraconfigopts=None,
664 py3kwarnings=False, shell=None, hgcommand=None,
665 py3kwarnings=False, shell=None, hgcommand=None,
@@ -711,6 +712,7 b' class Test(unittest.TestCase):'
711 self._threadtmp = tmpdir
712 self._threadtmp = tmpdir
712 self._keeptmpdir = keeptmpdir
713 self._keeptmpdir = keeptmpdir
713 self._debug = debug
714 self._debug = debug
715 self._first = first
714 self._timeout = timeout
716 self._timeout = timeout
715 self._slowtimeout = slowtimeout
717 self._slowtimeout = slowtimeout
716 self._startport = startport
718 self._startport = startport
@@ -896,9 +898,13 b' class Test(unittest.TestCase):'
896 f.close()
898 f.close()
897
899
898 # The result object handles diff calculation for us.
900 # The result object handles diff calculation for us.
901 with firstlock:
899 if self._result.addOutputMismatch(self, ret, out, self._refout):
902 if self._result.addOutputMismatch(self, ret, out, self._refout):
900 # change was accepted, skip failing
903 # change was accepted, skip failing
901 return
904 return
905 if self._first:
906 global firsterror
907 firsterror = True
902
908
903 if ret:
909 if ret:
904 msg = 'output changed and ' + describe(ret)
910 msg = 'output changed and ' + describe(ret)
@@ -1620,6 +1626,8 b' class TTest(Test):'
1620 return TTest.ESCAPESUB(TTest._escapef, s)
1626 return TTest.ESCAPESUB(TTest._escapef, s)
1621
1627
1622 iolock = threading.RLock()
1628 iolock = threading.RLock()
1629 firstlock = threading.RLock()
1630 firsterror = False
1623
1631
1624 class TestResult(unittest._TextTestResult):
1632 class TestResult(unittest._TextTestResult):
1625 """Holds results when executing via unittest."""
1633 """Holds results when executing via unittest."""
@@ -1705,7 +1713,7 b' class TestResult(unittest._TextTestResul'
1705
1713
1706 def addOutputMismatch(self, test, ret, got, expected):
1714 def addOutputMismatch(self, test, ret, got, expected):
1707 """Record a mismatch in test output for a particular test."""
1715 """Record a mismatch in test output for a particular test."""
1708 if self.shouldStop:
1716 if self.shouldStop or firsterror:
1709 # don't print, some other test case already failed and
1717 # don't print, some other test case already failed and
1710 # printed, we're just stale and probably failed due to our
1718 # printed, we're just stale and probably failed due to our
1711 # temp dir getting cleaned up.
1719 # temp dir getting cleaned up.
@@ -2637,6 +2645,7 b' class TestRunner(object):'
2637 t = testcls(refpath, self._outputdir, tmpdir,
2645 t = testcls(refpath, self._outputdir, tmpdir,
2638 keeptmpdir=self.options.keep_tmpdir,
2646 keeptmpdir=self.options.keep_tmpdir,
2639 debug=self.options.debug,
2647 debug=self.options.debug,
2648 first=self.options.first,
2640 timeout=self.options.timeout,
2649 timeout=self.options.timeout,
2641 startport=self._getport(count),
2650 startport=self._getport(count),
2642 extraconfigopts=self.options.extra_config_opt,
2651 extraconfigopts=self.options.extra_config_opt,
General Comments 0
You need to be logged in to leave comments. Login now