qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 10/36] test-qemu-opts: Test qemu_opts_to_qdic


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v2 10/36] test-qemu-opts: Test qemu_opts_to_qdict_filtered()
Date: Thu, 22 Feb 2018 10:50:42 +0100
User-agent: Mutt/1.9.1 (2017-09-22)

Am 21.02.2018 um 21:57 hat Eric Blake geschrieben:
> On 02/21/2018 07:53 AM, Kevin Wolf wrote:
> > Signed-off-by: Kevin Wolf <address@hidden>
> > ---
> >   tests/test-qemu-opts.c | 125 
> > +++++++++++++++++++++++++++++++++++++++++++++++++
> >   1 file changed, 125 insertions(+)
> > 
> > diff --git a/tests/test-qemu-opts.c b/tests/test-qemu-opts.c
> > index 6c3183390b..2c422abcd4 100644
> > --- a/tests/test-qemu-opts.c
> > +++ b/tests/test-qemu-opts.c
> > @@ -10,6 +10,7 @@
> >   #include "qemu/osdep.h"
> >   #include "qemu/cutils.h"
> >   #include "qemu/option.h"
> > +#include "qemu/option_int.h"
> >   #include "qapi/error.h"
> >   #include "qapi/qmp/qdict.h"
> >   #include "qapi/qmp/qstring.h"
> > @@ -868,6 +869,127 @@ static void test_opts_append(void)
> >       qemu_opts_free(merged);
> >   }
> > +static void test_opts_to_qdict_basic(void)
> > +{
> > +    QemuOpts *opts;
> > +    QDict *dict;
> > +
> > +    opts = qemu_opts_parse(&opts_list_01, 
> > "str1=foo,str2=,str3=bar,number1=42",
> > +                           false, &error_abort);
> 
> Worth any additional craziness in regards to our QemuOpts parsing, like
> str1=foo,,bar,str2... for an option containing commas, or str2=,str1=foo,
> for supplying options in a different order than the list?  But what you have
> is a good addition even if you don't tweak it.

This is not a test for parsing options string, but for converting an
already existing QemuOpts to a QDict. Parsing is already extensively
tested in /qemu-opts/opts_parse/*. I'm only using qemu_opts_parse() here
because it's the most convenient way to create a QemuOpts with multiple
options.

So the only things we need to consider in this test case are different
QemuOpts that result from the parsing. Escaped commas don't exist in
this representation any more and the associated QemuOptsList isn't
involved in the conversion to QDicts, so these wouldn't actually be new
cases for the thing we're testing here.

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]