diff options
author | Johnny Chen <johnny.chen@apple.com> | 2011-06-28 19:07:02 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2011-06-28 19:07:02 +0000 |
commit | 6f306a48592be29c0fdaff98cd9c47c3e6eb343e (patch) | |
tree | 5ce6f9d8c9802c7ab884cb70be440aabf2369abb /lldb/test/python_api/default-constructor | |
parent | b10d72f019736a9944c851f11f8995485c5ccc86 (diff) | |
download | bcm5719-llvm-6f306a48592be29c0fdaff98cd9c47c3e6eb343e.tar.gz bcm5719-llvm-6f306a48592be29c0fdaff98cd9c47c3e6eb343e.zip |
Add fuzz calls for SBInstruction and SBInstructionList.
llvm-svn: 134020
Diffstat (limited to 'lldb/test/python_api/default-constructor')
3 files changed, 36 insertions, 0 deletions
diff --git a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py index a5717c50bcb..df8b42eb70f 100644 --- a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py +++ b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py @@ -171,6 +171,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_instruction + sb_instruction.fuzz_obj(obj) @python_api_test def test_SBInstructionList(self): @@ -178,6 +181,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_instructionlist + sb_instructionlist.fuzz_obj(obj) @python_api_test def test_SBLineEntry(self): diff --git a/lldb/test/python_api/default-constructor/sb_instruction.py b/lldb/test/python_api/default-constructor/sb_instruction.py new file mode 100644 index 00000000000..91d2930cb2f --- /dev/null +++ b/lldb/test/python_api/default-constructor/sb_instruction.py @@ -0,0 +1,16 @@ +""" +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.GetAddress() + obj.GetByteSize + obj.DoesBranch() + obj.Print(None) + obj.GetDescription(lldb.SBStream()) + obj.EmulateWithFrame(lldb.SBFrame(), 0) + obj.DumpEmulation("armv7") + obj.TestEmulation(lldb.SBStream(), "my-file") diff --git a/lldb/test/python_api/default-constructor/sb_instructionlist.py b/lldb/test/python_api/default-constructor/sb_instructionlist.py new file mode 100644 index 00000000000..b9c20b77056 --- /dev/null +++ b/lldb/test/python_api/default-constructor/sb_instructionlist.py @@ -0,0 +1,14 @@ +""" +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.GetSize() + obj.GetInstructionAtIndex(0xffffffff) + obj.AppendInstruction(lldb.SBInstruction()) + obj.Print(None) + obj.GetDescription(lldb.SBStream()) + obj.DumpEmulationForAllInstructions("armv7") |