<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jul 9, 2014 at 3:18 PM,  <span dir="ltr"><<a href="mailto:jingham@apple.com" target="_blank">jingham@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Generally lldb commands can be synchronous or not depending on context.  For instance if I attach to a program, then "continue" will return control to the user as soon as the process continues and won't wait till it stops.  But I don't think many tests use this feature.<br>

<br>
Anyway, that's not the real issue.  The times that the testsuite is actually using pexpect, it isn't directly "running a command" in a way that you could know when it is done.  Rather, it just funnels some text at an externally spawned lldb, and reads output till it see the "stop condition" which in our case is generally the prompt.  That tells you you're done.  Then you take the text before the prompt, and that's what you compare to.  That's a very simple use of expect, but that's pretty much all we do.  Anyway, so "wait till you see the stop condition" and all that that entails is what expect is doing for you.<br>
</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>
OTOH, by my (admittedly quick) reading, the lldb test suite doesn't use pexpect very much at all.  For instance, lldbtest.runCmd and lldbtest.expect don't actually use pexpect, they just run a command with SBCommandInterpreter::HandleCommand and grab output from the command result object.  The benchmarks tests do use pexpect and just a few others.  You could probably switch around the "import pexpect" statements in the main lldbtest.py if you are on windows, and then skip the few tests that actually import it, and you'd be losing only 7 or 8 tests.<br>
</blockquote><div></div></div><br></div><div class="gmail_extra">Yes, something like this is exactly what I had in mind in regards to how I thought many tests could be written (SBCommandInterpreter.HandleCommand and grab the result object).  It's good to know that this is already a supported way of writing tests.  I see at least a few places where pexpect is currently used when it appears SBCommandInterpreter.HandleCommand would suffice.  So perhaps some of these could even be converted.  I'm still working through a few other issues regarding getting script integration working on Windows, but hopefully I'll figure it out soon enough.  Thanks!</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Zach</div></div>