[lldb] Support error variations in TestProcessCrashInfo.py (#154202)

The error message emitted by libmalloc changed in macOS 26. Update the
test to support both.
This commit is contained in:
Jonas Devlieghere 2025-08-19 12:49:23 -05:00 committed by GitHub
parent fdcc1b3588
commit 4cecbeed4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,6 +22,15 @@ class PlatformProcessCrashInfoTestCase(TestBase):
self.runCmd("settings clear auto-confirm")
TestBase.tearDown(self)
def containsLibmallocError(self, output):
for error in [
"pointer being freed was not allocated",
"not an allocated block",
]:
if error in output:
return True
return False
@skipIfAsan # The test process intentionally double-frees.
@skipUnlessDarwin
def test_cli(self):
@ -33,15 +42,15 @@ class PlatformProcessCrashInfoTestCase(TestBase):
self.expect("process launch", patterns=["Process .* launched: .*a.out"])
self.expect(
"process status --verbose",
patterns=[
"Extended Crash Information",
"Crash-Info Annotations",
"pointer being freed was not allocated",
],
result = lldb.SBCommandReturnObject()
self.dbg.GetCommandInterpreter().HandleCommand(
"process status --verbose", result
)
self.assertIn("Extended Crash Information", result.GetOutput())
self.assertIn("Crash-Info Annotations", result.GetOutput())
self.assertTrue(self.containsLibmallocError(result.GetOutput()))
@skipIfAsan # The test process intentionally hits a memory bug.
@skipUnlessDarwin
def test_api(self):
@ -67,7 +76,7 @@ class PlatformProcessCrashInfoTestCase(TestBase):
self.assertTrue(crash_info.IsValid())
self.assertIn("pointer being freed was not allocated", stream.GetData())
self.assertTrue(self.containsLibmallocError(stream.GetData()))
# dyld leaves permanent crash_info records when testing on device.
@skipIfDarwinEmbedded