[Lldb-commits] [PATCH] Ignore IOError from missing child.log.

Ilia K ki.stfu at gmail.com
Mon Apr 6 11:13:16 PDT 2015


lgtm


================
Comment at: test/tools/lldb-mi/lldbmi_testcase.py:28-31
@@ -27,3 +27,6 @@
             print "\n\nContents of %s:" % self.mylog
-            print open(self.mylog, "r").read()
+            try:
+                print open(self.mylog, "r").read()
+            except IOError:
+                pass
         Base.tearDown(self)
----------------
chaoren wrote:
> ki.stfu wrote:
> > I'd prefer to not use exceptions where it's not needed. Can we change it to the following?
> > ```
> > import os.path
> > if os.path.exists(self.mylog):
> >     print open(self.mylog, "r").read()
> > ```
> I thought EAFP is the preferred way to do things in python?
> 
> http://en.wikibooks.org/wiki/Python_Programming/Idioms#Principles
> 
> It's also possible for child.log to get removed (by another Mi test perhaps?) between the check and the read. 
>RE: I thought EAFP is the preferred way to do things in python?
ok.

>RE: It's also possible for child.log to get removed (by another Mi test perhaps?) between the check and the read.
No. The child.log is created in one folder with tests, but dosep.py doesn't start few processes to handle tests from the same folder.

http://reviews.llvm.org/D8843

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list