Skip to content

[lldb] Remove process restart prompt from TestSourceManager #85861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 20, 2024

Conversation

bulbazord
Copy link
Member

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.

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.
@bulbazord bulbazord requested a review from JDevlieghere as a code owner March 19, 2024 20:21
@bulbazord bulbazord requested review from medismailben and removed request for JDevlieghere March 19, 2024 20:21
@llvmbot llvmbot added the lldb label Mar 19, 2024
@bulbazord bulbazord requested a review from JDevlieghere March 19, 2024 20:21
@llvmbot
Copy link
Member

llvmbot commented Mar 19, 2024

@llvm/pr-subscribers-lldb

Author: Alex Langford (bulbazord)

Changes

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.


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

1 Files Affected:

  • (modified) lldb/test/API/source-manager/TestSourceManager.py (+6-6)
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.",
             ],
         )
 

Comment on lines 325 to 332
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.",
Copy link
Member

Choose a reason for hiding this comment

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

Can't this be a single process status command instead of both thread info & frame select 0 ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just tried it out, it totally can be. Thanks for the tip!

Copy link
Member

@medismailben medismailben left a comment

Choose a reason for hiding this comment

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

LGTM!

@bulbazord bulbazord merged commit 66a2ed5 into llvm:main Mar 20, 2024
@bulbazord bulbazord deleted the dont-prompt-in-test branch March 20, 2024 17:43
chencha3 pushed a commit to chencha3/llvm-project that referenced this pull request Mar 23, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants