##// END OF EJS Templates
run-tests: factor options out of run()...
Gregory Szorc -
r21499:d22f4e72 default
parent child Browse files
Show More
@@ -678,8 +678,8 b' class PythonTest(Test):'
678 678 vlog("# Running", cmd)
679 679 if os.name == 'nt':
680 680 replacements.append((r'\r\n', '\n'))
681 return run(cmd, self._testtmp, self._options, replacements, env,
682 self._runner.abort)
681 return run(cmd, self._testtmp, replacements, env, self._runner.abort,
682 debug=self._options.debug, timeout=self._options.timeout)
683 683
684 684 class TTest(Test):
685 685 """A "t test" is a test backed by a .t file."""
@@ -709,8 +709,9 b' class TTest(Test):'
709 709 cmd = '%s "%s"' % (self._options.shell, fname)
710 710 vlog("# Running", cmd)
711 711
712 exitcode, output = run(cmd, self._testtmp, self._options, replacements,
713 env, self._runner.abort)
712 exitcode, output = run(cmd, self._testtmp, replacements, env,
713 self._runner.abort, debug=self._options.debug,
714 timeout=self._options.timeout)
714 715 # Do not merge output if skipped. Return hghave message instead.
715 716 # Similarly, with --debug, output is None.
716 717 if exitcode == self.SKIPPED_STATUS or output is None:
@@ -987,16 +988,15 b' class TTest(Test):'
987 988
988 989
989 990 wifexited = getattr(os, "WIFEXITED", lambda x: False)
990 def run(cmd, wd, options, replacements, env, abort):
991 def run(cmd, wd, replacements, env, abort, debug=False, timeout=None):
991 992 """Run command in a sub-process, capturing the output (stdout and stderr).
992 993 Return a tuple (exitcode, output). output is None in debug mode."""
993 # TODO: Use subprocess.Popen if we're running on Python 2.4
994 if options.debug:
994 if debug:
995 995 proc = subprocess.Popen(cmd, shell=True, cwd=wd, env=env)
996 996 ret = proc.wait()
997 997 return (ret, None)
998 998
999 proc = Popen4(cmd, wd, options.timeout, env)
999 proc = Popen4(cmd, wd, timeout, env)
1000 1000 def cleanup():
1001 1001 terminate(proc)
1002 1002 ret = proc.wait()
General Comments 0
You need to be logged in to leave comments. Login now