diff mbox series

[RFC,11/18] qemu.py: Log crashes inside _post_shutdown()

Message ID 20180329213857.15499-12-ehabkost@redhat.com
State New
Headers show
Series QEMU validator: A method to specify QEMU crash-test cases | expand

Commit Message

Eduardo Habkost March 29, 2018, 9:38 p.m. UTC
This will allow us to log QEMU crashes even if the test code uses
.wait() instead of .shutdown().

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 scripts/qemu.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Philippe Mathieu-Daudé April 4, 2018, 8:29 a.m. UTC | #1
On 03/29/2018 06:38 PM, Eduardo Habkost wrote:
> This will allow us to log QEMU crashes even if the test code uses
> .wait() instead of .shutdown().
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  scripts/qemu.py | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/scripts/qemu.py b/scripts/qemu.py
> index 226d2c4d48..e19e4b34d0 100644
> --- a/scripts/qemu.py
> +++ b/scripts/qemu.py
> @@ -225,6 +225,15 @@ class QEMUMachine(object):
>              shutil.rmtree(self._temp_dir)
>              self._temp_dir = None
>  
> +        exitcode = self.exitcode()
> +        if exitcode is not None and exitcode < 0:
> +            msg = 'qemu received signal %i: %s'
> +            if self._qemu_full_args:
> +                command = ' '.join(self._qemu_full_args)
> +            else:
> +                command = ''
> +            LOG.warn(msg, exitcode, command)
> +
>          self._launched = False
>  
>      def launch(self):
> @@ -279,15 +288,6 @@ class QEMUMachine(object):
>  
>          self.wait()
>  
> -        exitcode = self.exitcode()
> -        if exitcode is not None and exitcode < 0:
> -            msg = 'qemu received signal %i: %s'
> -            if self._qemu_full_args:
> -                command = ' '.join(self._qemu_full_args)
> -            else:
> -                command = ''
> -            LOG.warn(msg, exitcode, command)
> -
>      def qmp(self, cmd, conv_keys=True, **args):
>          '''Invoke a QMP command and return the response dict'''
>          qmp_args = dict()
>
diff mbox series

Patch

diff --git a/scripts/qemu.py b/scripts/qemu.py
index 226d2c4d48..e19e4b34d0 100644
--- a/scripts/qemu.py
+++ b/scripts/qemu.py
@@ -225,6 +225,15 @@  class QEMUMachine(object):
             shutil.rmtree(self._temp_dir)
             self._temp_dir = None
 
+        exitcode = self.exitcode()
+        if exitcode is not None and exitcode < 0:
+            msg = 'qemu received signal %i: %s'
+            if self._qemu_full_args:
+                command = ' '.join(self._qemu_full_args)
+            else:
+                command = ''
+            LOG.warn(msg, exitcode, command)
+
         self._launched = False
 
     def launch(self):
@@ -279,15 +288,6 @@  class QEMUMachine(object):
 
         self.wait()
 
-        exitcode = self.exitcode()
-        if exitcode is not None and exitcode < 0:
-            msg = 'qemu received signal %i: %s'
-            if self._qemu_full_args:
-                command = ' '.join(self._qemu_full_args)
-            else:
-                command = ''
-            LOG.warn(msg, exitcode, command)
-
     def qmp(self, cmd, conv_keys=True, **args):
         '''Invoke a QMP command and return the response dict'''
         qmp_args = dict()