diff mbox series

[05/16] tests: qga has virtio-serial by default when host has it

Message ID 20200828110734.1638685-6-marcandre.lureau@redhat.com (mailing list archive)
State New, archived
Headers show
Series meson: convert unit tests in tests/Makefile.include | expand

Commit Message

Marc-André Lureau Aug. 28, 2020, 11:07 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

When dumping the default configuration, don't expect virtio-serial as
the configured method, unless the host has CONFIG_VIRTIO_SERIAL.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/test-qga.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Thomas Huth Aug. 28, 2020, 12:54 p.m. UTC | #1
On 28/08/2020 13.07, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> When dumping the default configuration, don't expect virtio-serial as
> the configured method, unless the host has CONFIG_VIRTIO_SERIAL.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  tests/test-qga.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/test-qga.c b/tests/test-qga.c
> index 4ac4c22109..122730d326 100644
> --- a/tests/test-qga.c
> +++ b/tests/test-qga.c
> @@ -728,10 +728,12 @@ static void test_qga_config(gconstpointer data)
>      g_assert_false(g_key_file_get_boolean(kf, "general", "daemon", &error));
>      g_assert_no_error(error);
>  
> +#ifdef CONFIG_VIRTIO_SERIAL
>      str = g_key_file_get_string(kf, "general", "method", &error);
>      g_assert_no_error(error);
>      g_assert_cmpstr(str, ==, "virtio-serial");
>      g_free(str);
> +#endif
>  
>      str = g_key_file_get_string(kf, "general", "path", &error);
>      g_assert_no_error(error);

Does this work as expected? I thought that CONFIG_VIRTIO_SERIAL is a
*target* specific config switch, not a host specific one ?

 Thomas
Marc-André Lureau Aug. 28, 2020, 1:47 p.m. UTC | #2
Hi

On Fri, Aug 28, 2020 at 4:55 PM Thomas Huth <thuth@redhat.com> wrote:
>
> On 28/08/2020 13.07, marcandre.lureau@redhat.com wrote:
> > From: Marc-André Lureau <marcandre.lureau@redhat.com>
> >
> > When dumping the default configuration, don't expect virtio-serial as
> > the configured method, unless the host has CONFIG_VIRTIO_SERIAL.
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  tests/test-qga.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/tests/test-qga.c b/tests/test-qga.c
> > index 4ac4c22109..122730d326 100644
> > --- a/tests/test-qga.c
> > +++ b/tests/test-qga.c
> > @@ -728,10 +728,12 @@ static void test_qga_config(gconstpointer data)
> >      g_assert_false(g_key_file_get_boolean(kf, "general", "daemon", &error));
> >      g_assert_no_error(error);
> >
> > +#ifdef CONFIG_VIRTIO_SERIAL
> >      str = g_key_file_get_string(kf, "general", "method", &error);
> >      g_assert_no_error(error);
> >      g_assert_cmpstr(str, ==, "virtio-serial");
> >      g_free(str);
> > +#endif
> >
> >      str = g_key_file_get_string(kf, "general", "path", &error);
> >      g_assert_no_error(error);
>
> Does this work as expected? I thought that CONFIG_VIRTIO_SERIAL is a
> *target* specific config switch, not a host specific one ?

You are right, it's basically dead code then. I'll drop this patch for
now, or come up with something better. It was from an earlier attempt
where test-qga was running under !linux. I will try that again.
diff mbox series

Patch

diff --git a/tests/test-qga.c b/tests/test-qga.c
index 4ac4c22109..122730d326 100644
--- a/tests/test-qga.c
+++ b/tests/test-qga.c
@@ -728,10 +728,12 @@  static void test_qga_config(gconstpointer data)
     g_assert_false(g_key_file_get_boolean(kf, "general", "daemon", &error));
     g_assert_no_error(error);
 
+#ifdef CONFIG_VIRTIO_SERIAL
     str = g_key_file_get_string(kf, "general", "method", &error);
     g_assert_no_error(error);
     g_assert_cmpstr(str, ==, "virtio-serial");
     g_free(str);
+#endif
 
     str = g_key_file_get_string(kf, "general", "path", &error);
     g_assert_no_error(error);