From 5750453020926ce270aee38bd5eb7f0ff3467237 Mon Sep 17 00:00:00 2001 From: Lawrence D'Anna Date: Thu, 3 Oct 2019 04:01:07 +0000 Subject: new api class: SBFile Summary: SBFile is a scripting API wrapper for lldb_private::File This is the first step in a project to enable arbitrary python io.IOBase file objects -- including those that override the read() and write() methods -- to be used as the main debugger IOStreams. Currently this is impossible because python file objects must first be converted into FILE* streams by SWIG in order to be passed into the debugger. full prototype: https://github.com/smoofra/llvm-project/tree/files Reviewers: JDevlieghere, jasonmolenda, zturner, jingham, labath Reviewed By: labath Subscribers: labath, mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D67793 llvm-svn: 373562 --- .../TestDefaultConstructorForAPIObjects.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lldb/packages/Python/lldbsuite/test/python_api/default-constructor') 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 e48b90e2ee9..75bd4a6760d 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 @@ -192,6 +192,20 @@ class APIDefaultConstructorTestCase(TestBase): import sb_function sb_function.fuzz_obj(obj) + @add_test_categories(['pyapi']) + @no_debug_info_test + def test_SBFile(self): + sbf = lldb.SBFile() + self.assertFalse(sbf.IsValid()) + self.assertFalse(bool(sbf)) + e, n = sbf.Write(b'foo') + self.assertTrue(e.Fail()) + self.assertEqual(n, 0) + buffer = bytearray(100) + e, n = sbf.Read(buffer) + self.assertEqual(n, 0) + self.assertTrue(e.Fail()) + @add_test_categories(['pyapi']) @no_debug_info_test def test_SBInstruction(self): -- cgit v1.2.3