[Lldb-commits] [lldb] Fix test assertions in TestDAP_stepInTargets.py (PR #96687)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Mon Jul 8 02:57:25 PDT 2024
================
@@ -55,14 +55,23 @@ 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()
- self.stepIn(threadId=tid, targetId=step_in_targets[1]["id"], waitForStop=True)
+ # Choose to step into second target and verify that we are in funcB()
----------------
labath wrote:
funcB is not necessarily going to be the second target, so this comment is incorrect. However, instead of changing the comment, I think it'd be actually better to change the code so that it steps into the second function, regardless of what that function might be. This is because we would end up in the first function even if we did a "normal" step in operation rather than the fancy targetted one. Stepping into the second function verifies that we can correctly ignore the first function that gets called. (I wasn't the person who wrote the test, but I suspect this is roughly the motivation for it being written the way it is).
So basically, you could keep the `targetId=step_in_targets[1]["id"]` thing in the line below, but then change the expectation on line 77 to expect the function that we tried stepping into.
https://github.com/llvm/llvm-project/pull/96687
More information about the lldb-commits
mailing list