Add fuzz calls for SBDebugger.

llvm-svn: 133848
This commit is contained in:
Johnny Chen 2011-06-25 00:09:29 +00:00
parent b2681bef4f
commit 3c7a726a6d
2 changed files with 54 additions and 0 deletions

View File

@ -101,6 +101,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_debugger
sb_debugger.fuzz_obj(obj)
@python_api_test
def test_SBError(self):

View File

@ -0,0 +1,51 @@
"""
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.SetAsync(True)
obj.SetAsync(False)
obj.SkipLLDBInitFiles(True)
obj.SetInputFileHandle(None, True)
obj.SetOutputFileHandle(None, True)
obj.SetErrorFileHandle(None, True)
obj.GetInputFileHandle()
obj.GetOutputFileHandle()
obj.GetErrorFileHandle()
obj.GetCommandInterpreter()
obj.HandleCommand("nothing here")
listener = obj.GetListener()
obj.HandleProcessEvent(lldb.SBProcess(), lldb.SBEvent(), None, None)
obj.CreateTargetWithFileAndTargetTriple("a.out", "A-B-C")
obj.CreateTargetWithFileAndArch("b.out", "arm")
obj.CreateTarget("c.out")
obj.DeleteTarget(lldb.SBTarget())
obj.GetTargetAtIndex(0xffffffff)
obj.FindTargetWithProcessID(0)
obj.FindTargetWithFileAndArch("a.out", "arm")
obj.GetNumTargets()
obj.GetSelectedTarget()
obj.GetSourceManager()
obj.SetCurrentPlatformSDKRoot("tmp/sdk-root")
obj.DispatchInput(None, None, 0)
obj.DispatchInputInterrupt()
obj.DispatchInputEndOfFile()
obj.PushInputReader(lldb.SBInputReader())
obj.NotifyTopInputReader(lldb.eInputReaderActivate)
obj.InputReaderIsTopReader(lldb.SBInputReader())
obj.GetInstanceName()
obj.GetDescription(lldb.SBStream())
obj.GetTerminalWidth()
obj.SetTerminalWidth(0xffffffff)
obj.GetID()
obj.GetPrompt()
obj.SetPrompt("Hi, Mom!")
obj.GetScriptLanguage()
obj.SetScriptLanguage(lldb.eScriptLanguageNone)
obj.SetScriptLanguage(lldb.eScriptLanguagePython)
obj.GetCloseInputOnEOF()
obj.SetCloseInputOnEOF(True)
obj.SetCloseInputOnEOF(False)