Skip to content

Commit 4cecbee

Browse files
authored
[lldb] Support error variations in TestProcessCrashInfo.py (#154202)
The error message emitted by libmalloc changed in macOS 26. Update the test to support both.
1 parent fdcc1b3 commit 4cecbee

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

lldb/test/API/functionalities/process_crash_info/TestProcessCrashInfo.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ def tearDown(self):
2222
self.runCmd("settings clear auto-confirm")
2323
TestBase.tearDown(self)
2424

25+
def containsLibmallocError(self, output):
26+
for error in [
27+
"pointer being freed was not allocated",
28+
"not an allocated block",
29+
]:
30+
if error in output:
31+
return True
32+
return False
33+
2534
@skipIfAsan # The test process intentionally double-frees.
2635
@skipUnlessDarwin
2736
def test_cli(self):
@@ -33,15 +42,15 @@ def test_cli(self):
3342

3443
self.expect("process launch", patterns=["Process .* launched: .*a.out"])
3544

36-
self.expect(
37-
"process status --verbose",
38-
patterns=[
39-
"Extended Crash Information",
40-
"Crash-Info Annotations",
41-
"pointer being freed was not allocated",
42-
],
45+
result = lldb.SBCommandReturnObject()
46+
self.dbg.GetCommandInterpreter().HandleCommand(
47+
"process status --verbose", result
4348
)
4449

50+
self.assertIn("Extended Crash Information", result.GetOutput())
51+
self.assertIn("Crash-Info Annotations", result.GetOutput())
52+
self.assertTrue(self.containsLibmallocError(result.GetOutput()))
53+
4554
@skipIfAsan # The test process intentionally hits a memory bug.
4655
@skipUnlessDarwin
4756
def test_api(self):
@@ -67,7 +76,7 @@ def test_api(self):
6776

6877
self.assertTrue(crash_info.IsValid())
6978

70-
self.assertIn("pointer being freed was not allocated", stream.GetData())
79+
self.assertTrue(self.containsLibmallocError(stream.GetData()))
7180

7281
# dyld leaves permanent crash_info records when testing on device.
7382
@skipIfDarwinEmbedded

0 commit comments

Comments
 (0)