##// 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 vlog("# Running", cmd)
678 vlog("# Running", cmd)
679 if os.name == 'nt':
679 if os.name == 'nt':
680 replacements.append((r'\r\n', '\n'))
680 replacements.append((r'\r\n', '\n'))
681 return run(cmd, self._testtmp, self._options, replacements, env,
681 return run(cmd, self._testtmp, replacements, env, self._runner.abort,
682 self._runner.abort)
682 debug=self._options.debug, timeout=self._options.timeout)
683
683
684 class TTest(Test):
684 class TTest(Test):
685 """A "t test" is a test backed by a .t file."""
685 """A "t test" is a test backed by a .t file."""
@@ -709,8 +709,9 b' class TTest(Test):'
709 cmd = '%s "%s"' % (self._options.shell, fname)
709 cmd = '%s "%s"' % (self._options.shell, fname)
710 vlog("# Running", cmd)
710 vlog("# Running", cmd)
711
711
712 exitcode, output = run(cmd, self._testtmp, self._options, replacements,
712 exitcode, output = run(cmd, self._testtmp, replacements, env,
713 env, self._runner.abort)
713 self._runner.abort, debug=self._options.debug,
714 timeout=self._options.timeout)
714 # Do not merge output if skipped. Return hghave message instead.
715 # Do not merge output if skipped. Return hghave message instead.
715 # Similarly, with --debug, output is None.
716 # Similarly, with --debug, output is None.
716 if exitcode == self.SKIPPED_STATUS or output is None:
717 if exitcode == self.SKIPPED_STATUS or output is None:
@@ -987,16 +988,15 b' class TTest(Test):'
987
988
988
989
989 wifexited = getattr(os, "WIFEXITED", lambda x: False)
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 """Run command in a sub-process, capturing the output (stdout and stderr).
992 """Run command in a sub-process, capturing the output (stdout and stderr).
992 Return a tuple (exitcode, output). output is None in debug mode."""
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 debug:
994 if options.debug:
995 proc = subprocess.Popen(cmd, shell=True, cwd=wd, env=env)
995 proc = subprocess.Popen(cmd, shell=True, cwd=wd, env=env)
996 ret = proc.wait()
996 ret = proc.wait()
997 return (ret, None)
997 return (ret, None)
998
998
999 proc = Popen4(cmd, wd, options.timeout, env)
999 proc = Popen4(cmd, wd, timeout, env)
1000 def cleanup():
1000 def cleanup():
1001 terminate(proc)
1001 terminate(proc)
1002 ret = proc.wait()
1002 ret = proc.wait()
General Comments 0
You need to be logged in to leave comments. Login now