oe-selftest: fix behaviour if oe-selftest.log is a dangling symlink

If you delete the log file that the oe-selftest.log symlink points to
but not the symlink itself, because we were using os.path.exists() here
the code assumed that the symlink didn't exist when in fact it still
did. Use os.path.lexists() instead.

(From OE-Core rev: 263af91a0efd21e041ecdb0c40f9b2d4e735f67d)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton 2016-12-22 16:13:57 +13:00 committed by Richard Purdie
parent 3f990e1b17
commit 0f315faff8
1 changed files with 2 additions and 1 deletions

View File

@ -62,7 +62,8 @@ log_prefix = "oe-selftest-" + t.strftime("%Y%m%d-%H%M%S")
def logger_create():
log_file = log_prefix + ".log"
if os.path.exists("oe-selftest.log"): os.remove("oe-selftest.log")
if os.path.lexists("oe-selftest.log"):
os.symlink(log_file, "oe-selftest.log")
log = logging.getLogger("selftest")