summaryrefslogtreecommitdiffstats
path: root/lldb/test/python_api
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-06-25 00:21:00 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-06-25 00:21:00 +0000
commit06657625b8b81aeb52a3bec32caf92ba93cd293c (patch)
treed152c6d99d09b8894cef0ff95265a00e935f1e84 /lldb/test/python_api
parentf4105f5cfeb3a12956fd44b22646aaa87b51ef3f (diff)
downloadbcm5719-llvm-06657625b8b81aeb52a3bec32caf92ba93cd293c.tar.gz
bcm5719-llvm-06657625b8b81aeb52a3bec32caf92ba93cd293c.zip
Add fuzz calls for SBError.
llvm-svn: 133850
Diffstat (limited to 'lldb/test/python_api')
-rw-r--r--lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py3
-rw-r--r--lldb/test/python_api/default-constructor/sb_error.py19
2 files changed, 22 insertions, 0 deletions
diff --git a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
index 196c5d59d75..f78c91b0107 100644
--- a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
+++ b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
@@ -111,6 +111,9 @@ class APIDefaultConstructorTestCase(TestBase):
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):
diff --git a/lldb/test/python_api/default-constructor/sb_error.py b/lldb/test/python_api/default-constructor/sb_error.py
new file mode 100644
index 00000000000..f38d079972e
--- /dev/null
+++ b/lldb/test/python_api/default-constructor/sb_error.py
@@ -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())
OpenPOWER on IntegriCloud