From 3dc26e839c2458a897f2372e162f5c20b959900b Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Mon, 3 Oct 2011 22:30:56 +0000 Subject: Add SBSection API to the fuzz testing. llvm-svn: 141039 --- .../TestDefaultConstructorForAPIObjects.py | 10 ++++++++++ .../python_api/default-constructor/sb_section.py | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 lldb/test/python_api/default-constructor/sb_section.py diff --git a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py index b46a9fa7bea..2340a6130a7 100644 --- a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py +++ b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py @@ -227,6 +227,16 @@ class APIDefaultConstructorTestCase(TestBase): import sb_process 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.""" diff --git a/lldb/test/python_api/default-constructor/sb_section.py b/lldb/test/python_api/default-constructor/sb_section.py new file mode 100644 index 00000000000..df33338ac9d --- /dev/null +++ b/lldb/test/python_api/default-constructor/sb_section.py @@ -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()) -- cgit v1.2.3