##// END OF EJS Templates
run-tests: capture reference output in Test.__init__...
Gregory Szorc -
r21318:6b3d66e4 default
parent child Browse files
Show More
@@ -551,11 +551,22 b' class Test(object):'
551 551 runs cannot be run concurrently.
552 552 """
553 553
554 def __init__(self, path, options, count):
554 def __init__(self, path, options, count, refpath):
555 555 self._path = path
556 556 self._options = options
557 557 self._count = count
558 558
559 # If we're not in --debug mode and reference output file exists,
560 # check test output against it.
561 if options.debug:
562 self._refout = None # to match "out is None"
563 elif os.path.exists(refpath):
564 f = open(refpath, 'r')
565 self._refout = f.read().splitlines(True)
566 f.close()
567 else:
568 self._refout = []
569
559 570 self._threadtmp = os.path.join(HGTMP, 'child%d' % count)
560 571 os.mkdir(self._threadtmp)
561 572
@@ -563,7 +574,7 b' class Test(object):'
563 574 if self._threadtmp and not self._options.keep_tmpdir:
564 575 shutil.rmtree(self._threadtmp, True)
565 576
566 def run(self, result, refpath):
577 def run(self, result):
567 578 testtmp = os.path.join(self._threadtmp, os.path.basename(self._path))
568 579 os.mkdir(testtmp)
569 580 replacements, port = self._getreplacements(testtmp)
@@ -589,16 +600,7 b' class Test(object):'
589 600
590 601 killdaemons(env['DAEMON_PIDS'])
591 602
592 # If we're not in --debug mode and reference output file exists,
593 # check test output against it.
594 if self._options.debug:
595 result.refout = None # to match "out is None"
596 elif os.path.exists(refpath):
597 f = open(refpath, 'r')
598 result.refout = f.read().splitlines(True)
599 f.close()
600 else:
601 result.refout = []
603 result.refout = self._refout
602 604
603 605 if not self._options.keep_tmpdir:
604 606 shutil.rmtree(testtmp)
@@ -1084,9 +1086,9 b' def runone(options, test, count):'
1084 1086 if os.path.exists(err):
1085 1087 os.remove(err) # Remove any previous output files
1086 1088
1087 t = runner(testpath, options, count)
1089 t = runner(testpath, options, count, ref)
1088 1090 res = TestResult()
1089 t.run(res, ref)
1091 t.run(res)
1090 1092 t.cleanup()
1091 1093
1092 1094 if res.interrupted:
General Comments 0
You need to be logged in to leave comments. Login now