@@ -22,6 +22,15 @@ def tearDown(self):
22
22
self .runCmd ("settings clear auto-confirm" )
23
23
TestBase .tearDown (self )
24
24
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
+
25
34
@skipIfAsan # The test process intentionally double-frees.
26
35
@skipUnlessDarwin
27
36
def test_cli (self ):
@@ -33,15 +42,15 @@ def test_cli(self):
33
42
34
43
self .expect ("process launch" , patterns = ["Process .* launched: .*a.out" ])
35
44
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
43
48
)
44
49
50
+ self .assertIn ("Extended Crash Information" , result .GetOutput ())
51
+ self .assertIn ("Crash-Info Annotations" , result .GetOutput ())
52
+ self .assertTrue (self .containsLibmallocError (result .GetOutput ()))
53
+
45
54
@skipIfAsan # The test process intentionally hits a memory bug.
46
55
@skipUnlessDarwin
47
56
def test_api (self ):
@@ -67,7 +76,7 @@ def test_api(self):
67
76
68
77
self .assertTrue (crash_info .IsValid ())
69
78
70
- self .assertIn ( "pointer being freed was not allocated" , stream .GetData ())
79
+ self .assertTrue ( self . containsLibmallocError ( stream .GetData () ))
71
80
72
81
# dyld leaves permanent crash_info records when testing on device.
73
82
@skipIfDarwinEmbedded
0 commit comments