llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Charles Zablit (charles-zablit) <details> <summary>Changes</summary> This is a follow up to https://github.com/llvm/llvm-project/pull/172879. This patch adds a timeout to the `TestDAP_attach.spawn_and_wait` method. The helper method was previously relying on the per test lit timeout, which does not work if `psutil` is not installed. The timeout is now enforced whether or not `psutil` is installed. --- Full diff: https://github.com/llvm/llvm-project/pull/174461.diff 1 Files Affected: - (modified) lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py (+7-1) ``````````diff diff --git a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py index 00facfbc60ad5..a7d0993ec7c6f 100644 --- a/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py +++ b/lldb/test/API/tools/lldb-dap/attach/TestDAP_attach.py @@ -2,6 +2,7 @@ Test lldb-dap attach request """ +from datetime import datetime, timedelta from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil @@ -25,10 +26,15 @@ def spawn(self, program, args=None): ) def spawn_and_wait(self, program, delay): + SPAWN_AND_WAIT_TIMEOUT = 900 time.sleep(delay) proc = self.spawn(program=program) - # Wait for either the process to exit or the event to be set + start_time = datetime.now() + # Wait for either the process to exit or the event to be set. while proc.poll() is None and not self.spawn_event.is_set(): + elapsed = datetime.now() - start_time + if elapsed >= timedelta(seconds=SPAWN_AND_WAIT_TIMEOUT): + break time.sleep(0.1) proc.kill() proc.wait() `````````` </details> https://github.com/llvm/llvm-project/pull/174461 _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
