summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2020-06-03 09:29:55 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-06-18 12:25:00 +0100
commitc86541277ef3cd4782ff7599d921c36a1a09a3f4 (patch)
tree14c29541363dbd447e9ff92a157a367b0435b180
parent756f6d0fe98596c949d1f70a7999ce1a5844ba55 (diff)
downloadpoky-c86541277ef3cd4782ff7599d921c36a1a09a3f4.tar.gz
oeqa/targetcontrol: Rework exception handling to avoid warnings
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. (From OE-Core rev: bd2d32903f208b6a70abaa29b980db1498b84a02) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit ee707090848d793e3b2d82dd3861ae22222682c0) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/targetcontrol.py5
-rw-r--r--meta/lib/oeqa/utils/commands.py5
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):
182 return self.runner.is_alive() 182 return self.runner.is_alive()
183 183
184 def stop(self): 184 def stop(self):
185 self.runner.stop() 185 try:
186 self.runner.stop()
187 except:
188 pass
186 self.logger.removeHandler(self.loggerhandler) 189 self.logger.removeHandler(self.loggerhandler)
187 self.connection = None 190 self.connection = None
188 self.ip = None 191 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,
351 351
352 finally: 352 finally:
353 targetlogger.removeHandler(handler) 353 targetlogger.removeHandler(handler)
354 try: 354 qemu.stop()
355 qemu.stop()
356 except:
357 pass
358 355
359def updateEnv(env_file): 356def updateEnv(env_file):
360 """ 357 """