qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qemu-iotests: Log QMP traffic in debug mode
@ 2016-08-23 14:46 Kevin Wolf
  2016-08-23 18:59 ` Eric Blake
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Wolf @ 2016-08-23 14:46 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

Python tests are already annoying enough to debug. With QMP traffic
available it's a little bit easier at least.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/iotests.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 03bccdd..3329bc1 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -50,6 +50,7 @@ cachemode = os.environ.get('CACHEMODE')
 qemu_default_machine = os.environ.get('QEMU_DEFAULT_MACHINE')
 
 socket_scm_helper = os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_helper')
+debug = False
 
 def qemu_img(*args):
     '''Run qemu-img and return the exit code'''
@@ -134,6 +135,8 @@ class VM(qtest.QEMUQtestMachine):
     def __init__(self):
         super(VM, self).__init__(qemu_prog, qemu_opts, test_dir=test_dir,
                                  socket_scm_helper=socket_scm_helper)
+        if debug:
+            self._debug = True
         self._num_drives = 0
 
     def add_device(self, opts):
@@ -323,6 +326,8 @@ def verify_quorum():
 def main(supported_fmts=[], supported_oses=['linux']):
     '''Run tests'''
 
+    global debug
+
     # We are using TEST_DIR and QEMU_DEFAULT_MACHINE as proxies to
     # indicate that we're not being run via "check". There may be
     # other things set up by "check" that individual test cases rely
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH] qemu-iotests: Log QMP traffic in debug mode
  2016-08-23 14:46 [Qemu-devel] [PATCH] qemu-iotests: Log QMP traffic in debug mode Kevin Wolf
@ 2016-08-23 18:59 ` Eric Blake
  2016-08-31 13:15   ` Kevin Wolf
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2016-08-23 18:59 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1653 bytes --]

On 08/23/2016 09:46 AM, Kevin Wolf wrote:
> Python tests are already annoying enough to debug. With QMP traffic
> available it's a little bit easier at least.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  tests/qemu-iotests/iotests.py | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index 03bccdd..3329bc1 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -50,6 +50,7 @@ cachemode = os.environ.get('CACHEMODE')
>  qemu_default_machine = os.environ.get('QEMU_DEFAULT_MACHINE')
>  
>  socket_scm_helper = os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_helper')
> +debug = False
>  
>  def qemu_img(*args):
>      '''Run qemu-img and return the exit code'''
> @@ -134,6 +135,8 @@ class VM(qtest.QEMUQtestMachine):
>      def __init__(self):
>          super(VM, self).__init__(qemu_prog, qemu_opts, test_dir=test_dir,
>                                   socket_scm_helper=socket_scm_helper)
> +        if debug:
> +            self._debug = True
>          self._num_drives = 0
>  

So we already had plumbing for debug...

>      def add_device(self, opts):
> @@ -323,6 +326,8 @@ def verify_quorum():
>  def main(supported_fmts=[], supported_oses=['linux']):
>      '''Run tests'''
>  
> +    global debug

...but just needed to turn it on?

At any rate, I agree that it is useful for figuring out when tests go
wrong, so:

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

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

* Re: [Qemu-devel] [PATCH] qemu-iotests: Log QMP traffic in debug mode
  2016-08-23 18:59 ` Eric Blake
@ 2016-08-31 13:15   ` Kevin Wolf
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2016-08-31 13:15 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-block, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1736 bytes --]

Am 23.08.2016 um 20:59 hat Eric Blake geschrieben:
> On 08/23/2016 09:46 AM, Kevin Wolf wrote:
> > Python tests are already annoying enough to debug. With QMP traffic
> > available it's a little bit easier at least.
> > 
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> >  tests/qemu-iotests/iotests.py | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> > index 03bccdd..3329bc1 100644
> > --- a/tests/qemu-iotests/iotests.py
> > +++ b/tests/qemu-iotests/iotests.py
> > @@ -50,6 +50,7 @@ cachemode = os.environ.get('CACHEMODE')
> >  qemu_default_machine = os.environ.get('QEMU_DEFAULT_MACHINE')
> >  
> >  socket_scm_helper = os.environ.get('SOCKET_SCM_HELPER', 'socket_scm_helper')
> > +debug = False
> >  
> >  def qemu_img(*args):
> >      '''Run qemu-img and return the exit code'''
> > @@ -134,6 +135,8 @@ class VM(qtest.QEMUQtestMachine):
> >      def __init__(self):
> >          super(VM, self).__init__(qemu_prog, qemu_opts, test_dir=test_dir,
> >                                   socket_scm_helper=socket_scm_helper)
> > +        if debug:
> > +            self._debug = True
> >          self._num_drives = 0
> >  
> 
> So we already had plumbing for debug...
> 
> >      def add_device(self, opts):
> > @@ -323,6 +326,8 @@ def verify_quorum():
> >  def main(supported_fmts=[], supported_oses=['linux']):
> >      '''Run tests'''
> >  
> > +    global debug
> 
> ...but just needed to turn it on?

Yes, the parent class already implements the logging. I guess this was
done in the context of some other scripts (maybe QMP shell?), so we just
have to reuse what's already there.

Kevin

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2016-08-31 13:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-23 14:46 [Qemu-devel] [PATCH] qemu-iotests: Log QMP traffic in debug mode Kevin Wolf
2016-08-23 18:59 ` Eric Blake
2016-08-31 13:15   ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).