[Lldb-commits] [PATCH] test: ignore IOError in Base.deletePexpectChild and clean TestMySyntax test

Ilia K ki.stfu at gmail.com
Mon Jan 12 05:24:31 PST 2015


Hello Abid,

Cleanup didn't help and I got the error again:
{code}
======================================================================
ERROR: test_lldbmi_eval (TestMiEvaluate.MiEvaluateTestCase)
    Test that 'lldb-mi --interpreter' works for evaluating.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 1767, in
tearDown
    Base.tearDown(self)
  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 1087, in
tearDown
    self.deletePexpectChild()
  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 1072, in
deletePexpectChild
    self.child.sendline('settings set interpreter.prompt-on-quit false')
  File "/Users/IliaK/p/llvm/tools/lldb/test/pexpect-2.4/pexpect.py", line
966, in sendline
    n = self.send(s)
  File "/Users/IliaK/p/llvm/tools/lldb/test/pexpect-2.4/pexpect.py", line
958, in send
    c = os.write(self.child_fd, s)
OSError: [Errno 5] Input/output error
Config=x86_64-clang
{code}

Could you submit IOError patch?

Thanks,
Ilia


On Tue, Dec 30, 2014 at 9:16 PM, Ilia K <ki.stfu at gmail.com> wrote:

> Nope, it didn't help:
>
> {code}
> ======================================================================
> ERROR: test_lldbmi_pendbreakonsym (TestMiBreakpoint.MiBreakpointTestCase)
>    Test that 'lldb-mi --interpreter' works for pending symbol breakpoints.
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 1765, in
> tearDown
>     Base.tearDown(self)
>   File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 1087, in
> tearDown
>     self.deletePexpectChild()
>   File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 1072, in
> deletePexpectChild
>     self.child.sendline('settings set interpreter.prompt-on-quit false')
>   File "/Users/IliaK/p/llvm/tools/lldb/test/pexpect-2.4/pexpect.py", line
> 966, in sendline
>     n = self.send(s)
>   File "/Users/IliaK/p/llvm/tools/lldb/test/pexpect-2.4/pexpect.py", line
> 958, in send
>     c = os.write(self.child_fd, s)
> OSError: [Errno 5] Input/output error
> Config=x86_64-clang
> {code}
>
> Thanks,
> Ilia
>
>
> On Tue, Dec 30, 2014 at 8:15 PM, Abid, Hafiz <Hafiz_Abid at mentor.com>
> wrote:
>
>>  I committed the cleanup in 224990. Please have a look and let me know
>> if you see a problem.
>>
>>  Regards,
>> Abid
>>  ------------------------------
>> *From:* Ilia K [ki.stfu at gmail.com]
>> *Sent:* Tuesday, December 30, 2014 4:50 PM
>>
>> *To:* Abid, Hafiz
>> *Cc:* lldb-commits at cs.uiuc.edu
>> *Subject:* Re: [Lldb-commits] [PATCH] test: ignore IOError in
>> Base.deletePexpectChild and clean TestMySyntax test
>>
>>   Now I have modified breakpoint's test and IOError sometimes happens:
>> {code}
>>  $ *./dotest.py -v --executable $BUILDDIR/bin/lldb -f
>> MiBreakpointTestCase.test_lldbmi_pendbreakonsym*
>> ['./dotest.py', '-v', '--executable',
>> '/Users/IliaK/p/llvm/build_ninja/bin/lldb', '-f',
>> 'MiBreakpointTestCase.test_lldbmi_pendbreakonsym']
>> LLDB library dir: /Users/IliaK/p/llvm/build_ninja/bin
>> lldb-330.99.0
>> lldb.pre_flight: None
>> lldb.post_flight: None
>>
>>  Session logs for test failures/errors/unexpected successes will go into
>> directory '2014-12-30-19_45_12'
>> Command invoked: ./dotest.py -v --executable
>> /Users/IliaK/p/llvm/build_ninja/bin/lldb -f
>> MiBreakpointTestCase.test_lldbmi_pendbreakonsym
>> compilers=['clang']
>>
>>  Configuration: arch=x86_64 compiler=clang
>> ----------------------------------------------------------------------
>> Collected 1 test
>>
>>  1: test_lldbmi_pendbreakonsym (TestMiBreakpoint.MiBreakpointTestCase)
>>    Test that 'lldb-mi --interpreter' works for pending symbol
>> breakpoints. ... ERROR
>>
>>  ======================================================================
>> ERROR: test_lldbmi_pendbreakonsym (TestMiBreakpoint.MiBreakpointTestCase)
>>    Test that 'lldb-mi --interpreter' works for pending symbol breakpoints.
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>>   File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 1765, in
>> tearDown
>>     Base.tearDown(self)
>>   File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 1087, in
>> tearDown
>>     self.deletePexpectChild()
>>   File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 1072, in
>> deletePexpectChild
>>     self.child.sendline('settings set interpreter.prompt-on-quit false')
>>   File "/Users/IliaK/p/llvm/tools/lldb/test/pexpect-2.4/pexpect.py", line
>> 966, in sendline
>>     n = self.send(s)
>>   File "/Users/IliaK/p/llvm/tools/lldb/test/pexpect-2.4/pexpect.py", line
>> 958, in send
>>     c = os.write(self.child_fd, s)
>> OSError: [Errno 5] Input/output error
>> Config=x86_64-clang
>> ----------------------------------------------------------------------
>> {code}
>>
>>  Here are my changes:
>> {code}
>>  Index: test/tools/lldb-mi/TestMiBreakpoint.py
>> ===================================================================
>> --- test/tools/lldb-mi/TestMiBreakpoint.py      (revision 224982)
>> +++ test/tools/lldb-mi/TestMiBreakpoint.py      (working copy)
>> @@ -48,17 +48,13 @@
>>                  child.expect("\^done,bkpt={number=\"1\"")
>>
>>                   child.sendline("-exec-run")
>> -                child.sendline("") # FIXME: lldb-mi hangs here, so extra
>> return is needed
>>                  child.expect("\^running")
>>                  child.expect("\*stopped,reason=\"breakpoint-hit\"")
>>
>>                   child.sendline("-exec-continue")
>>                  child.expect("\^running")
>>                  child.expect("\*stopped,reason=\"exited-normally\"")
>> -                child.expect_exact(prompt)
>>
>>  -                child.sendline("quit")
>> -
>>          # Now that the necessary logging is done, restore logfile to
>> None to
>>          # stop further logging.
>>          child.logfile_send = None
>>  {code}
>>
>>  Thanks,
>> Ilia
>>
>>
>> On Tue, Dec 30, 2014 at 7:39 PM, Abid, Hafiz <Hafiz_Abid at mentor.com>
>> wrote:
>>
>>>  I also found in the existing test cases that both ways have been used.
>>> So I will remove that prompt and 'quit' from the lldb-mi test cases as you
>>> have done from one of them. Then if you still get the IOError then we can
>>> apply your 2nd patch.
>>>
>>>  Thanks,
>>> Abid
>>>  ------------------------------
>>> *From:* Ilia K [ki.stfu at gmail.com]
>>> *Sent:* Tuesday, December 30, 2014 4:29 PM
>>> *To:* Abid, Hafiz
>>> *Cc:* lldb-commits at cs.uiuc.edu
>>> *Subject:* RE: [Lldb-commits] [PATCH] test: ignore IOError in
>>> Base.deletePexpectChild and clean TestMySyntax test
>>>
>>>    As I understood both of them are legal (in theory) but in practice I
>>> faced with IOError. I think we should ignore IOError because we can't fix
>>> isalive() method.
>>>
>>> Thanks,
>>> Ilia
>>> On 30 Dec 2014 19:21, "Abid, Hafiz" <Hafiz_Abid at mentor.com> wrote:
>>>
>>>>  Thanks for quick reply. Your patch is removing the following line
>>>> from lldb-mi test case.
>>>> -                child.sendline("quit")
>>>>
>>>>  I am wondering what is the convention of terminating the executable
>>>> that we invoked. Do the test is supposed to kill it (using 'quit') command
>>>> or it can be left to the other part of testing code which as you noted also
>>>> use sendline('quit').
>>>>
>>>>  Regards,
>>>> Abid
>>>>  ------------------------------
>>>> *From:* Ilia K [ki.stfu at gmail.com]
>>>> *Sent:* Tuesday, December 30, 2014 4:11 PM
>>>> *To:* Abid, Hafiz
>>>> *Cc:* lldb-commits at cs.uiuc.edu
>>>> *Subject:* Re: [Lldb-commits] [PATCH] test: ignore IOError in
>>>> Base.deletePexpectChild and clean TestMySyntax test
>>>>
>>>>   ** it will cause a IOError because later it will try to kill process
>>>> using 'sendline(quit)'.
>>>>
>>>>  Thanks,
>>>> Ilia
>>>>
>>>> On Tue, Dec 30, 2014 at 7:06 PM, Ilia K <ki.stfu at gmail.com> wrote:
>>>>
>>>>> Hello Abid,
>>>>>
>>>>>  I'm glad to see you.
>>>>>
>>>>>  >RE: IMHO once we have removed the extra quit call from the test
>>>>> cases, we will not need the check for OSErrror.
>>>>> Unfortunately it's not. The deletePexpectChild() sometimes causes that
>>>>> problem when isalive returns a false positive result.
>>>>> {code}
>>>>>          # This is for the case of directly spawning 'lldb' and
>>>>> interacting with it
>>>>>          # using pexpect.
>>>>>         if self.child and self.child.isalive(): *<--here*
>>>>>             import pexpect
>>>>>             with recording(self, traceAlways) as sbuf:
>>>>>                 print >> sbuf, "tearing down the child process...."
>>>>>             try:
>>>>>                 if self.child_in_script_interpreter:
>>>>>                     self.child.sendline('quit()')
>>>>>                     self.child.expect_exact(self.child_prompt)
>>>>>                  self.child.sendline('settings set
>>>>> interpreter.prompt-on-quit false')
>>>>>                  self.child.sendline('quit')
>>>>>                 self.child.expect(pexpect.EOF)
>>>>>             except (ValueError, OSError, pexpect.ExceptionPexpect):
>>>>>                  # child is already terminated
>>>>>                 pass
>>>>>              finally:
>>>>>                 # Give it one final blow to make sure the child is
>>>>> terminated.
>>>>>                 self.child.close()
>>>>> {code}
>>>>> The pexpect's isalive() method is nonblocking. It checks whether
>>>>> process was terminated or not. But the problem is that process may be
>>>>> terminated after isalive() was called -- it will cause a IOError.
>>>>>
>>>>>  Thanks,
>>>>> Ilia
>>>>>
>>>>>
>>>>> On Tue, Dec 30, 2014 at 6:46 PM, Abid, Hafiz <Hafiz_Abid at mentor.com>
>>>>> wrote:
>>>>>
>>>>>>  I dont see any problem with the patch that cleans up
>>>>>> the TestMiSyntax.py. But I see that similar cleanup is needed in  other
>>>>>> tests too. I will make the change and then commit all of them.
>>>>>>
>>>>>>  IMHO once we have removed the extra quit call from the test cases,
>>>>>> we will not need the check for OSErrror.
>>>>>>
>>>>>>  Thanks,
>>>>>> Abid
>>>>>>  ------------------------------
>>>>>> *From:* Ilia K [ki.stfu at gmail.com]
>>>>>> *Sent:* Monday, December 22, 2014 11:54 AM
>>>>>> *To:* Abid, Hafiz; lldb-commits at cs.uiuc.edu
>>>>>> *Subject:* Re: [Lldb-commits] [PATCH] test: ignore IOError in
>>>>>> Base.deletePexpectChild and clean TestMySyntax test
>>>>>>
>>>>>>    Hello,
>>>>>>
>>>>>>  My previous messages left without answer. I'm posting them again
>>>>>> (see below) with patch files.
>>>>>> The initial message:
>>>>>> http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20141215/014599.html
>>>>>>
>>>>>>  Thanks,
>>>>>> Ilia
>>>>>>
>>>>>> On Tue, Dec 16, 2014 at 7:02 PM, Ilia K <ki.stfu at gmail.com> wrote:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>>  >RE: IOError may happen when child already exited but dotest has
>>>>>>> missed this and tries to exit using 'child.sendline("quit")'
>>>>>>> Actually it's OSError (not IOError):
>>>>>>>
>>>>>>>
>>>>>>> ======================================================================
>>>>>>> ERROR: test_lldbmi_tokens (TestMiSyntax.MiSyntaxTestCase)
>>>>>>>    Test that 'lldb-mi --interpreter' echos command tokens.
>>>>>>>
>>>>>>> ----------------------------------------------------------------------
>>>>>>> Traceback (most recent call last):
>>>>>>>   File "/Users/IliaK/p/llvm_delphi/tools/lldb/test/lldbtest.py",
>>>>>>> line 1770, in tearDown
>>>>>>>     Base.tearDown(self)
>>>>>>>   File "/Users/IliaK/p/llvm_delphi/tools/lldb/test/lldbtest.py",
>>>>>>> line 1092, in tearDown
>>>>>>>     self.deletePexpectChild()
>>>>>>>   File "/Users/IliaK/p/llvm_delphi/tools/lldb/test/lldbtest.py",
>>>>>>> line 1074, in deletePexpectChild
>>>>>>>     self.child.sendline('settings set interpreter.prompt-on-quit
>>>>>>> false')
>>>>>>>   File
>>>>>>> "/Users/IliaK/p/llvm_delphi/tools/lldb/test/pexpect-2.4/pexpect.py", line
>>>>>>> 966, in sendline
>>>>>>>     n = self.send(s)
>>>>>>>   File
>>>>>>> "/Users/IliaK/p/llvm_delphi/tools/lldb/test/pexpect-2.4/pexpect.py", line
>>>>>>> 958, in send
>>>>>>>     c = os.write(self.child_fd, s)
>>>>>>> OSError: [Errno 5] Input/output error
>>>>>>> Config=x86_64-clang
>>>>>>>
>>>>>>>  Therefore I updated lldbtest_ignore_ioerror_on_theardown.patch
>>>>>>> file.
>>>>>>> Btw, may be better to filter only IO errors from OSError class?
>>>>>>> It'll look like:
>>>>>>>
>>>>>>>  {code}
>>>>>>> try:
>>>>>>>     ...
>>>>>>> except (ValueError, pexpect.ExceptionPexpect):
>>>>>>>     # child is already terminated
>>>>>>>     pass
>>>>>>> except OSError, e:
>>>>>>>     if e.errno != errno.EIO:
>>>>>>>         # unexpected exception
>>>>>>>         raise
>>>>>>>      # child is already terminated
>>>>>>>      pass
>>>>>>> finally:
>>>>>>>     ...
>>>>>>> {code}
>>>>>>>
>>>>>>>  Thanks,
>>>>>>> Ilia
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Dec 16, 2014 at 4:42 PM, Ilia K <ki.stfu at gmail.com> wrote:
>>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>>  I found the following:
>>>>>>>> IOError may happen when child already exited but dotest has missed
>>>>>>>> this and tries to exit using 'child.sendline("quit")'
>>>>>>>>
>>>>>>>>  Also, I clean syntax test. -exec-run no hangs more and 'quit'
>>>>>>>> isn't needed at exit.
>>>>>>>>
>>>>>>>>  Thanks,
>>>>>>>> Ilia
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150112/d152c7f0/attachment.html>


More information about the lldb-commits mailing list