[Lldb-commits] [lldb] r227938 - Add an expectall() API that allows you to pass a list of patterns and have pexpect match *ALL* of them instead of just picking one

Enrico Granata egranata at apple.com
Mon Feb 2 19:50:32 PST 2015


Nope. Imagine an inferior that produces partial outputs during a long process, for example

i = 0
while i < 10:
  i += 1
  sleep(5)
  print "iteration %s" % i

Now you're only getting a line every 5 seconds. So you do need the timeout

Sent from my iPhone

> On Feb 2, 2015, at 7:30 PM, Zachary Turner <zturner at google.com> wrote:
> 
> Should the timeout be 0 on all iterations after the first?
>> On Mon, Feb 2, 2015 at 7:14 PM Enrico Granata <egranata at apple.com> wrote:
>> Author: enrico
>> Date: Mon Feb  2 21:11:59 2015
>> New Revision: 227938
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=227938&view=rev
>> Log:
>> Add an expectall() API that allows you to pass a list of patterns and have pexpect match *ALL* of them instead of just picking one
>> 
>> Modified:
>>     lldb/trunk/test/lldbpexpect.py
>> 
>> Modified: lldb/trunk/test/lldbpexpect.py
>> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbpexpect.py?rev=227938&r1=227937&r2=227938&view=diff
>> ==============================================================================
>> --- lldb/trunk/test/lldbpexpect.py (original)
>> +++ lldb/trunk/test/lldbpexpect.py Mon Feb  2 21:11:59 2015
>> @@ -32,6 +32,13 @@ class PExpectTest(TestBase):
>>          else:
>>              return self.child.expect(patterns, timeout=timeout)
>> 
>> +    def expectall(self, patterns=None, timeout=None, exact=None):
>> +        if patterns is None: return None
>> +        if timeout is None: timeout = self.timeout
>> +        if exact is None: exact = False
>> +        for pattern in patterns:
>> +            self.expect(pattern, timeout=timeout, exact=exact)
>> +
>>      def sendimpl(self, sender, command, patterns=None, timeout=None, exact=None):
>>          sender(command)
>>          return self.expect(patterns=patterns, timeout=timeout, exact=exact)
>> 
>> 
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150202/470b49dc/attachment.html>


More information about the lldb-commits mailing list