diff options
author | Lawrence D'Anna <lawrence_danna@apple.com> | 2019-10-11 17:43:32 +0000 |
---|---|---|
committer | Lawrence D'Anna <lawrence_danna@apple.com> | 2019-10-11 17:43:32 +0000 |
commit | b3faa01ff9625cc00d98d5fffd597c64d494c349 (patch) | |
tree | bfd35802f71e74c678f4fe173d2cbcfe81bc9b16 /lldb/packages/Python/lldbsuite/test/python_api/file_handle | |
parent | e695d3c695652d4cc4afcb52112d04f3b25fe851 (diff) | |
download | bcm5719-llvm-b3faa01ff9625cc00d98d5fffd597c64d494c349.tar.gz bcm5719-llvm-b3faa01ff9625cc00d98d5fffd597c64d494c349.zip |
IOHandler: fall back on File::Read if a FILE* isn't available.
Summary:
IOHandler needs to read lines of input from a lldb::File.
The way it currently does this using, FILE*, which is something
we want to avoid now. I'd prefer to just replace the FILE* code
with calls to File::Read, but it contains an awkward and
delicate workaround specific to ctrl-C handling on windows, and
it's not clear if or how that workaround would translate to
lldb::File.
So in this patch, we use use the FILE* if it's available, and only
fall back on File::Read if that's the only option.
I think this is a reasonable approach here for two reasons. First
is that interactive terminal support is the one area where FILE*
can't be avoided. We need them for libedit and curses anyway,
and using them here as well is consistent with that pattern.
The second reason is that the comments express a hope that the
underlying windows bug that's being worked around will be fixed one
day, so hopefully when that happens, that whole path can be deleted.
Reviewers: JDevlieghere, jasonmolenda, labath, lanza
Reviewed By: labath
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D68622
llvm-svn: 374576
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/file_handle')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py b/lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py index a977ec95965..577c6b3e88f 100644 --- a/lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py +++ b/lldb/packages/Python/lldbsuite/test/python_api/file_handle/TestFileHandle.py @@ -399,9 +399,9 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) - @expectedFailureAll() # FIXME IOHandler still using FILE* + @skipIf(py_version=['<', (3,)]) def test_string_inout(self): - inf = io.StringIO("help help\n") + inf = io.StringIO("help help\np/x ~0\n") outf = io.StringIO() status = self.debugger.SetOutputFile(lldb.SBFile(outf)) self.assertTrue(status.Success()) @@ -412,10 +412,11 @@ class FileHandleTestCase(lldbtest.TestBase): self.debugger.GetOutputFile().Flush() output = outf.getvalue() self.assertIn('Show a list of all debugger commands', output) + self.assertIn('0xfff', output) @add_test_categories(['pyapi']) - @expectedFailureAll() # FIXME IOHandler still using FILE* + @skipIf(py_version=['<', (3,)]) def test_bytes_inout(self): inf = io.BytesIO(b"help help\nhelp b\n") outf = io.BytesIO() |