[Lldb-commits] [lldb] r133809 - in /lldb/trunk/test/python_api/default-constructor: TestDefaultConstructorForAPIObjects.py sb_breakpoint.py

Johnny Chen johnny.chen at apple.com
Fri Jun 24 11:49:27 PDT 2011


Author: johnny
Date: Fri Jun 24 13:49:27 2011
New Revision: 133809

URL: http://llvm.org/viewvc/llvm-project?rev=133809&view=rev
Log:
Add fuzz calls for SBBreakpoint.

Added:
    lldb/trunk/test/python_api/default-constructor/sb_breakpoint.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=133809&r1=133808&r2=133809&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Fri Jun 24 13:49:27 2011
@@ -2,8 +2,9 @@
 Test lldb Python API object's default constructor and make sure it is invalid
 after initial construction.
 
-There are three exceptions to the above general rules, though; the API objects are
-SBCommadnReturnObject, SBStream, and SBSymbolContextList.
+There are three exceptions to the above general rules, though; API objects
+SBCommadnReturnObject, SBStream, and SBSymbolContextList, are all valid objects
+after default construction.
 """
 
 import os, time
@@ -42,6 +43,9 @@
         if self.TraceOn():
             print obj
         self.assertFalse(obj)
+        # Do fuzz testing on the invalid obj, it should not crash lldb.
+        import sb_breakpoint
+        sb_breakpoint.fuzz_obj(obj)
 
     @python_api_test
     def test_SBBreakpointLocation(self):

Added: lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py?rev=133809&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py (added)
+++ lldb/trunk/test/python_api/default-constructor/sb_breakpoint.py Fri Jun 24 13:49:27 2011
@@ -0,0 +1,33 @@
+"""
+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.GetID()
+    obj.ClearAllBreakpointSites()
+    obj.FindLocationByAddress(sys.maxint)
+    obj.FindLocationIDByAddress(sys.maxint)
+    obj.FindLocationByID(0)
+    obj.GetLocationAtIndex(0)
+    obj.SetEnabled(True)
+    obj.IsEnabled()
+    obj.GetHitCount()
+    obj.SetIgnoreCount(1)
+    obj.GetIgnoreCount()
+    obj.SetCondition("i >= 10")
+    obj.GetCondition()
+    obj.SetThreadID(0)
+    obj.GetThreadID()
+    obj.SetThreadIndex(0)
+    obj.GetThreadIndex()
+    obj.SetThreadName("worker thread")
+    obj.GetThreadName()
+    obj.SetQueueName("my queue")
+    obj.GetQueueName()
+    obj.SetCallback(None, None)
+    obj.GetNumResolvedLocations()
+    obj.GetNumLocations()
+    obj.GetDescription(lldb.SBStream())





More information about the lldb-commits mailing list