[lldb/test] Increase pexpect termination timeouts
authorPavel Labath <pavel@labath.sk>
Tue, 22 Mar 2022 13:52:02 +0000 (14:52 +0100)
committerPavel Labath <pavel@labath.sk>
Tue, 22 Mar 2022 14:14:21 +0000 (15:14 +0100)
By default these timeouts are extremely small (0.1s). This means that
100ms after sending an EOF, pexpect will start sending the process
increasingly aggressive signals, but the small timeouts mean that (on a
loaded machine) the kernel may not have enough time to process the
signal even if the overall effect of the signal is to kill the
application.

It turns out we were already relying on this signals (instead of regular
EOF quits) in our tests. In my experiments it was sufficient to block
SIGINT and SIGHUP to cause some test to become flaky. This was most
likely the reason of a couple of flakes on the lldb-x86_64-debian bot,
and is probably the reason why the pexpect tests are flaky on several
other (e.g. asan) bots.

This patch increses the timeout to 6 seconds (60-fold increase), which
is hopefully sufficient to avoid flakes even in the most extreme
situations.

lldb/packages/Python/lldbsuite/test/lldbpexpect.py

index 84a0d61..de8f819 100644 (file)
@@ -47,6 +47,8 @@ class PExpectTest(TestBase):
         self.child = pexpect.spawn(
                 args[0], args=args[1:], logfile=logfile,
                 timeout=timeout, dimensions=dimensions, env=env)
+        self.child.ptyproc.delayafterclose = timeout/10
+        self.child.ptyproc.delayafterterminate = timeout/10
 
         if post_spawn is not None:
             post_spawn()