Add fuzz calls for SBError.

llvm-svn: 133850
This commit is contained in:
Johnny Chen 2011-06-25 00:21:00 +00:00
parent f4105f5cfe
commit 06657625b8
2 changed files with 22 additions and 0 deletions

View File

@ -111,6 +111,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_error
sb_error.fuzz_obj(obj)
@python_api_test
def test_SBEvent(self):

View File

@ -0,0 +1,19 @@
"""
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.GetCString()
obj.Fail()
obj.Success()
obj.GetError()
obj.GetType()
obj.SetError(5, lldb.eErrorTypeGeneric)
obj.SetErrorToErrno()
obj.SetErrorToGenericError()
obj.SetErrorString("xyz")
obj.SetErrorStringWithFormat("%s!", "error")
obj.GetDescription(lldb.SBStream())