From: Richard Purdie <[email protected]>

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 <[email protected]>
(cherry picked from commit ee707090848d793e3b2d82dd3861ae22222682c0)
Signed-off-by: Steve Sakoman <[email protected]>
---
 meta/lib/oeqa/targetcontrol.py  | 5 ++++-
 meta/lib/oeqa/utils/commands.py | 5 +----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index 2aa548e1ad..7bbba6016b 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -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
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index f1679875dc..df373c4169 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -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):
     """
-- 
2.17.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#139522): 
https://lists.openembedded.org/g/openembedded-core/message/139522
Mute This Topic: https://lists.openembedded.org/mt/74902434/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to