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

Johnny Chen johnny.chen at apple.com
Tue Jun 28 13:57:22 PDT 2011


Author: johnny
Date: Tue Jun 28 15:57:22 2011
New Revision: 134029

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

Added:
    lldb/trunk/test/python_api/default-constructor/sb_listener.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=134029&r1=134028&r2=134029&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Tue Jun 28 15:57:22 2011
@@ -201,6 +201,9 @@
         if self.TraceOn():
             print obj
         self.assertFalse(obj)
+        # Do fuzz testing on the invalid obj, it should not crash lldb.
+        import sb_listener
+        sb_listener.fuzz_obj(obj)
 
     @python_api_test
     def test_SBModule(self):

Added: lldb/trunk/test/python_api/default-constructor/sb_listener.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_listener.py?rev=134029&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_listener.py (added)
+++ lldb/trunk/test/python_api/default-constructor/sb_listener.py Tue Jun 28 15:57:22 2011
@@ -0,0 +1,23 @@
+"""
+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.AddEvent(lldb.SBEvent())
+    obj.StartListeningForEvents(lldb.SBBroadcaster(), 0xffffffff)
+    obj.StopListeningForEvents(lldb.SBBroadcaster(), 0xffffffff)
+    event = lldb.SBEvent()
+    broadcaster = lldb.SBBroadcaster()
+    obj.WaitForEvent(5, event)
+    obj.WaitForEventForBroadcaster(5, broadcaster, event)
+    obj.WaitForEventForBroadcasterWithType(5, broadcaster, 0xffffffff, event)
+    obj.PeekAtNextEvent(event)
+    obj.PeekAtNextEventForBroadcaster(broadcaster, event)
+    obj.PeekAtNextEventForBroadcasterWithType(broadcaster, 0xffffffff, event)
+    obj.GetNextEvent(event)
+    obj.GetNextEventForBroadcaster(broadcaster, event)
+    obj.GetNextEventForBroadcasterWithType(broadcaster, 0xffffffff, event)
+    obj.HandleBroadcastEvent(event)





More information about the lldb-commits mailing list