From 4d1f660aced0b9660e65928c87b1a6ddf591f2cb Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Fri, 24 Jun 2011 00:06:53 +0000 Subject: Start adding API calls to the invalid SB API object after default construction. It should not crash lldb. This checkin adds calls for SBAddress. llvm-svn: 133778 --- .../TestDefaultConstructorForAPIObjects.py | 3 +++ lldb/test/python_api/default-constructor/sb_address.py | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 lldb/test/python_api/default-constructor/sb_address.py (limited to 'lldb/test/python_api') diff --git a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py index d60533bf4ba..e28de4c9931 100644 --- a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py +++ b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py @@ -22,6 +22,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_address + sb_address.fuzz_obj(obj) @python_api_test def test_SBBlock(self): diff --git a/lldb/test/python_api/default-constructor/sb_address.py b/lldb/test/python_api/default-constructor/sb_address.py new file mode 100644 index 00000000000..372aafc97c4 --- /dev/null +++ b/lldb/test/python_api/default-constructor/sb_address.py @@ -0,0 +1,12 @@ +""" +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.GetFileAddress() + obj.GetLoadAddress(lldb.SBTarget()) + obj.OffsetAddress(sys.maxint) + obj.GetDescription(lldb.SBStream()) -- cgit v1.2.3