From 484e2be44c2f0f287327c540c7b0b398812d7a00 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 19 Aug 2025 12:49:23 -0500 Subject: [PATCH] [lldb] Support error variations in TestProcessCrashInfo.py (#154202) The error message emitted by libmalloc changed in macOS 26. Update the test to support both. (cherry picked from commit 4cecbeed4f4558df9cd221afaaa38e2281d133a2) --- .../TestProcessCrashInfo.py | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/lldb/test/API/functionalities/process_crash_info/TestProcessCrashInfo.py b/lldb/test/API/functionalities/process_crash_info/TestProcessCrashInfo.py index af05c2f3a0f62..c143da2bf94fb 100644 --- a/lldb/test/API/functionalities/process_crash_info/TestProcessCrashInfo.py +++ b/lldb/test/API/functionalities/process_crash_info/TestProcessCrashInfo.py @@ -22,6 +22,15 @@ def tearDown(self): 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 @@ def test_cli(self): 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 @@ def test_api(self): 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