[Lldb-commits] [lldb] [lldb] Remove process restart prompt from TestSourceManager (PR #85861)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 19 16:12:43 PDT 2024


https://github.com/bulbazord updated https://github.com/llvm/llvm-project/pull/85861

>From c24630bbccd3d53079314f7dc6393ffa27ea192f Mon Sep 17 00:00:00 2001
From: Alex Langford <alangford at apple.com>
Date: Tue, 19 Mar 2024 13:18:23 -0700
Subject: [PATCH 1/2] [lldb] Remove process restart prompt from
 TestSourceManager

In TestSourceManager, test_artificial_source_location will give the
process restart prompt if you run the test individually. The reason is
that we run the process twice: first using a convenience function to run
to a specific breakpoint and then again to check for a specific message
emitted when you hit the breakpoint. Instead of running twice and making
the test difficult to run individually, we can just check for the
specific messages using other commands instead.
---
 lldb/test/API/source-manager/TestSourceManager.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lldb/test/API/source-manager/TestSourceManager.py b/lldb/test/API/source-manager/TestSourceManager.py
index eab8924d108146..896fec24791cd2 100644
--- a/lldb/test/API/source-manager/TestSourceManager.py
+++ b/lldb/test/API/source-manager/TestSourceManager.py
@@ -323,13 +323,13 @@ def test_artificial_source_location(self):
         )
 
         self.expect(
-            "run",
-            RUN_SUCCEEDED,
+            "thread info", substrs=[f"{src_file}:0", "stop reason = breakpoint"]
+        )
+        self.expect(
+            "frame select 0",
             substrs=[
-                "stop reason = breakpoint",
-                "%s:%d" % (src_file, 0),
-                "Note: this address is compiler-generated code in " "function",
-                "that has no source code associated " "with it.",
+                "Note: this address is compiler-generated code in function",
+                "that has no source code associated with it.",
             ],
         )
 

>From ab0a0d026f129be17505f8b34406f7ca94332d2e Mon Sep 17 00:00:00 2001
From: Alex Langford <alangford at apple.com>
Date: Tue, 19 Mar 2024 16:12:29 -0700
Subject: [PATCH 2/2] Collapse into one command

---
 lldb/test/API/source-manager/TestSourceManager.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lldb/test/API/source-manager/TestSourceManager.py b/lldb/test/API/source-manager/TestSourceManager.py
index 896fec24791cd2..ad7c85aac70eaf 100644
--- a/lldb/test/API/source-manager/TestSourceManager.py
+++ b/lldb/test/API/source-manager/TestSourceManager.py
@@ -323,11 +323,10 @@ def test_artificial_source_location(self):
         )
 
         self.expect(
-            "thread info", substrs=[f"{src_file}:0", "stop reason = breakpoint"]
-        )
-        self.expect(
-            "frame select 0",
+            "process status",
             substrs=[
+                "stop reason = breakpoint",
+                f"{src_file}:0",
                 "Note: this address is compiler-generated code in function",
                 "that has no source code associated with it.",
             ],



More information about the lldb-commits mailing list