From 6e3dfa6025c301df749adb1251a9ea592bffb391 Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Fri, 24 Jun 2011 23:16:27 +0000 Subject: Add fuzz calls for SBCommunication. llvm-svn: 133839 --- .../TestDefaultConstructorForAPIObjects.py | 3 +++ .../default-constructor/sb_communication.py | 27 ++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 lldb/test/python_api/default-constructor/sb_communication.py (limited to 'lldb/test/python_api/default-constructor') diff --git a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py index b744d541eb6..eb5aa8360cb 100644 --- a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py +++ b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py @@ -81,6 +81,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_communication + sb_communication.fuzz_obj(obj) @python_api_test def test_SBCompileUnit(self): diff --git a/lldb/test/python_api/default-constructor/sb_communication.py b/lldb/test/python_api/default-constructor/sb_communication.py new file mode 100644 index 00000000000..fef3eabd909 --- /dev/null +++ b/lldb/test/python_api/default-constructor/sb_communication.py @@ -0,0 +1,27 @@ +""" +Fuzz tests an object after the default construction to make sure it does not crash lldb. +""" + +import sys +import lldb + +def fuzz_obj(obj): + broadcaster = obj.GetBroadcaster() + # Do fuzz testing on the broadcaster obj, it should not crash lldb. + import sb_broadcaster + sb_broadcaster.fuzz_obj(broadcaster) + obj.AdoptFileDesriptor(0, False) + obj.AdoptFileDesriptor(1, False) + obj.AdoptFileDesriptor(2, False) + obj.Connect("file:/tmp/myfile") + obj.Disconnect() + obj.IsConnected() + obj.GetCloseOnEOF() + obj.SetCloseOnEOF(True) + obj.SetCloseOnEOF(False) + #obj.Write(None, sys.maxint, None) + #obj.Read(None, sys.maxint, 0xffffffff, None) + obj.ReadThreadStart() + obj.ReadThreadStop() + obj.ReadThreadIsRunning() + obj.SetReadThreadBytesReceivedCallback(None, None) -- cgit v1.2.3