]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/targetcontrol: Attempt to fix log closure warning message
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 3 Jul 2020 10:29:43 +0000 (11:29 +0100)
committerSteve Sakoman <steve@sakoman.com>
Tue, 7 Jul 2020 00:33:20 +0000 (14:33 -1000)
We continue to see the warning message:

WARNING: lib/bb/daemonize.py:76: ResourceWarning: unclosed file <_io.TextIOWrapper
name='build/tmp/work/qemux86_64-poky-linux/oe-selftest-image/1.0-r0/testimage/qemurunner_log.20200703011821'
mode='a' encoding='UTF-8'>

I've been unable to reprodue this but believe its caused by garbage
collection of the FileHandler used in QemuTarget being delayed until
after a new tinfoil instance is created by a subseqent test.

Force the log file to be closed when we stop using it to avoid this.

[YOCTO #13961]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit e15cc7801ec611f867f5b31028741722ac718c87)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/lib/oeqa/targetcontrol.py

index 7bbba6016b29ae7a208be31cff2c80eaf8b3e9dc..19f5a4ea7e90480d704167bdf92bb23556fd4334 100644 (file)
@@ -187,6 +187,7 @@ class QemuTarget(BaseTarget):
         except:
             pass
         self.logger.removeHandler(self.loggerhandler)
+        self.loggerhandler.close()
         self.connection = None
         self.ip = None
         self.server_ip = None