<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><div> self.child.sendline('settings set interpreter.prompt-on-quit false')</div><div> self.child.sendline('quit')</div><div> self.child.expect(pexpect.EOF)</div><div> except (ValueError, OSError, pexpect.ExceptionPexpect):</div><div> # child is already terminated</div><div> pass</div><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 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 class="h5">
<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>