]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/targetcontrol: Rework exception handling to avoid warnings
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 3 Jun 2020 08:29:55 +0000 (09:29 +0100)
committerSteve Sakoman <steve@sakoman.com>
Tue, 9 Jun 2020 15:39:30 +0000 (05:39 -1000)
We're seeing:

WARNING: bitbake/lib/bb/cookerdata.py:136: ResourceWarning: unclosed file <_io.FileIO
name='tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0-r0/testimage/qemurunner_log.20200601181912'
mode='ab' closefd=True

which can only be caused by the qemu.stop() method not being called.
Tweak the error handling to fix the blanket exception handler which
is likely meaning this function isn't getting called.

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

index 2aa548e1ad28dab299d291ad640f3ae866792766..7bbba6016b29ae7a208be31cff2c80eaf8b3e9dc 100644 (file)
@@ -182,7 +182,10 @@ class QemuTarget(BaseTarget):
         return self.runner.is_alive()
 
     def stop(self):
-        self.runner.stop()
+        try:
+            self.runner.stop()
+        except:
+            pass
         self.logger.removeHandler(self.loggerhandler)
         self.connection = None
         self.ip = None
index f1679875dc2f3bee3ca75e7a2b50d62154185f13..df373c416963ba30464bd6d8e9c07d07481ae05e 100644 (file)
@@ -351,10 +351,7 @@ def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None,
 
     finally:
         targetlogger.removeHandler(handler)
-        try:
-            qemu.stop()
-        except:
-            pass
+        qemu.stop()
 
 def updateEnv(env_file):
     """