[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP variables test. (PR #208215)
https://github.com/da-viper closed https://github.com/llvm/llvm-project/pull/208215 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP variables test. (PR #208215)
https://github.com/da-viper updated
https://github.com/llvm/llvm-project/pull/208215
>From 4bd36eb9e42edfe4beaf54270c96f2d795502556 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike
Date: Wed, 8 Jul 2026 13:33:25 +0100
Subject: [PATCH 1/2] [lldb-dap] Migrate all DAP variables test.
migrate TestDAP_variables and TestDAP_variables_children
---
.../test/tools/lldb_dap/session_helpers.py|4 +-
.../lldb-dap/variables/TestDAP_variables.py | 1459 +++--
.../children/TestDAP_variables_children.py| 122 +-
3 files changed, 670 insertions(+), 915 deletions(-)
diff --git
a/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/session_helpers.py
b/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/session_helpers.py
index 34eb33f03c450..35a2d6c2f281a 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/session_helpers.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/session_helpers.py
@@ -1578,7 +1578,9 @@ def get_variables(
count=count,
format=format,
)
-response = self.send_request(args).result()
+response = self.send_request(args).result(
+f"failed to get variables for reference: {variablesReference}"
+)
return response.body.variables
def thread_context_from(self, thread_ref: int | StoppedEvent) ->
ThreadContext:
diff --git a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
index 66c8d7f720aef..3fb47323efffa 100644
--- a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
+++ b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
@@ -3,401 +3,277 @@
"""
import os
-
-import lldbdap_testcase
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-
-
-def make_buffer_verify_dict(start_idx, count, offset=0):
-verify_dict = {}
-for i in range(start_idx, start_idx + count):
-verify_dict["[%i]" % (i)] = {"type": "int", "value": str(i + offset)}
-return verify_dict
-
-
-class TestDAP_variables(lldbdap_testcase.DAPTestCaseBase):
+from typing import List, Optional
+
+from lldbsuite.test import lldbplatformutil
+from lldbsuite.test.decorators import (
+no_debug_info_test,
+skipIfAsan,
+skipIfWindows,
+skipUnlessDarwin,
+)
+from lldbsuite.test.lldbtest import line_number
+from lldbsuite.test.tools.lldb_dap.dap_types import (
+EvaluateContext,
+LaunchArgs,
+VariablesArgs,
+)
+from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase
+from lldbsuite.test.tools.lldb_dap.session_helpers import ExpectEval, ExpectVar
+
+
+def make_expected_buffer(start_idx, count, offset=0):
+return {
+f"[{i}]": ExpectVar(type="int", value=str(i + offset))
+for i in range(start_idx, start_idx + count)
+}
+
+
+class TestDAP_variables(DAPTestCaseBase):
SHARED_BUILD_TESTCASE = False
-def verify_values(self, verify_dict, actual, varref_dict=None,
expression=None):
-if "equals" in verify_dict:
-verify = verify_dict["equals"]
-for key in verify:
-verify_value = verify[key]
-actual_value = actual[key]
-self.assertEqual(
-verify_value,
-actual_value,
-'"%s" keys don\'t match (%s != %s) from:\n%s'
-% (key, actual_value, verify_value, actual),
-)
-if "startswith" in verify_dict:
-verify = verify_dict["startswith"]
-for key in verify:
-verify_value = verify[key]
-actual_value = actual[key]
-startswith = actual_value.startswith(verify_value)
-self.assertTrue(
-startswith,
-('"%s" value "%s" doesn\'t start with "%s")')
-% (key, actual_value, verify_value),
-)
-if "matches" in verify_dict:
-verify = verify_dict["matches"]
-for key in verify:
-verify_value = verify[key]
-actual_value = actual[key]
-self.assertRegex(
-actual_value,
-verify_value,
-('"%s" value "%s" doesn\'t match pattern "%s")')
-% (key, actual_value, verify_value),
-)
-if "contains" in verify_dict:
-verify = verify_dict["contains"]
-for key in verify:
-contains_array = verify[key]
-actual_value = actual[key]
-self.assertIsInstance(contains_array, list)
-for verify_value in contains_array:
-self.assertIn(verify_value, actual_value)
-if "missing" in verify_dict:
-missing = verify_dict["missing"]
-for key in missing:
-self.assertNotIn(
-key, actual, 'key "%
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP variables test. (PR #208215)
https://github.com/DrSergei approved this pull request. Overall, LGTM https://github.com/llvm/llvm-project/pull/208215 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP variables test. (PR #208215)
@@ -406,103 +282,82 @@ def test_scopes_variables_setVariable_evaluate(self): ) @skipIfWindows -def test_scopes_variables_setVariable_evaluate_with_descriptive_summaries(self): +def test_scopes_variables_setVariable_evaluate_with_descriptive_summaries( +self, +): self.do_test_scopes_variables_setVariable_evaluate( enableAutoVariableSummaries=True ) -@skipIfWindows DrSergei wrote: Is it safe to remove this decorator? https://github.com/llvm/llvm-project/pull/208215 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP variables test. (PR #208215)
https://github.com/DrSergei edited https://github.com/llvm/llvm-project/pull/208215 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP variables test. (PR #208215)
https://github.com/ashgti approved this pull request. I think the new helpers for validating variables are a huge improvement. I tried adjusting some of those in the past and the dict look up of some keys having special meanings was always hard to follow IMO. Thanks! https://github.com/llvm/llvm-project/pull/208215 ___ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP variables test. (PR #208215)
llvmorg-github-actions[bot] wrote:
@llvm/pr-subscribers-lldb
Author: Ebuka Ezike (da-viper)
Changes
migrate TestDAP_variables and TestDAP_variables_children.
---
Patch is 77.51 KiB, truncated to 20.00 KiB below, full version:
https://github.com/llvm/llvm-project/pull/208215.diff
3 Files Affected:
- (modified)
lldb/packages/Python/lldbsuite/test/tools/lldb_dap/session_helpers.py (+3-1)
- (modified) lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
(+613-846)
- (modified)
lldb/test/API/tools/lldb-dap/variables/children/TestDAP_variables_children.py
(+54-68)
``diff
diff --git
a/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/session_helpers.py
b/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/session_helpers.py
index 34eb33f03c450..35a2d6c2f281a 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/session_helpers.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/session_helpers.py
@@ -1578,7 +1578,9 @@ def get_variables(
count=count,
format=format,
)
-response = self.send_request(args).result()
+response = self.send_request(args).result(
+f"failed to get variables for reference: {variablesReference}"
+)
return response.body.variables
def thread_context_from(self, thread_ref: int | StoppedEvent) ->
ThreadContext:
diff --git a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
index 66c8d7f720aef..3fb47323efffa 100644
--- a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
+++ b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
@@ -3,401 +3,277 @@
"""
import os
-
-import lldbdap_testcase
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-
-
-def make_buffer_verify_dict(start_idx, count, offset=0):
-verify_dict = {}
-for i in range(start_idx, start_idx + count):
-verify_dict["[%i]" % (i)] = {"type": "int", "value": str(i + offset)}
-return verify_dict
-
-
-class TestDAP_variables(lldbdap_testcase.DAPTestCaseBase):
+from typing import List, Optional
+
+from lldbsuite.test import lldbplatformutil
+from lldbsuite.test.decorators import (
+no_debug_info_test,
+skipIfAsan,
+skipIfWindows,
+skipUnlessDarwin,
+)
+from lldbsuite.test.lldbtest import line_number
+from lldbsuite.test.tools.lldb_dap.dap_types import (
+EvaluateContext,
+LaunchArgs,
+VariablesArgs,
+)
+from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase
+from lldbsuite.test.tools.lldb_dap.session_helpers import ExpectEval, ExpectVar
+
+
+def make_expected_buffer(start_idx, count, offset=0):
+return {
+f"[{i}]": ExpectVar(type="int", value=str(i + offset))
+for i in range(start_idx, start_idx + count)
+}
+
+
+class TestDAP_variables(DAPTestCaseBase):
SHARED_BUILD_TESTCASE = False
-def verify_values(self, verify_dict, actual, varref_dict=None,
expression=None):
-if "equals" in verify_dict:
-verify = verify_dict["equals"]
-for key in verify:
-verify_value = verify[key]
-actual_value = actual[key]
-self.assertEqual(
-verify_value,
-actual_value,
-'"%s" keys don\'t match (%s != %s) from:\n%s'
-% (key, actual_value, verify_value, actual),
-)
-if "startswith" in verify_dict:
-verify = verify_dict["startswith"]
-for key in verify:
-verify_value = verify[key]
-actual_value = actual[key]
-startswith = actual_value.startswith(verify_value)
-self.assertTrue(
-startswith,
-('"%s" value "%s" doesn\'t start with "%s")')
-% (key, actual_value, verify_value),
-)
-if "matches" in verify_dict:
-verify = verify_dict["matches"]
-for key in verify:
-verify_value = verify[key]
-actual_value = actual[key]
-self.assertRegex(
-actual_value,
-verify_value,
-('"%s" value "%s" doesn\'t match pattern "%s")')
-% (key, actual_value, verify_value),
-)
-if "contains" in verify_dict:
-verify = verify_dict["contains"]
-for key in verify:
-contains_array = verify[key]
-actual_value = actual[key]
-self.assertIsInstance(contains_array, list)
-for verify_value in contains_array:
-self.assertIn(verify_value, actual_value)
-if "missing" in verify_dict:
-missing = verify_dict["missing"]
-for key in missing:
-self.assertNotIn(
-
[Lldb-commits] [lldb] [lldb-dap] Migrate all DAP variables test. (PR #208215)
https://github.com/da-viper created
https://github.com/llvm/llvm-project/pull/208215
migrate TestDAP_variables and TestDAP_variables_children.
>From 4bd36eb9e42edfe4beaf54270c96f2d795502556 Mon Sep 17 00:00:00 2001
From: Ebuka Ezike
Date: Wed, 8 Jul 2026 13:33:25 +0100
Subject: [PATCH] [lldb-dap] Migrate all DAP variables test.
migrate TestDAP_variables and TestDAP_variables_children
---
.../test/tools/lldb_dap/session_helpers.py|4 +-
.../lldb-dap/variables/TestDAP_variables.py | 1459 +++--
.../children/TestDAP_variables_children.py| 122 +-
3 files changed, 670 insertions(+), 915 deletions(-)
diff --git
a/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/session_helpers.py
b/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/session_helpers.py
index 34eb33f03c450..35a2d6c2f281a 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/session_helpers.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb_dap/session_helpers.py
@@ -1578,7 +1578,9 @@ def get_variables(
count=count,
format=format,
)
-response = self.send_request(args).result()
+response = self.send_request(args).result(
+f"failed to get variables for reference: {variablesReference}"
+)
return response.body.variables
def thread_context_from(self, thread_ref: int | StoppedEvent) ->
ThreadContext:
diff --git a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
index 66c8d7f720aef..3fb47323efffa 100644
--- a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
+++ b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
@@ -3,401 +3,277 @@
"""
import os
-
-import lldbdap_testcase
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-
-
-def make_buffer_verify_dict(start_idx, count, offset=0):
-verify_dict = {}
-for i in range(start_idx, start_idx + count):
-verify_dict["[%i]" % (i)] = {"type": "int", "value": str(i + offset)}
-return verify_dict
-
-
-class TestDAP_variables(lldbdap_testcase.DAPTestCaseBase):
+from typing import List, Optional
+
+from lldbsuite.test import lldbplatformutil
+from lldbsuite.test.decorators import (
+no_debug_info_test,
+skipIfAsan,
+skipIfWindows,
+skipUnlessDarwin,
+)
+from lldbsuite.test.lldbtest import line_number
+from lldbsuite.test.tools.lldb_dap.dap_types import (
+EvaluateContext,
+LaunchArgs,
+VariablesArgs,
+)
+from lldbsuite.test.tools.lldb_dap.lldb_dap_testcase import DAPTestCaseBase
+from lldbsuite.test.tools.lldb_dap.session_helpers import ExpectEval, ExpectVar
+
+
+def make_expected_buffer(start_idx, count, offset=0):
+return {
+f"[{i}]": ExpectVar(type="int", value=str(i + offset))
+for i in range(start_idx, start_idx + count)
+}
+
+
+class TestDAP_variables(DAPTestCaseBase):
SHARED_BUILD_TESTCASE = False
-def verify_values(self, verify_dict, actual, varref_dict=None,
expression=None):
-if "equals" in verify_dict:
-verify = verify_dict["equals"]
-for key in verify:
-verify_value = verify[key]
-actual_value = actual[key]
-self.assertEqual(
-verify_value,
-actual_value,
-'"%s" keys don\'t match (%s != %s) from:\n%s'
-% (key, actual_value, verify_value, actual),
-)
-if "startswith" in verify_dict:
-verify = verify_dict["startswith"]
-for key in verify:
-verify_value = verify[key]
-actual_value = actual[key]
-startswith = actual_value.startswith(verify_value)
-self.assertTrue(
-startswith,
-('"%s" value "%s" doesn\'t start with "%s")')
-% (key, actual_value, verify_value),
-)
-if "matches" in verify_dict:
-verify = verify_dict["matches"]
-for key in verify:
-verify_value = verify[key]
-actual_value = actual[key]
-self.assertRegex(
-actual_value,
-verify_value,
-('"%s" value "%s" doesn\'t match pattern "%s")')
-% (key, actual_value, verify_value),
-)
-if "contains" in verify_dict:
-verify = verify_dict["contains"]
-for key in verify:
-contains_array = verify[key]
-actual_value = actual[key]
-self.assertIsInstance(contains_array, list)
-for verify_value in contains_array:
-self.assertIn(verify_value, actual_value)
-if "missing" in verify_dict:
-missing = verify_dict["missing"]
-for key in missing:
-self
