[Lldb-commits] [lldb] r134020 - in /lldb/trunk/test/python_api/default-constructor: TestDefaultConstructorForAPIObjects.py sb_instruction.py sb_instructionlist.py

Johnny Chen johnny.chen at apple.com
Tue Jun 28 12:07:02 PDT 2011


Author: johnny
Date: Tue Jun 28 14:07:02 2011
New Revision: 134020

URL: http://llvm.org/viewvc/llvm-project?rev=134020&view=rev
Log:
Add fuzz calls for SBInstruction and SBInstructionList.

Added:
    lldb/trunk/test/python_api/default-constructor/sb_instruction.py
    lldb/trunk/test/python_api/default-constructor/sb_instructionlist.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=134020&r1=134019&r2=134020&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Tue Jun 28 14:07:02 2011
@@ -171,6 +171,9 @@
         if self.TraceOn():
             print obj
         self.assertFalse(obj)
+        # Do fuzz testing on the invalid obj, it should not crash lldb.
+        import sb_instruction
+        sb_instruction.fuzz_obj(obj)
 
     @python_api_test
     def test_SBInstructionList(self):
@@ -178,6 +181,9 @@
         if self.TraceOn():
             print obj
         self.assertFalse(obj)
+        # Do fuzz testing on the invalid obj, it should not crash lldb.
+        import sb_instructionlist
+        sb_instructionlist.fuzz_obj(obj)
 
     @python_api_test
     def test_SBLineEntry(self):

Added: lldb/trunk/test/python_api/default-constructor/sb_instruction.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_instruction.py?rev=134020&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_instruction.py (added)
+++ lldb/trunk/test/python_api/default-constructor/sb_instruction.py Tue Jun 28 14:07:02 2011
@@ -0,0 +1,16 @@
+"""
+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.GetAddress()
+    obj.GetByteSize
+    obj.DoesBranch()
+    obj.Print(None)
+    obj.GetDescription(lldb.SBStream())
+    obj.EmulateWithFrame(lldb.SBFrame(), 0)
+    obj.DumpEmulation("armv7")
+    obj.TestEmulation(lldb.SBStream(), "my-file")

Added: lldb/trunk/test/python_api/default-constructor/sb_instructionlist.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_instructionlist.py?rev=134020&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_instructionlist.py (added)
+++ lldb/trunk/test/python_api/default-constructor/sb_instructionlist.py Tue Jun 28 14:07:02 2011
@@ -0,0 +1,14 @@
+"""
+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.GetSize()
+    obj.GetInstructionAtIndex(0xffffffff)
+    obj.AppendInstruction(lldb.SBInstruction())
+    obj.Print(None)
+    obj.GetDescription(lldb.SBStream())
+    obj.DumpEmulationForAllInstructions("armv7")





More information about the lldb-commits mailing list