[Lldb-commits] [lldb] Fix test assertions in TestDAP_stepInTargets.py (PR #96687)
Kendal Harland via lldb-commits
lldb-commits at lists.llvm.org
Mon Jul 15 10:35:03 PDT 2024
https://github.com/kendalharland updated https://github.com/llvm/llvm-project/pull/96687
>From 02f06f90a40cc7ed18a9744918acf4daf6212486 Mon Sep 17 00:00:00 2001
From: kendal <kendal at thebrowser.company>
Date: Mon, 24 Jun 2024 14:01:31 -0700
Subject: [PATCH 1/2] Fix test assertions in TestDAP_stepInTargets.py
---
.../stepInTargets/TestDAP_stepInTargets.py | 24 +++++++++++++------
.../API/tools/lldb-dap/stepInTargets/main.cpp | 6 ++---
2 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
index 6296f6554d07e..6670989a58fe8 100644
--- a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
+++ b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
@@ -55,14 +55,24 @@ def test_basic(self):
self.assertEqual(len(step_in_targets), 3, "expect 3 step in targets")
# Verify the target names are correct.
- self.assertEqual(step_in_targets[0]["label"], "bar()", "expect bar()")
- self.assertEqual(step_in_targets[1]["label"], "bar2()", "expect bar2()")
- self.assertEqual(
- step_in_targets[2]["label"], "foo(int, int)", "expect foo(int, int)"
- )
+ # The order of funcA and funcB may change depending on the compiler ABI.
+ funcA_target = None
+ funcB_target = None
+ for target in step_in_targets[0:2]:
+ if "funcB" in target["label"]:
+ funcB_target = target
+ elif "funcA" in target["label"]:
+ funcA_target = target
+ else:
+ self.fail(f"Unexpected step in target: {target}")
+
+ self.assertIsNotNone(funcA_target, "expect funcA")
+ self.assertIsNotNone(funcB_target, "expect funcB")
+ self.assertIn("foo", step_in_targets[2]["label"], "expect foo")
- # Choose to step into second target and verify that we are in bar2()
+ # Choose to step into second target and verify that we are in the second target,
+ # be it funcA or funcB.
self.stepIn(threadId=tid, targetId=step_in_targets[1]["id"], waitForStop=True)
leaf_frame = self.dap_server.get_stackFrame()
self.assertIsNotNone(leaf_frame, "expect a leaf frame")
- self.assertEqual(leaf_frame["name"], "bar2()")
+ self.assertEqual(step_in_targets[1]["label"], leaf_frame["name"])
diff --git a/lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp b/lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp
index d3c3dbcc139ef..a48b79af0c760 100644
--- a/lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp
+++ b/lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp
@@ -1,11 +1,11 @@
int foo(int val, int extra) { return val + extra; }
-int bar() { return 22; }
+int funcA() { return 22; }
-int bar2() { return 54; }
+int funcB() { return 54; }
int main(int argc, char const *argv[]) {
- foo(bar(), bar2()); // set breakpoint here
+ foo(funcA(), funcB()); // set breakpoint here
return 0;
}
>From 8735430b3f99ba78791fca6c44891cb51cdb90f9 Mon Sep 17 00:00:00 2001
From: kendal <kendal at thebrowser.company>
Date: Thu, 11 Jul 2024 11:52:03 -0700
Subject: [PATCH 2/2] Disable this test on all platforms with issue ID
---
.../tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
index 6670989a58fe8..07acfe07c9ffc 100644
--- a/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
+++ b/lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py
@@ -10,9 +10,11 @@
class TestDAP_stepInTargets(lldbdap_testcase.DAPTestCaseBase):
- @skipIf(
- archs=no_match(["x86_64"])
- ) # InstructionControlFlowKind for ARM is not supported yet.
+ @expectedFailureAll(oslist=["windows"])
+ @skipIf(archs=no_match(["x86_64"]))
+ # InstructionControlFlowKind for ARM is not supported yet.
+ # On Windows, lldb-dap seems to ignore targetId when stepping into functions.
+ # For more context, see https://github.com/llvm/llvm-project/issues/98509.
def test_basic(self):
"""
Tests the basic stepping in targets with directly calls.
More information about the lldb-commits
mailing list