This is an archive of the discontinued LLVM Phabricator instance.

Ignore IOError from missing child.log.
ClosedPublic

Authored by chaoren on Apr 6 2015, 10:06 AM.

Details

Summary

TestMiCliSupport (among other TestMi*) fails on Linux with

IOError: [Errno 2] No such file or directory: 'child.log'

Diff Detail

Repository
rL LLVM

Event Timeline

chaoren updated this revision to Diff 23279.Apr 6 2015, 10:06 AM
chaoren retitled this revision from to Ignore IOError from missing child.log..
chaoren updated this object.
chaoren edited the test plan for this revision. (Show Details)
chaoren added reviewers: clayborg, ki.stfu.
chaoren added a subscriber: Unknown Object (MLST).
ki.stfu added inline comments.Apr 6 2015, 10:39 AM
test/tools/lldb-mi/lldbmi_testcase.py
28–31 ↗(On Diff #23279)

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()
chaoren added inline comments.Apr 6 2015, 10:46 AM
test/tools/lldb-mi/lldbmi_testcase.py
28–31 ↗(On Diff #23279)

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.

ki.stfu accepted this revision.Apr 6 2015, 11:13 AM
ki.stfu edited edge metadata.

lgtm

test/tools/lldb-mi/lldbmi_testcase.py
28–31 ↗(On Diff #23279)

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.

This revision is now accepted and ready to land.Apr 6 2015, 11:13 AM
This revision was automatically updated to reflect the committed changes.
clayborg edited edge metadata.Apr 6 2015, 11:32 AM

Looks good. Or change to check if file exists first as one of the comments suggested..