Skip to content

Commit 6e3dfa6

Browse files
author
Johnny Chen
committed
Add fuzz calls for SBCommunication.
llvm-svn: 133839
1 parent 99adfec commit 6e3dfa6

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ def test_SBCommunication(self):
8181
if self.TraceOn():
8282
print obj
8383
self.assertFalse(obj)
84+
# Do fuzz testing on the invalid obj, it should not crash lldb.
85+
import sb_communication
86+
sb_communication.fuzz_obj(obj)
8487

8588
@python_api_test
8689
def test_SBCompileUnit(self):
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""
2+
Fuzz tests an object after the default construction to make sure it does not crash lldb.
3+
"""
4+
5+
import sys
6+
import lldb
7+
8+
def fuzz_obj(obj):
9+
broadcaster = obj.GetBroadcaster()
10+
# Do fuzz testing on the broadcaster obj, it should not crash lldb.
11+
import sb_broadcaster
12+
sb_broadcaster.fuzz_obj(broadcaster)
13+
obj.AdoptFileDesriptor(0, False)
14+
obj.AdoptFileDesriptor(1, False)
15+
obj.AdoptFileDesriptor(2, False)
16+
obj.Connect("file:/tmp/myfile")
17+
obj.Disconnect()
18+
obj.IsConnected()
19+
obj.GetCloseOnEOF()
20+
obj.SetCloseOnEOF(True)
21+
obj.SetCloseOnEOF(False)
22+
#obj.Write(None, sys.maxint, None)
23+
#obj.Read(None, sys.maxint, 0xffffffff, None)
24+
obj.ReadThreadStart()
25+
obj.ReadThreadStop()
26+
obj.ReadThreadIsRunning()
27+
obj.SetReadThreadBytesReceivedCallback(None, None)

0 commit comments

Comments
 (0)