equal
deleted
inserted
replaced
557 self._testtmp = os.path.join(self.threadtmp, os.path.basename(path)) |
557 self._testtmp = os.path.join(self.threadtmp, os.path.basename(path)) |
558 os.mkdir(self._testtmp) |
558 os.mkdir(self._testtmp) |
559 |
559 |
560 self._setreplacements(count) |
560 self._setreplacements(count) |
561 |
561 |
562 def run(self, result): |
562 def run(self, result, refpath): |
563 env = self._getenv() |
563 env = self._getenv() |
564 createhgrc(env['HGRCPATH'], self._options) |
564 createhgrc(env['HGRCPATH'], self._options) |
565 |
565 |
566 starttime = time.time() |
566 starttime = time.time() |
567 |
567 |
579 except Exception, e: |
579 except Exception, e: |
580 updateduration() |
580 updateduration() |
581 result.exception = e |
581 result.exception = e |
582 |
582 |
583 killdaemons(env['DAEMON_PIDS']) |
583 killdaemons(env['DAEMON_PIDS']) |
|
584 |
|
585 # If we're not in --debug mode and reference output file exists, |
|
586 # check test output against it. |
|
587 if self._options.debug: |
|
588 result.refout = None # to match "out is None" |
|
589 elif os.path.exists(refpath): |
|
590 f = open(refpath, 'r') |
|
591 result.refout = f.read().splitlines(True) |
|
592 f.close() |
|
593 else: |
|
594 result.refout = [] |
584 |
595 |
585 def _run(self, replacements, env): |
596 def _run(self, replacements, env): |
586 raise NotImplemented('Subclasses must implement Test.run()') |
597 raise NotImplemented('Subclasses must implement Test.run()') |
587 |
598 |
588 def _setreplacements(self, count): |
599 def _setreplacements(self, count): |
646 self.ret = None |
657 self.ret = None |
647 self.out = None |
658 self.out = None |
648 self.duration = None |
659 self.duration = None |
649 self.interrupted = False |
660 self.interrupted = False |
650 self.exception = None |
661 self.exception = None |
|
662 self.refout = None |
651 |
663 |
652 @property |
664 @property |
653 def skipped(self): |
665 def skipped(self): |
654 """Whether the test was skipped.""" |
666 """Whether the test was skipped.""" |
655 return self.ret == SKIPPED_STATUS |
667 return self.ret == SKIPPED_STATUS |
1053 if os.path.exists(err): |
1065 if os.path.exists(err): |
1054 os.remove(err) # Remove any previous output files |
1066 os.remove(err) # Remove any previous output files |
1055 |
1067 |
1056 t = runner(testpath, options, count) |
1068 t = runner(testpath, options, count) |
1057 res = TestResult() |
1069 res = TestResult() |
1058 t.run(res) |
1070 t.run(res, ref) |
1059 |
1071 |
1060 if res.interrupted: |
1072 if res.interrupted: |
1061 log('INTERRUPTED: %s (after %d seconds)' % (test, res.duration)) |
1073 log('INTERRUPTED: %s (after %d seconds)' % (test, res.duration)) |
1062 raise KeyboardInterrupt() |
1074 raise KeyboardInterrupt() |
1063 |
1075 |
1069 |
1081 |
1070 times.append((test, res.duration)) |
1082 times.append((test, res.duration)) |
1071 vlog("# Ret was:", ret) |
1083 vlog("# Ret was:", ret) |
1072 |
1084 |
1073 skipped = res.skipped |
1085 skipped = res.skipped |
1074 |
1086 refout = res.refout |
1075 # If we're not in --debug mode and reference output file exists, |
|
1076 # check test output against it. |
|
1077 if options.debug: |
|
1078 refout = None # to match "out is None" |
|
1079 elif os.path.exists(ref): |
|
1080 f = open(ref, "r") |
|
1081 refout = f.read().splitlines(True) |
|
1082 f.close() |
|
1083 else: |
|
1084 refout = [] |
|
1085 |
1087 |
1086 if (ret != 0 or out != refout) and not skipped and not options.debug: |
1088 if (ret != 0 or out != refout) and not skipped and not options.debug: |
1087 # Save errors to a file for diagnosis |
1089 # Save errors to a file for diagnosis |
1088 f = open(err, "wb") |
1090 f = open(err, "wb") |
1089 for line in out: |
1091 for line in out: |