[PATCH] Add per-test timeouts to lit

Eric Fiselier eric at efcs.ca
Thu May 28 09:07:03 PDT 2015


Leading question: If a shell command guarded by a Watchdog exits scope via an exception should `Watchdog.cancel()` be called? I think the `Watchdog` should provide a factory function that can be used in a `with` statement. The definition would looks something like this:

  @contextmanager
  def createWatchdog(timeout, popen=None):
      wg = Watchdog(timeout)
      if popen is not None:
        wg.watch(popen)
      yield wg
      wg.cancel()

I think the usage pattern for `Watchdog` should be:

  p = subprocess.Popen(cmd)
  with createWatchdog(timeout, p) as wg:
      out,err = p.communicate()
      exitCode = p.wait()
      

What do you think?


http://reviews.llvm.org/D6584

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list