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

2018-02-22 Thread Max Reitz
On 2018-02-21 14:53, Kevin Wolf wrote:
> Signed-off-by: Kevin Wolf 
> ---
>  tests/test-qemu-opts.c | 125 
> +
>  1 file changed, 125 insertions(+)

Reviewed-by: Max Reitz 



signature.asc
Description: OpenPGP digital signature


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

2018-02-22 Thread Eric Blake

On 02/22/2018 03:50 AM, Kevin Wolf wrote:


+opts = qemu_opts_parse(_list_01, "str1=foo,str2=,str3=bar,number1=42",
+   false, _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.


Alright, you've convinced me that this isn't the test to be hammering on 
QemuOpts.


--
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



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

2018-02-22 Thread Kevin Wolf
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 
> > ---
> >   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(_list_01, 
> > "str1=foo,str2=,str3=bar,number1=42",
> > +   false, _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



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

2018-02-21 Thread Eric Blake

On 02/21/2018 07:53 AM, Kevin Wolf wrote:

Signed-off-by: Kevin Wolf 
---
  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(_list_01, "str1=foo,str2=,str3=bar,number1=42",
+   false, _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.


Reviewed-by: Eric Blake 

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org