Add fuzz calls for SBStringList and add obj.Clear() calls for some files.

llvm-svn: 134040
This commit is contained in:
Johnny Chen 2011-06-28 23:29:14 +00:00
parent 8ea21dc2af
commit dedd7d6ed6
10 changed files with 25 additions and 0 deletions

View File

@ -239,6 +239,9 @@ class APIDefaultConstructorTestCase(TestBase):
if self.TraceOn():
print obj
self.assertFalse(obj)
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_stringlist
sb_stringlist.fuzz_obj(obj)
@python_api_test
def test_SBSymbol(self):

View File

@ -10,3 +10,4 @@ def fuzz_obj(obj):
obj.GetLoadAddress(lldb.SBTarget())
obj.OffsetAddress(sys.maxint)
obj.GetDescription(lldb.SBStream())
obj.Clear()

View File

@ -17,3 +17,4 @@ def fuzz_obj(obj):
obj.EventTypeHasListeners(0)
obj.RemoveListener(listener, 0xffffffff)
obj.RemoveListener(listener, 0)
obj.Clear()

View File

@ -49,3 +49,4 @@ def fuzz_obj(obj):
obj.GetCloseInputOnEOF()
obj.SetCloseInputOnEOF(True)
obj.SetCloseInputOnEOF(False)
obj.Clear()

View File

@ -17,3 +17,4 @@ def fuzz_obj(obj):
obj.SetErrorString("xyz")
obj.SetErrorStringWithFormat("%s!", "error")
obj.GetDescription(lldb.SBStream())
obj.Clear()

View File

@ -15,3 +15,4 @@ def fuzz_obj(obj):
obj.BroadcasterMatchesPtr(None)
obj.BroadcasterMatchesRef(broadcaster)
obj.GetDescription(lldb.SBStream())
obj.Clear()

View File

@ -32,3 +32,4 @@ def fuzz_obj(obj):
obj.FindVariable("my_var")
obj.FindVariable("my_var", lldb.eDynamicCanRunTarget)
obj.GetDescription(lldb.SBStream())
obj.Clear()

View File

@ -12,3 +12,4 @@ def fuzz_obj(obj):
obj.Print(None)
obj.GetDescription(lldb.SBStream())
obj.DumpEmulationForAllInstructions("armv7")
obj.Clear()

View File

@ -40,3 +40,4 @@ def fuzz_obj(obj):
obj.GetDescription(lldb.SBStream())
obj.LoadImage(lldb.SBFileSpec(), error)
obj.UnloadImage(0)
obj.Clear()

View File

@ -0,0 +1,14 @@
"""
Fuzz tests an object after the default construction to make sure it does not crash lldb.
"""
import sys
import lldb
def fuzz_obj(obj):
obj.AppendString("another string")
obj.AppendList(None, 0)
obj.AppendList(lldb.SBStringList())
obj.GetSize()
obj.GetStringAtIndex(0xffffffff)
obj.Clear()