[PATCH] Add per-test timeouts to lit

Jonathan Roelofs jonathan at codesourcery.com
Wed May 27 10:06:10 PDT 2015


================
Comment at: utils/lit/lit/TestRunner.py:308
@@ +307,3 @@
+    if wd is not None and wd.timed_out:
+        out += "\n\nTimed out after %.2f seconds" % (litConfig.timeout)
+
----------------
Here too.

================
Comment at: utils/lit/lit/util.py:19
@@ +18,3 @@
+        self.timer = threading.Timer(timeout, self.handler)
+        self.timer.start()
+
----------------
EricWF wrote:
> Why not start the timer when `watch(...)` is called for the first time? It seems like some code takes steps between creating the Watchdog and the call to `watch(...)`. Those steps may unfairly count against the test timeout.
sounds reasonable.

================
Comment at: utils/lit/lit/util.py:31
@@ +30,3 @@
+
+    def handler(self):
+        self.timed_out = True
----------------
EricWF wrote:
> What thread of execution does `Threading.timer` execute this function in? I think we would need to add a lock to `Watchdog` if the handler runs in a separate thread.
Good point.

I think the timer executes its action in the "other" thread (i.e. not the one that create the timer).

================
Comment at: utils/lit/lit/util.py:45
@@ +44,3 @@
+    def cancel(self):
+        if self.timer is not None:
+            self.timer.cancel()
----------------
EricWF wrote:
> How can `self.timer` be `None`?
oops... leftover crud.

================
Comment at: utils/lit/lit/util.py:200
@@ -160,3 +199,3 @@
 kUseCloseFDs = not (platform.system() == 'Windows')
-def executeCommand(command, cwd=None, env=None):
+def executeCommand(command, cwd=None, env=None, timeout=None):
     p = subprocess.Popen(command, cwd=cwd,
----------------
EricWF wrote:
> How does executeCommand communicate to the caller that a timeout has occurred?
Some text about it is added to 'err' and returned. Because the timeout happened, the exitcode should be nonzero too. See below, line ~216. Also in `executeScriptInternal`.

http://reviews.llvm.org/D6584

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






More information about the llvm-commits mailing list