##// END OF EJS Templates
run-tests: move t test execution from tsttest() to TTest.run()...
Gregory Szorc -
r21313:a2bd02a3 default
parent child Browse files
Show More
@@ -747,28 +747,7 b' def linematch(el, l):'
747 return '+glob'
747 return '+glob'
748 return False
748 return False
749
749
750 def tsttest(t, test, wd, options, replacements, env):
750 def tsttest(t, wd, options, salt, after, expected, exitcode, output):
751 f = open(test)
752 tlines = f.readlines()
753 f.close()
754
755 salt, script, after, expected = t._parsetest(tlines, wd)
756
757 # Write out the script and execute it
758 name = wd + '.sh'
759 f = open(name, 'w')
760 for l in script:
761 f.write(l)
762 f.close()
763
764 cmd = '%s "%s"' % (options.shell, name)
765 vlog("# Running", cmd)
766 exitcode, output = run(cmd, wd, options, replacements, env)
767 # do not merge output if skipped, return hghave message instead
768 # similarly, with --debug, output is None
769 if exitcode == SKIPPED_STATUS or output is None:
770 return exitcode, output
771
772 # Merge the script output back into a unified test
751 # Merge the script output back into a unified test
773
752
774 warnonly = 1 # 1: not yet, 2: yes, 3: for sure not
753 warnonly = 1 # 1: not yet, 2: yes, 3: for sure not
@@ -833,8 +812,30 b' class TTest(Test):'
833 """A "t test" is a test backed by a .t file."""
812 """A "t test" is a test backed by a .t file."""
834
813
835 def _run(self, testtmp, replacements, env):
814 def _run(self, testtmp, replacements, env):
836 return tsttest(self, self._path, testtmp, self._options, replacements,
815 f = open(self._path)
837 env)
816 lines = f.readlines()
817 f.close()
818
819 salt, script, after, expected = self._parsetest(lines, testtmp)
820
821 # Write out the generated script.
822 fname = '%s.sh' % testtmp
823 f = open(fname, 'w')
824 for l in script:
825 f.write(l)
826 f.close()
827
828 cmd = '%s "%s"' % (self._options.shell, fname)
829 vlog("# Running", cmd)
830
831 exitcode, output = run(cmd, testtmp, self._options, replacements, env)
832 # Do not merge output if skipped. Return hghave message instead.
833 # Similarly, with --debug, output is None.
834 if exitcode == SKIPPED_STATUS or output is None:
835 return exitcode, output
836
837 return tsttest(self, testtmp, self._options, salt, after, expected,
838 exitcode, output)
838
839
839 def _hghave(self, reqs, testtmp):
840 def _hghave(self, reqs, testtmp):
840 # TODO do something smarter when all other uses of hghave are gone.
841 # TODO do something smarter when all other uses of hghave are gone.
General Comments 0
You need to be logged in to leave comments. Login now