From 71eabde2f848e2c1c05d0a6a50526d836c8266c9 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Mon, 27 Jun 2011 22:38:57 +0000 Subject: Add fuzz calls for SBEvent. llvm-svn: 133954 --- .../TestDefaultConstructorForAPIObjects.py | 3 +++ lldb/test/python_api/default-constructor/sb_event.py | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 lldb/test/python_api/default-constructor/sb_event.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 f78c91b0107..bf2729a5963 100644 --- a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py +++ b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py @@ -121,6 +121,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_event + sb_event.fuzz_obj(obj) @python_api_test def test_SBFileSpec(self): diff --git a/lldb/test/python_api/default-constructor/sb_event.py b/lldb/test/python_api/default-constructor/sb_event.py new file mode 100644 index 00000000000..e31f3091f2c --- /dev/null +++ b/lldb/test/python_api/default-constructor/sb_event.py @@ -0,0 +1,17 @@ +""" +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.GetDataFlavor() + obj.GetType() + broadcaster = obj.GetBroadcaster() + # Do fuzz testing on the broadcaster obj, it should not crash lldb. + import sb_broadcaster + sb_broadcaster.fuzz_obj(broadcaster) + obj.BroadcasterMatchesPtr(None) + obj.BroadcasterMatchesRef(broadcaster) + obj.GetDescription(lldb.SBStream()) -- cgit v1.2.3