[libvirt] [PATCH for 4.6.0] tests: qemucapsprobe: Fix output after swithching to jansson

Peter Krempa posted 1 patch 5 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/23a971330463438e6c1715f84efb21c8d78c637b.1532962653.git.pkrempa@redhat.com
Test syntax-check passed
tests/qemucapsprobemock.c | 2 ++
1 file changed, 2 insertions(+)
[libvirt] [PATCH for 4.6.0] tests: qemucapsprobe: Fix output after swithching to jansson
Posted by Peter Krempa 5 years, 8 months ago
Jansson does not put a newline at the end of formatted JSON strings.
This breaks the qemucapsprobe utility as we need to keep the spacing so
that tests work. Add an explicit newline.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 tests/qemucapsprobemock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/qemucapsprobemock.c b/tests/qemucapsprobemock.c
index 5936975505..049b16273a 100644
--- a/tests/qemucapsprobemock.c
+++ b/tests/qemucapsprobemock.c
@@ -76,6 +76,7 @@ qemuMonitorSend(qemuMonitorPtr mon,
         printLineSkipEmpty("\n", stdout);

     printLineSkipEmpty(reformatted, stdout);
+    printLineSkipEmpty("\n", stdout);
     VIR_FREE(reformatted);

     return realQemuMonitorSend(mon, msg);
@@ -116,6 +117,7 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon,
             printLineSkipEmpty("\n", stdout);

         printLineSkipEmpty(json, stdout);
+        printLineSkipEmpty("\n", stdout);
     }

  cleanup:
-- 
2.16.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH for 4.6.0] tests: qemucapsprobe: Fix output after swithching to jansson
Posted by Ján Tomko 5 years, 8 months ago
On Mon, Jul 30, 2018 at 04:59:34PM +0200, Peter Krempa wrote:
>Jansson does not put a newline at the end of formatted JSON strings.
>This breaks the qemucapsprobe utility as we need to keep the spacing so
>that tests work. Add an explicit newline.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> tests/qemucapsprobemock.c | 2 ++
> 1 file changed, 2 insertions(+)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH for 4.6.0] tests: qemucapsprobe: Fix output after swithching to jansson
Posted by Yi Min Zhao 5 years, 8 months ago

在 2018/7/30 下午11:12, Peter Krempa 写道:
> Jansson does not put a newline at the end of formatted JSON strings.
> This breaks the qemucapsprobe utility as we need to keep the spacing so
> that tests work. Add an explicit newline.
>
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>   tests/qemucapsprobemock.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/tests/qemucapsprobemock.c b/tests/qemucapsprobemock.c
> index 5936975505..049b16273a 100644
> --- a/tests/qemucapsprobemock.c
> +++ b/tests/qemucapsprobemock.c
> @@ -76,6 +76,7 @@ qemuMonitorSend(qemuMonitorPtr mon,
>           printLineSkipEmpty("\n", stdout);
>
>       printLineSkipEmpty(reformatted, stdout);
> +    printLineSkipEmpty("\n", stdout);
>       VIR_FREE(reformatted);
>
>       return realQemuMonitorSend(mon, msg);
> @@ -116,6 +117,7 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon,
>               printLineSkipEmpty("\n", stdout);
>
>           printLineSkipEmpty(json, stdout);
> +        printLineSkipEmpty("\n", stdout);
>       }
>
>    cleanup:
I have a question. Could this problem(I mean miss \n) trigger 
qemuxml2*test can't run?

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH for 4.6.0] tests: qemucapsprobe: Fix output after swithching to jansson
Posted by Peter Krempa 5 years, 8 months ago
On Tue, Jul 31, 2018 at 17:42:50 +0800, Yi Min Zhao wrote:
> 
> 
> 在 2018/7/30 下午11:12, Peter Krempa 写道:
> > Jansson does not put a newline at the end of formatted JSON strings.
> > This breaks the qemucapsprobe utility as we need to keep the spacing so
> > that tests work. Add an explicit newline.
> > 
> > Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> > ---
> >   tests/qemucapsprobemock.c | 2 ++
> >   1 file changed, 2 insertions(+)
> > 
> > diff --git a/tests/qemucapsprobemock.c b/tests/qemucapsprobemock.c
> > index 5936975505..049b16273a 100644
> > --- a/tests/qemucapsprobemock.c
> > +++ b/tests/qemucapsprobemock.c
> > @@ -76,6 +76,7 @@ qemuMonitorSend(qemuMonitorPtr mon,
> >           printLineSkipEmpty("\n", stdout);
> > 
> >       printLineSkipEmpty(reformatted, stdout);
> > +    printLineSkipEmpty("\n", stdout);
> >       VIR_FREE(reformatted);
> > 
> >       return realQemuMonitorSend(mon, msg);
> > @@ -116,6 +117,7 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon,
> >               printLineSkipEmpty("\n", stdout);
> > 
> >           printLineSkipEmpty(json, stdout);
> > +        printLineSkipEmpty("\n", stdout);
> >       }
> > 
> >    cleanup:
> I have a question. Could this problem(I mean miss \n) trigger qemuxml2*test
> can't run?

No. This tool is used to generate the data for the qemucapabilitiestest and
only manually so unless you are gathering new qemu caps testing data
that binary is not even run.

> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH for 4.6.0] tests: qemucapsprobe: Fix output after swithching to jansson
Posted by Peter Krempa 5 years, 8 months ago
On Mon, Jul 30, 2018 at 16:59:34 +0200, Peter Krempa wrote:
> Jansson does not put a newline at the end of formatted JSON strings.
> This breaks the qemucapsprobe utility as we need to keep the spacing so
> that tests work. Add an explicit newline.
> 
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  tests/qemucapsprobemock.c | 2 ++
>  1 file changed, 2 insertions(+)

Since we are going ahead with using jansson in libvirt this patch should
be included in the release for completness.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH for 4.6.0] tests: qemucapsprobe: Fix output after swithching to jansson
Posted by Michal Privoznik 5 years, 8 months ago
On 07/30/2018 04:59 PM, Peter Krempa wrote:
> Jansson does not put a newline at the end of formatted JSON strings.
> This breaks the qemucapsprobe utility as we need to keep the spacing so
> that tests work. Add an explicit newline.
> 
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  tests/qemucapsprobemock.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/qemucapsprobemock.c b/tests/qemucapsprobemock.c
> index 5936975505..049b16273a 100644
> --- a/tests/qemucapsprobemock.c
> +++ b/tests/qemucapsprobemock.c
> @@ -76,6 +76,7 @@ qemuMonitorSend(qemuMonitorPtr mon,
>          printLineSkipEmpty("\n", stdout);
> 
>      printLineSkipEmpty(reformatted, stdout);
> +    printLineSkipEmpty("\n", stdout);
>      VIR_FREE(reformatted);
> 
>      return realQemuMonitorSend(mon, msg);
> @@ -116,6 +117,7 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon,
>              printLineSkipEmpty("\n", stdout);
> 
>          printLineSkipEmpty(json, stdout);
> +        printLineSkipEmpty("\n", stdout);
>      }
> 
>   cleanup:
> 

ACK and SFF.

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list