[lldb-dev] pexpect and getting tests working on Windows
Zachary Turner
zturner at google.com
Wed Jul 9 11:14:43 PDT 2014
The current issue with regards to getting tests working on Windows is that
the pexpect module doesn't exist on Windows. I've looked over a number of
the tests, and as far as I can tell, the pexpect module is used for two
primary reasons. The first is spawning lldb and waiting for it to
terminate, and the second is sending text commands to lldb, and reading the
textual results of these commands, comparing them against expected values.
#1 can be solved without pexpect (e.g. by using the subprocess module), but
#2 is more difficult.
It seems to me like there are two paths forward for getting the test suite
working on windows:
1) Port pexpect to Windows. I expect this to be difficult for the sole
reason that it hasn't been done yet, so despite the fact Windows does
provide a sufficiently rich API to do everything that pexpect does,
something tells me that there are some subtle issues that make this a
difficult problem.
2) Change LLDB, and the test suite, to not rely on pexpect. The entire
problem seems to boil down to the fact that LLDB writes all of its output
to stdout and reads all of its input to stdin. When a command completes,
In CommandInterpreter::IOHandlerInputComplete, it calls this line:
io_handler.GetOutputStreamFile()->PutCString(output);
which ultimately resolves to a FILE* referring to stdout. What would it
take to make this output stream configurable? I'm imagining, for example,
a function that's exposed through the Python API that lets me write
something like
lldb.SBDebugger.SetOutputStream(foo)
"foo" here could be a python object that simply collects output, and then
the "expect" command on the Python side could just compare the expected
value against this buffer.
With this we could completely remove all the pexpect dependencies.
Thoughts? Suggestions? Gotchas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140709/26e9ebef/attachment.html>
More information about the lldb-dev
mailing list