Skip to content

Commit 02f06f9

Browse files
author
kendal
committed
Fix test assertions in TestDAP_stepInTargets.py
1 parent 96c18a2 commit 02f06f9

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

lldb/test/API/tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py

+17-7
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,24 @@ def test_basic(self):
5555
self.assertEqual(len(step_in_targets), 3, "expect 3 step in targets")
5656

5757
# Verify the target names are correct.
58-
self.assertEqual(step_in_targets[0]["label"], "bar()", "expect bar()")
59-
self.assertEqual(step_in_targets[1]["label"], "bar2()", "expect bar2()")
60-
self.assertEqual(
61-
step_in_targets[2]["label"], "foo(int, int)", "expect foo(int, int)"
62-
)
58+
# The order of funcA and funcB may change depending on the compiler ABI.
59+
funcA_target = None
60+
funcB_target = None
61+
for target in step_in_targets[0:2]:
62+
if "funcB" in target["label"]:
63+
funcB_target = target
64+
elif "funcA" in target["label"]:
65+
funcA_target = target
66+
else:
67+
self.fail(f"Unexpected step in target: {target}")
68+
69+
self.assertIsNotNone(funcA_target, "expect funcA")
70+
self.assertIsNotNone(funcB_target, "expect funcB")
71+
self.assertIn("foo", step_in_targets[2]["label"], "expect foo")
6372

64-
# Choose to step into second target and verify that we are in bar2()
73+
# Choose to step into second target and verify that we are in the second target,
74+
# be it funcA or funcB.
6575
self.stepIn(threadId=tid, targetId=step_in_targets[1]["id"], waitForStop=True)
6676
leaf_frame = self.dap_server.get_stackFrame()
6777
self.assertIsNotNone(leaf_frame, "expect a leaf frame")
68-
self.assertEqual(leaf_frame["name"], "bar2()")
78+
self.assertEqual(step_in_targets[1]["label"], leaf_frame["name"])
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
int foo(int val, int extra) { return val + extra; }
33

4-
int bar() { return 22; }
4+
int funcA() { return 22; }
55

6-
int bar2() { return 54; }
6+
int funcB() { return 54; }
77

88
int main(int argc, char const *argv[]) {
9-
foo(bar(), bar2()); // set breakpoint here
9+
foo(funcA(), funcB()); // set breakpoint here
1010
return 0;
1111
}

0 commit comments

Comments
 (0)