diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/default-constructor')
2 files changed, 33 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py index 4739df00085..bea9f5962d6 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py @@ -255,6 +255,17 @@ class APIDefaultConstructorTestCase(TestBase): @add_test_categories(['pyapi']) @no_debug_info_test + def test_SBProcessInfo(self): + obj = lldb.SBProcessInfo() + if self.TraceOn(): + print(obj) + self.assertFalse(obj) + # Do fuzz testing on the invalid obj, it should not crash lldb. + import sb_process_info + sb_process_info.fuzz_obj(obj) + + @add_test_categories(['pyapi']) + @no_debug_info_test def test_SBSection(self): obj = lldb.SBSection() if self.TraceOn(): diff --git a/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process_info.py b/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process_info.py new file mode 100644 index 00000000000..020ad4e1066 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process_info.py @@ -0,0 +1,22 @@ +""" +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.GetExecutableFile() + obj.GetProcessID() + obj.GetUserID() + obj.GetGroupID() + obj.UserIDIsValid() + obj.GroupIDIsValid() + obj.GetEffectiveUserID() + obj.GetEffectiveGroupID() + obj.EffectiveUserIDIsValid() + obj.EffectiveGroupIDIsValid() + obj.GetParentProcessID() |