tests/run-tests.py
changeset 1185 5ac75dd311d5
parent 1183 f5d89f804e6f
child 1186 d821f658f7a3
equal deleted inserted replaced
1181:07a7aabca5ce 1185:5ac75dd311d5
   600     def hghave(reqs):
   600     def hghave(reqs):
   601         # TODO: do something smarter when all other uses of hghave is gone
   601         # TODO: do something smarter when all other uses of hghave is gone
   602         tdir = TESTDIR.replace('\\', '/')
   602         tdir = TESTDIR.replace('\\', '/')
   603         proc = Popen4('%s -c "%s/hghave %s"' %
   603         proc = Popen4('%s -c "%s/hghave %s"' %
   604                       (options.shell, tdir, ' '.join(reqs)), wd, 0)
   604                       (options.shell, tdir, ' '.join(reqs)), wd, 0)
   605         proc.communicate()
   605         stdout, stderr = proc.communicate()
   606         ret = proc.wait()
   606         ret = proc.wait()
   607         if wifexited(ret):
   607         if wifexited(ret):
   608             ret = os.WEXITSTATUS(ret)
   608             ret = os.WEXITSTATUS(ret)
       
   609         if ret == 2:
       
   610             print stdout
       
   611             sys.exit(1)
   609         return ret == 0
   612         return ret == 0
   610 
   613 
   611     f = open(test)
   614     f = open(test)
   612     t = f.readlines()
   615     t = f.readlines()
   613     f.close()
   616     f.close()
   744 def run(cmd, wd, options, replacements):
   747 def run(cmd, wd, options, replacements):
   745     """Run command in a sub-process, capturing the output (stdout and stderr).
   748     """Run command in a sub-process, capturing the output (stdout and stderr).
   746     Return a tuple (exitcode, output).  output is None in debug mode."""
   749     Return a tuple (exitcode, output).  output is None in debug mode."""
   747     # TODO: Use subprocess.Popen if we're running on Python 2.4
   750     # TODO: Use subprocess.Popen if we're running on Python 2.4
   748     if options.debug:
   751     if options.debug:
   749         proc = subprocess.Popen(cmd, shell=True, cwd=wd)
   752         proc = subprocess.Popen(cmd, shell=True, cwd=wd, stdin=subprocess.PIPE)
       
   753         proc.stdin.close()
   750         ret = proc.wait()
   754         ret = proc.wait()
   751         return (ret, None)
   755         return (ret, None)
   752 
   756 
   753     proc = Popen4(cmd, wd, options.timeout)
   757     proc = Popen4(cmd, wd, options.timeout)
   754     def cleanup():
   758     def cleanup():