<div dir="ltr">Now I have modified breakpoint's test and IOError sometimes happens:<div>{code}<br></div><div><div>$ <b>./dotest.py -v --executable $BUILDDIR/bin/lldb -f MiBreakpointTestCase.test_lldbmi_pendbreakonsym</b></div><div>['./dotest.py', '-v', '--executable', '/Users/IliaK/p/llvm/build_ninja/bin/lldb', '-f', 'MiBreakpointTestCase.test_lldbmi_pendbreakonsym']</div><div>LLDB library dir: /Users/IliaK/p/llvm/build_ninja/bin</div><div>lldb-330.99.0</div><div>lldb.pre_flight: None</div><div>lldb.post_flight: None</div><div><br></div><div>Session logs for test failures/errors/unexpected successes will go into directory '2014-12-30-19_45_12'</div><div>Command invoked: ./dotest.py -v --executable /Users/IliaK/p/llvm/build_ninja/bin/lldb -f MiBreakpointTestCase.test_lldbmi_pendbreakonsym</div><div>compilers=['clang']</div><div><br></div><div>Configuration: arch=x86_64 compiler=clang</div><div>----------------------------------------------------------------------</div><div>Collected 1 test</div><div><br></div><div>1: test_lldbmi_pendbreakonsym (TestMiBreakpoint.MiBreakpointTestCase)</div><div>   Test that 'lldb-mi --interpreter' works for pending symbol breakpoints. ... ERROR</div><div><br></div><div>======================================================================</div><div>ERROR: test_lldbmi_pendbreakonsym (TestMiBreakpoint.MiBreakpointTestCase)</div><div>   Test that 'lldb-mi --interpreter' works for pending symbol breakpoints.</div><div>----------------------------------------------------------------------</div><div>Traceback (most recent call last):</div><div>  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 1765, in tearDown</div><div>    Base.tearDown(self)</div><div>  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 1087, in tearDown</div><div>    self.deletePexpectChild()</div><div>  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 1072, in deletePexpectChild</div><div>    self.child.sendline('settings set interpreter.prompt-on-quit false')</div><div>  File "/Users/IliaK/p/llvm/tools/lldb/test/pexpect-2.4/pexpect.py", line 966, in sendline</div><div>    n = self.send(s)</div><div>  File "/Users/IliaK/p/llvm/tools/lldb/test/pexpect-2.4/pexpect.py", line 958, in send</div><div>    c = os.write(self.child_fd, s)</div><div>OSError: [Errno 5] Input/output error</div><div>Config=x86_64-clang</div><div>----------------------------------------------------------------------</div><div>{code}</div><div><br></div><div>Here are my changes:</div><div>{code}<br></div><div><div>Index: test/tools/lldb-mi/TestMiBreakpoint.py</div><div>===================================================================</div><div>--- test/tools/lldb-mi/TestMiBreakpoint.py      (revision 224982)</div><div>+++ test/tools/lldb-mi/TestMiBreakpoint.py      (working copy)</div><div>@@ -48,17 +48,13 @@</div><div>                 child.expect("\^done,bkpt={number=\"1\"")</div><div><br></div><div>                 child.sendline("-exec-run")</div><div>-                child.sendline("") # FIXME: lldb-mi hangs here, so extra return is needed</div><div>                 child.expect("\^running")</div><div>                 child.expect("\*stopped,reason=\"breakpoint-hit\"")</div><div><br></div><div>                 child.sendline("-exec-continue")</div><div>                 child.expect("\^running")</div><div>                 child.expect("\*stopped,reason=\"exited-normally\"")</div><div>-                child.expect_exact(prompt)</div><div><br></div><div>-                child.sendline("quit")</div><div>-</div><div>         # Now that the necessary logging is done, restore logfile to None to</div><div>         # stop further logging.</div><div>         child.logfile_send = None</div></div><div>{code}</div><div><br></div></div><div>Thanks,</div><div>Ilia</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 30, 2014 at 7:39 PM, Abid, Hafiz <span dir="ltr"><<a href="mailto:Hafiz_Abid@mentor.com" target="_blank">Hafiz_Abid@mentor.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">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.
<div><br>
</div>
<div>Thanks,</div>
<div>Abid<br>
<div style="font-family:Times New Roman;color:#000000;font-size:16px">
<hr>
<div style="direction:ltr"><font face="Tahoma" color="#000000"><b>From:</b> Ilia K [<a href="mailto:ki.stfu@gmail.com" target="_blank">ki.stfu@gmail.com</a>]<br>
<b>Sent:</b> Tuesday, December 30, 2014 4:29 PM<span class=""><br>
<b>To:</b> Abid, Hafiz<br>
<b>Cc:</b> <a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br>
</span><b>Subject:</b> RE: [Lldb-commits] [PATCH] test: ignore IOError in Base.deletePexpectChild and clean TestMySyntax test<br>
</font><br>
</div><div><div class="h5">
<div></div>
<div>
<p dir="ltr">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.</p>
<p dir="ltr">Thanks,<br>
Ilia</p>
<div class="gmail_quote">On 30 Dec 2014 19:21, "Abid, Hafiz" <<a href="mailto:Hafiz_Abid@mentor.com" target="_blank">Hafiz_Abid@mentor.com</a>> wrote:<br type="attribution">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">Thanks for quick reply. <span style="font-size:10pt">Your patch is removing the following line from lldb-mi test case.</span>
<div>-                child.sendline("quit")</div>
<div><br>
</div>
<div>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').</div>
<div><br>
</div>
<div>Regards,</div>
<div>Abid<br>
<div style="font-family:Times New Roman;color:#000000;font-size:16px">
<hr>
<div style="direction:ltr"><font face="Tahoma" color="#000000"><b>From:</b> Ilia K [<a href="mailto:ki.stfu@gmail.com" target="_blank">ki.stfu@gmail.com</a>]<br>
<b>Sent:</b> Tuesday, December 30, 2014 4:11 PM<br>
<b>To:</b> Abid, Hafiz<br>
<b>Cc:</b> <a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br>
<b>Subject:</b> Re: [Lldb-commits] [PATCH] test: ignore IOError in Base.deletePexpectChild and clean TestMySyntax test<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">** i<span style="color:rgb(0,0,0);font-family:Tahoma;font-size:13px">t will cause a IOError because later it will try to kill process using 'sendline(</span><span style="color:rgb(0,0,0);font-family:Tahoma;font-size:13px">quit)'.</span>
<div><span style="color:rgb(0,0,0);font-family:Tahoma;font-size:13px"><br>
</span></div>
<div><span style="color:rgb(0,0,0);font-family:Tahoma;font-size:13px">Thanks,</span></div>
<div><span style="color:rgb(0,0,0);font-family:Tahoma;font-size:13px">Ilia</span></div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Dec 30, 2014 at 7:06 PM, Ilia K <span dir="ltr">
<<a href="mailto:ki.stfu@gmail.com" target="_blank">ki.stfu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hello Abid,
<div><br>
</div>
<div>I'm glad to see you.<br>
</div>
<div><br>
</div>
<div>>RE: <span style="color:rgb(0,0,0);font-family:Tahoma;font-size:13px">IMHO once we have removed the extra quit call from the test cases, we will not need the check for OSErrror.</span></div>
<div><span style="color:rgb(0,0,0);font-family:Tahoma">Unfortunately it's not. The deletePexpectChild() sometimes causes that problem when isalive returns a false positive result.</span></div>
<div><span style="color:rgb(0,0,0);font-family:Tahoma">{code}</span><br>
</div>
<div><font color="#000000" face="Tahoma">
<div>        # This is for the case of directly spawning 'lldb' and interacting with it<br>
</div>
<div>        # using pexpect.</div>
<div>        if self.child and self.child.isalive(): <b><i><--here</i></b></div>
<div>            import pexpect</div>
<div>            with recording(self, traceAlways) as sbuf:</div>
<div>                print >> sbuf, "tearing down the child process...."</div>
<div>            try:</div>
<div>                if self.child_in_script_interpreter:</div>
<div>                    self.child.sendline('quit()')</div>
<div>                    self.child.expect_exact(self.child_prompt)</div>
<span>
<div>                self.child.sendline('settings set interpreter.prompt-on-quit false')</div>
</span>
<div>                self.child.sendline('quit')</div>
<div>                self.child.expect(pexpect.EOF)</div>
<div>            except (ValueError, OSError, pexpect.ExceptionPexpect):</div>
<span>
<div>                # child is already terminated</div>
<div>                pass</div>
</span>
<div>            finally:</div>
<div>                # Give it one final blow to make sure the child is terminated.</div>
<div>                self.child.close()</div>
<div>{code}</div>
<div>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.</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Ilia</div>
<div><br>
</div>
</font></div>
</div>
<div>
<div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Dec 30, 2014 at 6:46 PM, Abid, Hafiz <span dir="ltr">
<<a href="mailto:Hafiz_Abid@mentor.com" target="_blank">Hafiz_Abid@mentor.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">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. 
<div><br>
</div>
<div>IMHO once we have removed the extra quit call from the test cases, we will not need the check for OSErrror.
<div><br>
</div>
<div>Thanks,</div>
<div>Abid<br>
<div style="font-family:Times New Roman;color:#000000;font-size:16px">
<hr>
<div style="direction:ltr"><font face="Tahoma" color="#000000"><b>From:</b> Ilia K [<a href="mailto:ki.stfu@gmail.com" target="_blank">ki.stfu@gmail.com</a>]<br>
<b>Sent:</b> Monday, December 22, 2014 11:54 AM<br>
<b>To:</b> Abid, Hafiz; <a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">
lldb-commits@cs.uiuc.edu</a><br>
<b>Subject:</b> Re: [Lldb-commits] [PATCH] test: ignore IOError in Base.deletePexpectChild and clean TestMySyntax test<br>
</font><br>
</div>
<div>
<div>
<div></div>
<div>
<div dir="ltr">Hello,
<div><br>
</div>
<div>My previous messages left without answer. I'm posting them again (see below) with patch files.</div>
<div>The initial message: <a href="http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20141215/014599.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20141215/014599.html</a></div>
<div><br>
</div>
<div>Thanks,</div>
<div>Ilia</div>
<div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Dec 16, 2014 at 7:02 PM, Ilia K <span dir="ltr">
<<a href="mailto:ki.stfu@gmail.com" target="_blank">ki.stfu@gmail.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">
<div dir="ltr">Hello,
<div><br>
</div>
<div>>RE: <span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:18.2000007629395px">IOError may happen when child already exited but dotest has missed this and tries to exit using 'child.sendline("quit")'</span></div>
<div>Actually it's OSError (not IOError):</div>
<div><br>
</div>
<div>
<div>======================================================================</div>
<div>ERROR: test_lldbmi_tokens (TestMiSyntax.MiSyntaxTestCase)</div>
<div>   Test that 'lldb-mi --interpreter' echos command tokens.</div>
<div>----------------------------------------------------------------------</div>
<div>Traceback (most recent call last):</div>
<div>  File "/Users/IliaK/p/llvm_delphi/tools/lldb/test/lldbtest.py", line 1770, in tearDown</div>
<div>    Base.tearDown(self)</div>
<div>  File "/Users/IliaK/p/llvm_delphi/tools/lldb/test/lldbtest.py", line 1092, in tearDown</div>
<div>    self.deletePexpectChild()</div>
<div>  File "/Users/IliaK/p/llvm_delphi/tools/lldb/test/lldbtest.py", line 1074, in deletePexpectChild</div>
<div>    self.child.sendline('settings set interpreter.prompt-on-quit false')</div>
<div>  File "/Users/IliaK/p/llvm_delphi/tools/lldb/test/pexpect-2.4/pexpect.py", line 966, in sendline</div>
<div>    n = self.send(s)</div>
<div>  File "/Users/IliaK/p/llvm_delphi/tools/lldb/test/pexpect-2.4/pexpect.py", line 958, in send</div>
<div>    c = os.write(self.child_fd, s)</div>
<div>OSError: [Errno 5] Input/output error</div>
<div>Config=x86_64-clang</div>
</div>
<div><br>
</div>
<div>Therefore I updated lldbtest_ignore_ioerror_on_theardown.patch file.</div>
<div>Btw, may be better to filter only IO errors from OSError class? It'll look like:</div>
<div><br>
</div>
<div>{code}</div>
<div>try:</div>
<div>    ...</div>
<div>except (ValueError, pexpect.ExceptionPexpect):</div>
<div>    # child is already terminated</div>
<div>    pass</div>
<div>except OSError, e:</div>
<div>    if <span style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;white-space:inherit;color:rgb(0,0,0);font-size:14px;line-height:17.8048000335693px;margin:0px;padding:0px;border:0px;vertical-align:baseline;background:transparent">e</span><span style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;white-space:inherit;color:rgb(0,0,0);font-size:14px;line-height:17.8048000335693px;margin:0px;padding:0px;border:0px;vertical-align:baseline;background:transparent">.</span><span style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;white-space:inherit;color:rgb(0,0,0);font-size:14px;line-height:17.8048000335693px;margin:0px;padding:0px;border:0px;vertical-align:baseline;background:transparent">errno
 !</span><span style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;white-space:inherit;color:rgb(0,0,0);font-size:14px;line-height:17.8048000335693px;margin:0px;padding:0px;border:0px;vertical-align:baseline;background:transparent">=</span><span style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;white-space:inherit;color:rgb(0,0,0);font-size:14px;line-height:17.8048000335693px;margin:0px;padding:0px;border:0px;vertical-align:baseline;background:transparent">
 errno</span><span style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;white-space:inherit;color:rgb(0,0,0);font-size:14px;line-height:17.8048000335693px;margin:0px;padding:0px;border:0px;vertical-align:baseline;background:transparent">.</span><span style="font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;white-space:inherit;color:rgb(0,0,0);font-size:14px;line-height:17.8048000335693px;margin:0px;padding:0px;border:0px;vertical-align:baseline;background:transparent">EIO:</span></div>
<div>        # unexpected exception</div>
<div>        raise</div>
<div>
<div>    # child is already terminated</div>
</div>
<div>    pass</div>
<div>finally:</div>
<div>    ...</div>
<div>{code}</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Ilia</div>
<div><br>
</div>
</div>
<div>
<div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Dec 16, 2014 at 4:42 PM, Ilia K <span dir="ltr">
<<a href="mailto:ki.stfu@gmail.com" target="_blank">ki.stfu@gmail.com</a>></span> wrote:
<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">
<div dir="ltr">Hello,
<div><br>
</div>
<div>I found the following:</div>
<div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:18.2000007629395px">IOError may happen when child already exited but dotest has missed this and tries to exit using 'child.sendline("quit")'</span><br>
</div>
<div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:18.2000007629395px"><br>
</span></div>
<div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:18.2000007629395px">Also, I clean syntax test. -exec-run no hangs more and 'quit' isn't needed at exit.</span></div>
<div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:18.2000007629395px"><br>
</span></div>
<div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:18.2000007629395px">Thanks,</span></div>
<div><span style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px;line-height:18.2000007629395px">Ilia</span></div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div></div></div>
</div>
</div>
</div>

</blockquote></div><br></div>