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

Johnny Chen johnny.chen at apple.com
Fri Jun 24 17:21:00 PDT 2011


Author: johnny
Date: Fri Jun 24 19:21:00 2011
New Revision: 133850

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

Added:
    lldb/trunk/test/python_api/default-constructor/sb_error.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=133850&r1=133849&r2=133850&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Fri Jun 24 19:21:00 2011
@@ -111,6 +111,9 @@
         if self.TraceOn():
             print obj
         self.assertFalse(obj)
+        # Do fuzz testing on the invalid obj, it should not crash lldb.
+        import sb_error
+        sb_error.fuzz_obj(obj)
 
     @python_api_test
     def test_SBEvent(self):

Added: lldb/trunk/test/python_api/default-constructor/sb_error.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_error.py?rev=133850&view=auto
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_error.py (added)
+++ lldb/trunk/test/python_api/default-constructor/sb_error.py Fri Jun 24 19:21:00 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.GetCString()
+    obj.Fail()
+    obj.Success()
+    obj.GetError()
+    obj.GetType()
+    obj.SetError(5, lldb.eErrorTypeGeneric)
+    obj.SetErrorToErrno()
+    obj.SetErrorToGenericError()
+    obj.SetErrorString("xyz")
+    obj.SetErrorStringWithFormat("%s!", "error")
+    obj.GetDescription(lldb.SBStream())





More information about the lldb-commits mailing list