tests/run-tests.py
branchstable
changeset 1059 1745fd2dd308
parent 1046 2890e1f3d8e4
child 1065 c1d229864cd3
equal deleted inserted replaced
1057:66d2754c6f30 1059:1745fd2dd308
    73     p.timeout = False
    73     p.timeout = False
    74     if timeout:
    74     if timeout:
    75         def t():
    75         def t():
    76             start = time.time()
    76             start = time.time()
    77             while time.time() - start < timeout and p.returncode is None:
    77             while time.time() - start < timeout and p.returncode is None:
    78                 time.sleep(1)
    78                 time.sleep(.1)
    79             p.timeout = True
    79             p.timeout = True
    80             if p.returncode is None:
    80             if p.returncode is None:
    81                 terminate(p)
    81                 terminate(p)
    82         threading.Thread(target=t).start()
    82         threading.Thread(target=t).start()
    83 
    83 
   358                 continue
   358                 continue
   359             try:
   359             try:
   360                 os.kill(pid, 0)
   360                 os.kill(pid, 0)
   361                 vlog('# Killing daemon process %d' % pid)
   361                 vlog('# Killing daemon process %d' % pid)
   362                 os.kill(pid, signal.SIGTERM)
   362                 os.kill(pid, signal.SIGTERM)
   363                 time.sleep(0.25)
   363                 time.sleep(0.1)
   364                 os.kill(pid, 0)
   364                 os.kill(pid, 0)
   365                 vlog('# Daemon process %d is stuck - really killing it' % pid)
   365                 vlog('# Daemon process %d is stuck - really killing it' % pid)
   366                 os.kill(pid, signal.SIGKILL)
   366                 os.kill(pid, signal.SIGKILL)
   367             except OSError, err:
   367             except OSError, err:
   368                 if err.errno != errno.ESRCH:
   368                 if err.errno != errno.ESRCH:
  1273         if len(tests) > 1 and options.jobs > 1:
  1273         if len(tests) > 1 and options.jobs > 1:
  1274             runchildren(options, tests)
  1274             runchildren(options, tests)
  1275         else:
  1275         else:
  1276             runtests(options, tests)
  1276             runtests(options, tests)
  1277     finally:
  1277     finally:
  1278         time.sleep(1)
  1278         time.sleep(.1)
  1279         cleanup(options)
  1279         cleanup(options)
  1280 
  1280 
  1281 if __name__ == '__main__':
  1281 if __name__ == '__main__':
  1282     main()
  1282     main()