tests/run-tests.py
branchstable
changeset 1242 2d7fa9712652
parent 1241 bc56ed64a2c8
child 1243 00ca4c2f51cc
equal deleted inserted replaced
1241:bc56ed64a2c8 1242:2d7fa9712652
   381     try:
   381     try:
   382         getattr(proc, 'terminate', lambda : os.kill(proc.pid, signal.SIGTERM))()
   382         getattr(proc, 'terminate', lambda : os.kill(proc.pid, signal.SIGTERM))()
   383     except OSError:
   383     except OSError:
   384         pass
   384         pass
   385 
   385 
   386 def killdaemons():
   386 def killdaemons(pidfile):
   387     return killmod.killdaemons(DAEMON_PIDS, tryhard=False, remove=True,
   387     return killmod.killdaemons(pidfile, tryhard=False, remove=True,
   388                                logfn=vlog)
   388                                logfn=vlog)
   389 
   389 
   390 def cleanup(options):
   390 def cleanup(options):
   391     if not options.keep_tmpdir:
   391     if not options.keep_tmpdir:
   392         vlog("# Cleaning up HGTMP", HGTMP)
   392         vlog("# Cleaning up HGTMP", HGTMP)
   804     def cleanup():
   804     def cleanup():
   805         terminate(proc)
   805         terminate(proc)
   806         ret = proc.wait()
   806         ret = proc.wait()
   807         if ret == 0:
   807         if ret == 0:
   808             ret = signal.SIGTERM << 8
   808             ret = signal.SIGTERM << 8
   809         killdaemons()
   809         killdaemons(env['DAEMON_PIDS'])
   810         return ret
   810         return ret
   811 
   811 
   812     output = ''
   812     output = ''
   813     proc.tochild.close()
   813     proc.tochild.close()
   814 
   814 
   825 
   825 
   826     if proc.timeout:
   826     if proc.timeout:
   827         ret = 'timeout'
   827         ret = 'timeout'
   828 
   828 
   829     if ret:
   829     if ret:
   830         killdaemons()
   830         killdaemons(env['DAEMON_PIDS'])
   831 
   831 
   832     for s, r in replacements:
   832     for s, r in replacements:
   833         output = re.sub(s, r, output)
   833         output = re.sub(s, r, output)
   834     return ret, output.splitlines(True)
   834     return ret, output.splitlines(True)
   835 
   835 
   938     if options.time:
   938     if options.time:
   939         endtime = time.time()
   939         endtime = time.time()
   940         times.append((test, endtime - starttime))
   940         times.append((test, endtime - starttime))
   941     vlog("# Ret was:", ret)
   941     vlog("# Ret was:", ret)
   942 
   942 
   943     killdaemons()
   943     killdaemons(env['DAEMON_PIDS'])
   944 
   944 
   945     skipped = (ret == SKIPPED_STATUS)
   945     skipped = (ret == SKIPPED_STATUS)
   946 
   946 
   947     # If we're not in --debug mode and reference output file exists,
   947     # If we're not in --debug mode and reference output file exists,
   948     # check test output against it.
   948     # check test output against it.