617 result.refout = self._refout |
617 result.refout = self._refout |
618 |
618 |
619 if not self._options.keep_tmpdir: |
619 if not self._options.keep_tmpdir: |
620 shutil.rmtree(testtmp) |
620 shutil.rmtree(testtmp) |
621 |
621 |
|
622 if ret == SKIPPED_STATUS: |
|
623 if out is None: # Debug mode, nothing to parse. |
|
624 missing = ['unknown'] |
|
625 failed = None |
|
626 else: |
|
627 missing, failed = parsehghaveoutput(out) |
|
628 |
|
629 if not missing: |
|
630 missing = ['irrelevant'] |
|
631 |
|
632 if failed: |
|
633 return self.fail('hg have failed checking for %s' % failed[-1], |
|
634 ret) |
|
635 else: |
|
636 result.skipped = True |
|
637 return self.skip(missing[-1]) |
|
638 |
622 def _run(self, testtmp, replacements, env): |
639 def _run(self, testtmp, replacements, env): |
623 raise NotImplemented('Subclasses must implement Test.run()') |
640 raise NotImplemented('Subclasses must implement Test.run()') |
624 |
641 |
625 def _getreplacements(self, testtmp): |
642 def _getreplacements(self, testtmp): |
626 port = self._options.port + self._count * 3 |
643 port = self._options.port + self._count * 3 |
697 |
714 |
698 return '.', self._test, '' |
715 return '.', self._test, '' |
699 |
716 |
700 return warned and '~' or '!', self._test, msg |
717 return warned and '~' or '!', self._test, msg |
701 |
718 |
|
719 def skip(self, msg): |
|
720 if self._options.verbose: |
|
721 log("\nSkipping %s: %s" % (self._path, msg)) |
|
722 |
|
723 return 's', self._test, msg |
|
724 |
702 class TestResult(object): |
725 class TestResult(object): |
703 """Holds the result of a test execution.""" |
726 """Holds the result of a test execution.""" |
704 |
727 |
705 def __init__(self): |
728 def __init__(self): |
706 self.ret = None |
729 self.ret = None |
707 self.out = None |
730 self.out = None |
708 self.duration = None |
731 self.duration = None |
709 self.exception = None |
732 self.exception = None |
710 self.refout = None |
733 self.refout = None |
711 |
734 self.skipped = False |
712 @property |
|
713 def skipped(self): |
|
714 """Whether the test was skipped.""" |
|
715 return self.ret == SKIPPED_STATUS |
|
716 |
735 |
717 class PythonTest(Test): |
736 class PythonTest(Test): |
718 """A Python-based test.""" |
737 """A Python-based test.""" |
719 def _run(self, testtmp, replacements, env): |
738 def _run(self, testtmp, replacements, env): |
720 py3kswitch = self._options.py3k_warnings and ' -3' or '' |
739 py3kswitch = self._options.py3k_warnings and ' -3' or '' |
1099 |
1118 |
1100 vlog("# Test", test) |
1119 vlog("# Test", test) |
1101 |
1120 |
1102 t = runner(test, testpath, options, count, ref, err) |
1121 t = runner(test, testpath, options, count, ref, err) |
1103 res = TestResult() |
1122 res = TestResult() |
1104 t.run(res) |
1123 result = t.run(res) |
1105 |
1124 |
1106 if res.exception: |
1125 if res.exception: |
1107 return t.fail('Exception during execution: %s' % res.exception, 255) |
1126 return t.fail('Exception during execution: %s' % res.exception, 255) |
1108 |
1127 |
1109 ret = res.ret |
1128 ret = res.ret |
1120 f = open(err, "wb") |
1139 f = open(err, "wb") |
1121 for line in out: |
1140 for line in out: |
1122 f.write(line) |
1141 f.write(line) |
1123 f.close() |
1142 f.close() |
1124 |
1143 |
1125 if skipped: |
1144 if result: |
1126 if out is None: # debug mode: nothing to parse |
1145 pass |
1127 missing = ['unknown'] |
|
1128 failed = None |
|
1129 else: |
|
1130 missing, failed = parsehghaveoutput(out) |
|
1131 if not missing: |
|
1132 missing = ['irrelevant'] |
|
1133 if failed: |
|
1134 result = t.fail("hghave failed checking for %s" % failed[-1], ret) |
|
1135 skipped = False |
|
1136 else: |
|
1137 result = skip(missing[-1]) |
|
1138 elif ret == 'timeout': |
1146 elif ret == 'timeout': |
1139 result = t.fail("timed out", ret) |
1147 result = t.fail("timed out", ret) |
1140 elif out != refout: |
1148 elif out != refout: |
1141 info = {} |
1149 info = {} |
1142 if not options.nodiff: |
1150 if not options.nodiff: |