[NFC][lldb] Fix unresolved test in buildbot lldb-aarch64-windows (#137516)

object indexing causes key error.

Initial commit #290ba2
This commit is contained in:
Ebuka Ezike 2025-04-27 15:32:43 +01:00 committed by GitHub
parent 4149ec9970
commit ee4b34cf32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -67,45 +67,55 @@ class TestDAP_stackTraceMissingSourcePath(lldbdap_testcase.DAPTestCaseBase):
def verify_frames_source( def verify_frames_source(
self, frames, main_frame_assembly: bool, other_frame_assembly: bool self, frames, main_frame_assembly: bool, other_frame_assembly: bool
): ):
self.assertLessEqual(2, len(frames), "expect at least 2 frames")
source_0 = frames[0].get("source")
source_1 = frames[1].get("source")
self.assertIsNotNone(source_0, "Expects a source object in frame 0")
self.assertIsNotNone(source_1, "Expects a source object in frame 1")
# it does not always have a path.
source_0_path: str = source_0.get("path", "")
source_1_path: str = source_1.get("path", "")
if other_frame_assembly: if other_frame_assembly:
self.assertFalse( self.assertFalse(
frames[0]["source"]["path"].endswith("other.c"), source_0_path.endswith("other.c"),
"Expect original source path to not be in unavailable source frame (other.c)", "Expect original source path to not be in unavailable source frame (other.c)",
) )
self.assertIn( self.assertIn(
"sourceReference", "sourceReference",
frames[0]["source"], source_0,
"Expect sourceReference to be in unavailable source frame (other.c)", "Expect sourceReference to be in unavailable source frame (other.c)",
) )
else: else:
self.assertTrue( self.assertTrue(
frames[0]["source"]["path"].endswith("other.c"), source_0_path.endswith("other.c"),
"Expect original source path to be in normal source frame (other.c)", "Expect original source path to be in normal source frame (other.c)",
) )
self.assertNotIn( self.assertNotIn(
"sourceReference", "sourceReference",
frames[0]["source"], source_0,
"Expect sourceReference to not be in normal source frame (other.c)", "Expect sourceReference to not be in normal source frame (other.c)",
) )
if main_frame_assembly: if main_frame_assembly:
self.assertFalse( self.assertFalse(
frames[1]["source"]["path"].endswith("main.c"), source_1_path.endswith("main.c"),
"Expect original source path to not be in unavailable source frame (main.c)", "Expect original source path to not be in unavailable source frame (main.c)",
) )
self.assertIn( self.assertIn(
"sourceReference", "sourceReference",
frames[1]["source"], source_1,
"Expect sourceReference to be in unavailable source frame (main.c)", "Expect sourceReference to be in unavailable source frame (main.c)",
) )
else: else:
self.assertTrue( self.assertTrue(
frames[1]["source"]["path"].endswith("main.c"), source_1_path.endswith("main.c"),
"Expect original source path to be in normal source frame (main.c)", "Expect original source path to be in normal source frame (main.c)",
) )
self.assertNotIn( self.assertNotIn(
"sourceReference", "sourceReference",
frames[1]["source"], source_1,
"Expect sourceReference to not be in normal source code frame (main.c)", "Expect sourceReference to not be in normal source code frame (main.c)",
) )