[Lldb-commits] [lldb] r175844 - Make the lldbtest tear down routine a little less error prone

Daniel Malea daniel.malea at intel.com
Thu Feb 21 16:41:26 PST 2013


Author: dmalea
Date: Thu Feb 21 18:41:26 2013
New Revision: 175844

URL: http://llvm.org/viewvc/llvm-project?rev=175844&view=rev
Log:
Make the lldbtest tear down routine a little less error prone
- replace "catch-all" except clause with one that specifically catches what pexpect throws
- handle case where child is already terminated (or is terminating) by the time tear-down is run


Modified:
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=175844&r1=175843&r2=175844&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu Feb 21 18:41:26 2013
@@ -777,15 +777,17 @@ class Base(unittest2.TestCase):
         if self.child and self.child.isalive():
             with recording(self, traceAlways) as sbuf:
                 print >> sbuf, "tearing down the child process...."
-            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')
             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:
+            except ValueError, ExceptionPexpect:
+                # child is already terminated
                 pass
+
             # Give it one final blow to make sure the child is terminated.
             self.child.close()
 





More information about the lldb-commits mailing list