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

Johnny Chen johnny.chen at apple.com
Fri Jun 24 15:53:12 PDT 2011


Author: johnny
Date: Fri Jun 24 17:53:12 2011
New Revision: 133837

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

Added:
    lldb/trunk/test/python_api/default-constructor/sb_broadcaster.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=133837&r1=133836&r2=133837&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Fri Jun 24 17:53:12 2011
@@ -63,6 +63,9 @@
         if self.TraceOn():
             print obj
         self.assertFalse(obj)
+        # Do fuzz testing on the invalid obj, it should not crash lldb.
+        import sb_broadcaster
+        sb_broadcaster.fuzz_obj(obj)
 
     @python_api_test
     def test_SBCommandReturnObject(self):

Added: lldb/trunk/test/python_api/default-constructor/sb_broadcaster.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_broadcaster.py?rev=133837&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_broadcaster.py (added)
+++ lldb/trunk/test/python_api/default-constructor/sb_broadcaster.py Fri Jun 24 17:53:12 2011
@@ -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.BroadcastEventByType(lldb.eBreakpointEventTypeInvalidType, True)
+    obj.BroadcastEvent(lldb.SBEvent(), False)
+    listener = lldb.SBListener("fuzz_testing")
+    obj.AddInitialEventsToListener(listener, 0xffffffff)
+    obj.AddInitialEventsToListener(listener, 0)
+    obj.AddListener(listener, 0xffffffff)
+    obj.AddListener(listener, 0)
+    obj.GetName()
+    obj.EventTypeHasListeners(0)
+    obj.RemoveListener(listener, 0xffffffff)
+    obj.RemoveListener(listener, 0)





More information about the lldb-commits mailing list