diff options
| author | Johnny Chen <johnny.chen@apple.com> | 2011-06-25 00:09:29 +0000 |
|---|---|---|
| committer | Johnny Chen <johnny.chen@apple.com> | 2011-06-25 00:09:29 +0000 |
| commit | 3c7a726a6da051597204b6397d62b48af1d11c26 (patch) | |
| tree | e14df14a77eaab9dd60da3e23201a734c7d1e06d /lldb/test/python_api/default-constructor | |
| parent | b2681bef4f89f39b0f747011873b9080399a3f44 (diff) | |
| download | bcm5719-llvm-3c7a726a6da051597204b6397d62b48af1d11c26.tar.gz bcm5719-llvm-3c7a726a6da051597204b6397d62b48af1d11c26.zip | |
Add fuzz calls for SBDebugger.
llvm-svn: 133848
Diffstat (limited to 'lldb/test/python_api/default-constructor')
| -rw-r--r-- | lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py | 3 | ||||
| -rw-r--r-- | lldb/test/python_api/default-constructor/sb_debugger.py | 51 |
2 files changed, 54 insertions, 0 deletions
diff --git a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py index b85e41e416d..196c5d59d75 100644 --- a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py +++ b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py @@ -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): diff --git a/lldb/test/python_api/default-constructor/sb_debugger.py b/lldb/test/python_api/default-constructor/sb_debugger.py new file mode 100644 index 00000000000..16060edc644 --- /dev/null +++ b/lldb/test/python_api/default-constructor/sb_debugger.py @@ -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) |

