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

Johnny Chen johnny.chen at apple.com
Mon Oct 3 15:30:56 PDT 2011


Author: johnny
Date: Mon Oct  3 17:30:56 2011
New Revision: 141039

URL: http://llvm.org/viewvc/llvm-project?rev=141039&view=rev
Log:
Add SBSection API to the fuzz testing.

Added:
    lldb/trunk/test/python_api/default-constructor/sb_section.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=141039&r1=141038&r2=141039&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Mon Oct  3 17:30:56 2011
@@ -228,6 +228,16 @@
         sb_process.fuzz_obj(obj)
 
     @python_api_test
+    def test_SBSection(self):
+        obj = lldb.SBSection()
+        if self.TraceOn():
+            print obj
+        self.assertFalse(obj)
+        # Do fuzz testing on the invalid obj, it should not crash lldb.
+        import sb_section
+        sb_section.fuzz_obj(obj)
+
+    @python_api_test
     def test_SBStream(self):
         """SBStream object is valid after default construction."""
         obj = lldb.SBStream()

Added: lldb/trunk/test/python_api/default-constructor/sb_section.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_section.py?rev=141039&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_section.py (added)
+++ lldb/trunk/test/python_api/default-constructor/sb_section.py Mon Oct  3 17:30:56 2011
@@ -0,0 +1,20 @@
+"""
+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.IsValid()
+    obj.GetName()
+    obj.FindSubSection("hello_section_name")
+    obj.GetNumSubSections()
+    obj.GetSubSectionAtIndex(600)
+    obj.GetFileAddress()
+    obj.GetByteSize()
+    obj.GetFileOffset()
+    obj.GetFileByteSize()
+    obj.GetSectionData(1000, 100)
+    obj.GetSectionType()
+    obj.GetDescription(lldb.SBStream())





More information about the lldb-commits mailing list