Skip to content

Conversation

@da-viper
Copy link
Contributor

I was running the tests and encounted this

TIMEOUT: lldb-api :: tools/lldb-dap/gotoTargets/TestDAP_gotoTargets.py (55 of 55)
******************** TEST 'lldb-api :: tools/lldb-dap/gotoTargets/TestDAP_gotoTargets.py' FAILED ********************
Script:
--
/usr/bin/python3.13 /path/to/llvm-project/lldb/test/API/dotest.py  ...
Exit Code: -9
Timeout: Reached timeout of 600 seconds

Command Output (stdout):

We are not checking if it exits correctly after the evaluate test. Not 100% sure but it may have caused the test failure on windows.

I may be the case for other tests.

@da-viper da-viper requested a review from JDevlieghere as a code owner May 20, 2025 19:21
@llvmbot llvmbot added the lldb label May 20, 2025
@llvmbot
Copy link
Member

llvmbot commented May 20, 2025

@llvm/pr-subscribers-lldb

Author: Ebuka Ezike (da-viper)

Changes

I was running the tests and encounted this

TIMEOUT: lldb-api :: tools/lldb-dap/gotoTargets/TestDAP_gotoTargets.py (55 of 55)
******************** TEST 'lldb-api :: tools/lldb-dap/gotoTargets/TestDAP_gotoTargets.py' FAILED ********************
Script:
--
/usr/bin/python3.13 /path/to/llvm-project/lldb/test/API/dotest.py  ...
Exit Code: -9
Timeout: Reached timeout of 600 seconds

Command Output (stdout):

We are not checking if it exits correctly after the evaluate test. Not 100% sure but it may have caused the test failure on windows.

I may be the case for other tests.


Full diff: https://github.com/llvm/llvm-project/pull/140788.diff

2 Files Affected:

  • (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py (+4-1)
  • (modified) lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py (+38-24)
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index afdc746ed0d0d..f3a8fbcfabae4 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -116,7 +116,7 @@ def verify_breakpoint_hit(self, breakpoint_ids, timeout=DEFAULT_TIMEOUT):
                 # location.
                 description = body["description"]
                 for breakpoint_id in breakpoint_ids:
-                    match_desc = "breakpoint %s." % (breakpoint_id)
+                    match_desc = f"breakpoint {breakpoint_id}."
                     if match_desc in description:
                         return
         self.assertTrue(False, f"breakpoint not hit, stopped_events={stopped_events}")
@@ -312,6 +312,9 @@ def continue_to_next_stop(self, timeout=DEFAULT_TIMEOUT):
         self.do_continue()
         return self.dap_server.wait_for_stopped(timeout)
 
+    def continue_to_breakpoint(self, breakpoint_id: str, timeout=DEFAULT_TIMEOUT):
+        self.continue_to_breakpoints((breakpoint_id), timeout)
+
     def continue_to_breakpoints(self, breakpoint_ids, timeout=DEFAULT_TIMEOUT):
         self.do_continue()
         self.verify_breakpoint_hit(breakpoint_ids, timeout)
diff --git a/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py b/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
index 2166e88151986..89762a9b6d32f 100644
--- a/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
+++ b/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
@@ -5,10 +5,8 @@
 import re
 
 import lldbdap_testcase
-import dap_server
-from lldbsuite.test import lldbutil
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import skipIfWindows
+from lldbsuite.test.lldbtest import line_number
 
 
 class TestDAP_evaluate(lldbdap_testcase.DAPTestCaseBase):
@@ -45,20 +43,34 @@ def run_test_evaluate_expressions(
             enableAutoVariableSummaries=enableAutoVariableSummaries,
         )
         source = "main.cpp"
-        self.set_source_breakpoints(
-            source,
-            [
-                line_number(source, "// breakpoint 1"),
-                line_number(source, "// breakpoint 2"),
-                line_number(source, "// breakpoint 3"),
-                line_number(source, "// breakpoint 4"),
-                line_number(source, "// breakpoint 5"),
-                line_number(source, "// breakpoint 6"),
-                line_number(source, "// breakpoint 7"),
-                line_number(source, "// breakpoint 8"),
-            ],
+        breakpoint_lines = [
+            line_number(source, "// breakpoint 1"),
+            line_number(source, "// breakpoint 2"),
+            line_number(source, "// breakpoint 3"),
+            line_number(source, "// breakpoint 4"),
+            line_number(source, "// breakpoint 5"),
+            line_number(source, "// breakpoint 6"),
+            line_number(source, "// breakpoint 7"),
+            line_number(source, "// breakpoint 8"),
+        ]
+        breakpoint_ids = self.set_source_breakpoints(source, breakpoint_lines)
+
+        self.assertEqual(
+            len(breakpoint_ids),
+            len(breakpoint_lines),
+            "Did not resolve all the breakpoints.",
         )
-        self.continue_to_next_stop()
+        (
+            breakpoint_1,
+            breakpoint_2,
+            breakpoint_3,
+            breakpoint_4,
+            breakpoint_5,
+            breakpoint_6,
+            breakpoint_7,
+            breakpoint_8,
+        ) = breakpoint_ids
+        self.continue_to_breakpoint(breakpoint_1)
 
         # Expressions at breakpoint 1, which is in main
         self.assertEvaluate("var1", "20")
@@ -124,7 +136,7 @@ def run_test_evaluate_expressions(
             self.assertEvaluateFailure("foo_var")
 
         # Expressions at breakpoint 2, which is an anonymous block
-        self.continue_to_next_stop()
+        self.continue_to_breakpoint(breakpoint_2)
         self.assertEvaluate("var1", "20")
         self.assertEvaluate("var2", "2")  # different variable with the same name
         self.assertEvaluate("static_int", "42")
@@ -162,7 +174,7 @@ def run_test_evaluate_expressions(
             self.assertEvaluateFailure("foo_var")
 
         # Expressions at breakpoint 3, which is inside a_function
-        self.continue_to_next_stop()
+        self.continue_to_breakpoint(breakpoint_3)
         self.assertEvaluate("list", "42")
         self.assertEvaluate("static_int", "42")
         self.assertEvaluate("non_static_int", "43")
@@ -188,28 +200,30 @@ def run_test_evaluate_expressions(
             self.assertEvaluateFailure("foo_var")
 
         # Now we check that values are updated after stepping
-        self.continue_to_next_stop()
+        self.continue_to_breakpoint(breakpoint_4)
         self.assertEvaluate("my_vec", "size=2")
-        self.continue_to_next_stop()
+        self.continue_to_breakpoint(breakpoint_5)
         self.assertEvaluate("my_vec", "size=3")
 
         self.assertEvaluate("my_map", "size=2")
-        self.continue_to_next_stop()
+        self.continue_to_breakpoint(breakpoint_6)
         self.assertEvaluate("my_map", "size=3")
 
         self.assertEvaluate("my_bool_vec", "size=1")
-        self.continue_to_next_stop()
+        self.continue_to_breakpoint(breakpoint_7)
         self.assertEvaluate("my_bool_vec", "size=2")
 
+        self.continue_to_breakpoint(breakpoint_8)
         # Test memory read, especially with 'empty' repeat commands.
         if context == "repl":
-            self.continue_to_next_stop()
             self.assertEvaluate("memory read -c 1 &my_ints", ".* 05 .*\n")
             self.assertEvaluate("", ".* 0a .*\n")
             self.assertEvaluate("", ".* 0f .*\n")
             self.assertEvaluate("", ".* 14 .*\n")
             self.assertEvaluate("", ".* 19 .*\n")
 
+        self.continue_to_exit()
+
     @skipIfWindows
     def test_generic_evaluate_expressions(self):
         # Tests context-less expression evaluations

Copy link
Contributor

@ashgti ashgti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good cleanup!

@da-viper da-viper merged commit d219a71 into llvm:main May 21, 2025
10 checks passed
@da-viper da-viper deleted the test-evaluate-exits-correctly branch May 30, 2025 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants