All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Be sure to kill qemu-system on testimage
@ 2017-01-13 14:33 mariano.lopez
  2017-01-13 14:33 ` [PATCH 1/2] oeqa/utils/qemurunner.py: Add missing sys module mariano.lopez
  2017-01-13 14:33 ` [PATCH 2/2] oeqa/utils/qemurunner.py: Be sure to stop qemu-system mariano.lopez
  0 siblings, 2 replies; 3+ messages in thread
From: mariano.lopez @ 2017-01-13 14:33 UTC (permalink / raw)
  To: openembedded-core

From: Mariano Lopez <mariano.lopez@linux.intel.com>

With refactor of runqemu to use python instead of shel scripting,
the qemu-system process keeps running if runqemu fails. This series
will fix this and will terminate qemu-system explicity.

The following changes since commit 81021bc0aa0f64e67535f6a9551e921a64fe4395:

  yocto-project-qs, ref-manual: Added note for "resources temporarily unavailable" error (2017-01-11 17:23:18 +0000)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib mariano/qemu_fix
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=mariano/qemu_fix

Mariano Lopez (2):
  oeqa/utils/qemurunner.py: Add missing sys module
  oeqa/utils/qemurunner.py: Be sure to stop qemu-system

 meta/classes/testimage.bbclass    |  2 ++
 meta/lib/oeqa/utils/qemurunner.py | 10 ++++++++++
 2 files changed, 12 insertions(+)

-- 
2.6.6



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] oeqa/utils/qemurunner.py: Add missing sys module
  2017-01-13 14:33 [PATCH 0/2] Be sure to kill qemu-system on testimage mariano.lopez
@ 2017-01-13 14:33 ` mariano.lopez
  2017-01-13 14:33 ` [PATCH 2/2] oeqa/utils/qemurunner.py: Be sure to stop qemu-system mariano.lopez
  1 sibling, 0 replies; 3+ messages in thread
From: mariano.lopez @ 2017-01-13 14:33 UTC (permalink / raw)
  To: openembedded-core

From: Mariano Lopez <mariano.lopez@linux.intel.com>

This adds the missing sys module used by the child process
to exit. It seems the exception was cached in testimage and
selftest. It seems nobody noticed this because the module
is only used for sys.exit().

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
---
 meta/lib/oeqa/utils/qemurunner.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 8f1b5b9..6927456 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -7,6 +7,7 @@
 
 import subprocess
 import os
+import sys
 import time
 import signal
 import re
-- 
2.6.6



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] oeqa/utils/qemurunner.py: Be sure to stop qemu-system
  2017-01-13 14:33 [PATCH 0/2] Be sure to kill qemu-system on testimage mariano.lopez
  2017-01-13 14:33 ` [PATCH 1/2] oeqa/utils/qemurunner.py: Add missing sys module mariano.lopez
@ 2017-01-13 14:33 ` mariano.lopez
  1 sibling, 0 replies; 3+ messages in thread
From: mariano.lopez @ 2017-01-13 14:33 UTC (permalink / raw)
  To: openembedded-core

From: Mariano Lopez <mariano.lopez@linux.intel.com>

When runqemu fails, qemu-system process would keep running
and won't be killed, setpgrp() was used when runqemu was
a shell script but it seems it doesn't work always with python.

This would kill qemu-system explicity and to avoid leaving
it behind.

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
---
 meta/classes/testimage.bbclass    | 2 ++
 meta/lib/oeqa/utils/qemurunner.py | 9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass
index 770ec80..7eb4038 100644
--- a/meta/classes/testimage.bbclass
+++ b/meta/classes/testimage.bbclass
@@ -171,6 +171,8 @@ def testimage_main(d):
             bb.plain(msg)
         else:
             bb.fatal("%s - FAILED - check the task log and the ssh log" % pn)
+    except BlockingIOError as err:
+        bb.error('runqemu failed, shutting down...')
     finally:
         signal.signal(signal.SIGTERM, tc.origsigtermhandler)
         target.stop()
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 6927456..21bc35a 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -296,6 +296,7 @@ class QemuRunner:
 
     def stop(self):
         self.stop_thread()
+        self.stop_qemu_system()
         if hasattr(self, "origchldhandler"):
             signal.signal(signal.SIGCHLD, self.origchldhandler)
         if self.runqemu:
@@ -320,6 +321,14 @@ class QemuRunner:
         self.qemupid = None
         self.ip = None
 
+    def stop_qemu_system(self):
+        if self.qemupid:
+            try:
+                # qemu-system behaves well and a SIGTERM is enough
+                os.kill(self.qemupid, signal.SIGTERM)
+            except ProcessLookupError as e:
+                logger.warn('qemu-system ended unexpectedly')
+
     def stop_thread(self):
         if self.thread and self.thread.is_alive():
             self.thread.stop()
-- 
2.6.6



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-13 22:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 14:33 [PATCH 0/2] Be sure to kill qemu-system on testimage mariano.lopez
2017-01-13 14:33 ` [PATCH 1/2] oeqa/utils/qemurunner.py: Add missing sys module mariano.lopez
2017-01-13 14:33 ` [PATCH 2/2] oeqa/utils/qemurunner.py: Be sure to stop qemu-system mariano.lopez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.