From: Michael Goldish <mgoldish@redhat.com>
To: Lucas Meneghel Rodrigues <lmr@redhat.com>
Cc: Feng Yang <fyang@redhat.com>,
autotest@test.kernel.org, kvm@vger.kernel.org
Subject: Re: [Autotest] [PATCH 1/2] KVM Test: Update cmd() help function in kvm_monitor.py to support parameters.
Date: Tue, 13 Jul 2010 00:21:50 +0300 [thread overview]
Message-ID: <4C3B876E.2030306@redhat.com> (raw)
In-Reply-To: <1278964675.2584.16.camel@freedom>
On 07/12/2010 10:57 PM, Lucas Meneghel Rodrigues wrote:
> On Mon, 2010-06-28 at 05:43 -0400, Feng Yang wrote:
>> ----- "Michael Goldish" <mgoldish@redhat.com> wrote:
>>> Why not add a wrapper for the command you're interested in?
>>> If we do it your way, a test that uses cmd() with parameters will
>>> have
>>> to handle the human case and the QMP case separately. For example, if
>>> a
>>> human monitor is used the test will have to use
>>>
>>> vm.monitor.cmd("screendump scr.ppm")
>>>
>>> and if QMP is used the test will have to use
>>>
>>> vm.monitor.cmd("screendump filename=scr.ppm").
>>>
>>> but if we use a wrapper,
>>>
>>> vm.monitor.screendump("scr.ppm")
>>>
>>> will work in both cases.
>> Thanks for your command.
>>
>> But in your way, we will have to add wrapper function for every command. I think a general function to run all qmp command during test script design is must. Or It is difficult to design a common process to test all qmp command.
>>
>> I still think make cmd command support parameters is better. Even we have to handle the human case and the QMP case separately.
>
> I've thought about what would be the best approach in this situation,
> and here are my findings:
>
> * Wrappers are nice, but indeed a systematic test of all monitor
> commands would be made unnecessarily complicated, since not all
> functions have enough usage to justify a separate wrapper for them.
>
> * On the other hand, it also sucks having to handle qmp and human
> monitor separately.
>
> It seems a reasonable alternative to implement the cmd() method in a way
> that it picks **kwargs and then passes the appropriate params to the
> underlying monitor. For example:
>
> vm.monitor.cmd(command="screendump", filename="scr.ppm")
>
> Would pass "screendump scr.ppm" to a human monitor, and "screendump
> filename=scr.ppm" to a qmp monitor (we'd just have slightly different
> implementations that handle the same **kwargs differently for each type
> of monitor).
>
> What do you guys think?
Human monitor commands that take more than a single parameter will have
a problem because dicts (kwargs) are unordered, while human monitor
parameters are.
We could use a string like Feng Yang suggested both for QMP and the
human monitor. In the human monitor case we'll just have to ignore the
keys and consider only the values in the order provided. However, that
will only work for some of the commands. What do we do about commands
like migrate which takes a -d flag?
The way I see it, the solution is either wrappers, or separate cmd()
syntaxes for the human monitor and QMP. The QMP cmd() will take kwargs
(e.g. cmd(command="screendump", filename="scr.ppm")), and the human
cmd() will remain as it is today.
next prev parent reply other threads:[~2010-07-12 21:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1694826070.970971277718187040.JavaMail.root@zmail04.collab.prod.int.phx2.redhat.com>
2010-06-28 9:43 ` [PATCH 1/2] KVM Test: Update cmd() help function in kvm_monitor.py to support parameters Feng Yang
2010-07-12 19:57 ` [Autotest] " Lucas Meneghel Rodrigues
2010-07-12 21:21 ` Michael Goldish [this message]
2010-06-28 7:45 Feng Yang
2010-06-28 9:18 ` [Autotest] " Michael Goldish
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C3B876E.2030306@redhat.com \
--to=mgoldish@redhat.com \
--cc=autotest@test.kernel.org \
--cc=fyang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=lmr@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox