[Lldb-commits] [lldb] r133848 - in /lldb/trunk/test/python_api/default-constructor: TestDefaultConstructorForAPIObjects.py sb_debugger.py
Johnny Chen
johnny.chen at apple.com
Fri Jun 24 17:09:29 PDT 2011
Author: johnny
Date: Fri Jun 24 19:09:29 2011
New Revision: 133848
URL: http://llvm.org/viewvc/llvm-project?rev=133848&view=rev
Log:
Add fuzz calls for SBDebugger.
Added:
lldb/trunk/test/python_api/default-constructor/sb_debugger.py
Modified:
lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
Modified: lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py?rev=133848&r1=133847&r2=133848&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Fri Jun 24 19:09:29 2011
@@ -101,6 +101,9 @@
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):
Added: lldb/trunk/test/python_api/default-constructor/sb_debugger.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_debugger.py?rev=133848&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_debugger.py (added)
+++ lldb/trunk/test/python_api/default-constructor/sb_debugger.py Fri Jun 24 19:09:29 2011
@@ -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)
More information about the lldb-commits
mailing list