Skip to content

[lldb-dap] Adjust the evaluate test to use a different lldb command. #116045

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 1 commit into from
Nov 13, 2024

Conversation

ashgti
Copy link
Contributor

@ashgti ashgti commented Nov 13, 2024

Previously this used var as both an lldb command and variable in the source to validate the behavior of the 'auto' repl mode. However, var seems to occasionally fail in the CI test when attempting to print some c++ types. Instead switch the command and variable name to list which should not run the dynamic variable formatting code for c++ objects.

This should fix #116041.

Previously this used `var` as both an lldb command and variable in the source to validate the behavior of the 'auto' repl mode. However, `var` seems to occasionally fail in the CI test when attempting to print some c++ types. Instead switch the command and variable name to `list` which should not run the dynamic variable formatting code for c++ objects.
@ashgti ashgti marked this pull request as ready for review November 13, 2024 13:32
@ashgti ashgti requested a review from JDevlieghere as a code owner November 13, 2024 13:32
@llvmbot llvmbot added the lldb label Nov 13, 2024
@llvmbot
Copy link
Member

llvmbot commented Nov 13, 2024

@llvm/pr-subscribers-lldb

Author: John Harrison (ashgti)

Changes

Previously this used var as both an lldb command and variable in the source to validate the behavior of the 'auto' repl mode. However, var seems to occasionally fail in the CI test when attempting to print some c++ types. Instead switch the command and variable name to list which should not run the dynamic variable formatting code for c++ objects.

This should fix #116041.


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

2 Files Affected:

  • (modified) lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py (+5-5)
  • (modified) lldb/test/API/tools/lldb-dap/evaluate/main.cpp (+2-2)
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 0126d40d86fca2..251d77d79d0800 100644
--- a/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
+++ b/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
@@ -101,9 +101,9 @@ def run_test_evaluate_expressions(
         if context == "repl":
             # In the repl context expressions may be interpreted as lldb
             # commands since no variables have the same name as the command.
-            self.assertEvaluate("var", r"\(lldb\) var\n.*")
+            self.assertEvaluate("list", r"\(lldb\) list\n.*")
         else:
-            self.assertEvaluateFailure("var")  # local variable of a_function
+            self.assertEvaluateFailure("list")  # local variable of a_function
 
         self.assertEvaluateFailure("my_struct")  # type name
         self.assertEvaluateFailure("int")  # type name
@@ -162,7 +162,7 @@ def run_test_evaluate_expressions(
 
         # Expressions at breakpoint 3, which is inside a_function
         self.continue_to_next_stop()
-        self.assertEvaluate("var", "42")
+        self.assertEvaluate("list", "42")
         self.assertEvaluate("static_int", "42")
         self.assertEvaluate("non_static_int", "43")
 
@@ -176,13 +176,13 @@ def run_test_evaluate_expressions(
         if self.isExpressionParsedExpected():
             self.assertEvaluate("a_function", "0x.*a.out`a_function.*")
             self.assertEvaluate("a_function(1)", "1")
-            self.assertEvaluate("var + 1", "43")
+            self.assertEvaluate("list + 1", "43")
             self.assertEvaluate("foo_func", "0x.*a.out`foo_func.*")
             self.assertEvaluate("foo_var", "44")
         else:
             self.assertEvaluateFailure("a_function")
             self.assertEvaluateFailure("a_function(1)")
-            self.assertEvaluateFailure("var + 1")
+            self.assertEvaluateFailure("list + 1")
             self.assertEvaluateFailure("foo_func")
             self.assertEvaluateFailure("foo_var")
 
diff --git a/lldb/test/API/tools/lldb-dap/evaluate/main.cpp b/lldb/test/API/tools/lldb-dap/evaluate/main.cpp
index 1c68716e3a6e11..1c3d258114b1ff 100644
--- a/lldb/test/API/tools/lldb-dap/evaluate/main.cpp
+++ b/lldb/test/API/tools/lldb-dap/evaluate/main.cpp
@@ -8,8 +8,8 @@ static int static_int = 42;
 
 int non_static_int = 43;
 
-int a_function(int var) {
-  return var; // breakpoint 3
+int a_function(int list) {
+  return list; // breakpoint 3
 }
 
 struct my_struct {

Copy link
Member

@Michael137 Michael137 left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix. I'll let @walter-erquinigo give the final approval here as the original author of this test.

Copy link
Member

@walter-erquinigo walter-erquinigo left a comment

Choose a reason for hiding this comment

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

thanks!

@ashgti ashgti merged commit c658d07 into llvm:main Nov 13, 2024
12 checks passed
@ashgti ashgti deleted the fix-flaky-lldb-dap-evaluate branch November 13, 2024 19:17
adrian-prantl pushed a commit to adrian-prantl/llvm-project that referenced this pull request Dec 20, 2024
…lvm#116045)

Previously this used `var` as both an lldb command and variable in the
source to validate the behavior of the 'auto' repl mode. However, `var`
seems to occasionally fail in the CI test when attempting to print some
c++ types. Instead switch the command and variable name to `list` which
should not run the dynamic variable formatting code for c++ objects.

This should fix llvm#116041.

(cherry picked from commit c658d07)
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.

[lldb-dap] TestDAP_evaluate.py test is flakey
4 participants