[PATCH 58/60] tests/qtest: fix dbus-vmstate-test compilation

Marc-André Lureau posted 60 patches 2 weeks, 6 days ago
Maintainers: "Marc-André Lureau" <marcandre.lureau@redhat.com>, John Snow <jsnow@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Mauro Carvalho Chehab <mchehab+huawei@kernel.org>, Pierrick Bouvier <pierrick.bouvier@linaro.org>, Jan Kiszka <jan.kiszka@web.de>, Phil Dennis-Jordan <phil@philjordan.eu>, Richard Henderson <richard.henderson@linaro.org>, Helge Deller <deller@gmx.de>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Gerd Hoffmann <kraxel@redhat.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Samuel Tardieu <sam@rfc1149.net>, Igor Mitsyanko <i.mitsyanko@gmail.com>, "Hervé Poussineau" <hpoussin@reactos.org>, Aleksandar Rikalo <arikalo@gmail.com>, Laurent Vivier <laurent@vivier.eu>, Thomas Huth <th.huth+qemu@posteo.eu>, BALATON Zoltan <balaton@eik.bme.hu>, "Michael S. Tsirkin" <mst@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>, Dmitry Osipenko <dmitry.osipenko@collabora.com>, Dmitry Fleytman <dmitry.fleytman@gmail.com>, Stefano Stabellini <sstabellini@kernel.org>, Anthony PERARD <anthony@xenproject.org>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Alistair Francis <alistair@alistair23.me>, Alex Williamson <alex@shazbot.org>, "Cédric Le Goater" <clg@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Fabiano Rosas <farosas@suse.de>
[PATCH 58/60] tests/qtest: fix dbus-vmstate-test compilation
Posted by Marc-André Lureau 2 weeks, 6 days ago
The test is still disabled, and trying to compile it will fail now.

Fix it, and remove the G_TEST_DBUS_DAEMON setting, since it is passed by
meson test. Fwiw, the test passes here.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/qtest/dbus-vmstate-test.c | 11 ++---------
 tests/qtest/meson.build         |  3 ++-
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/tests/qtest/dbus-vmstate-test.c b/tests/qtest/dbus-vmstate-test.c
index 6c990864e3e..ed4a52d0255 100644
--- a/tests/qtest/dbus-vmstate-test.c
+++ b/tests/qtest/dbus-vmstate-test.c
@@ -3,7 +3,7 @@
 #include <gio/gio.h>
 #include "libqtest.h"
 #include "dbus-vmstate1.h"
-#include "migration-helpers.h"
+#include "migration/migration-qmp.h"
 
 static char *workdir;
 
@@ -229,7 +229,7 @@ test_dbus_vmstate(Test *test)
 
     thread = g_thread_new("dbus-vmstate-thread", dbus_vmstate_thread, loop);
 
-    migrate_qmp(src_qemu, uri, "{}");
+    migrate_qmp(src_qemu, dst_qemu, uri, NULL, "{}");
     test->src_qemu = src_qemu;
     if (test->migrate_fail) {
         wait_for_migration_fail(src_qemu, true);
@@ -342,15 +342,8 @@ int
 main(int argc, char **argv)
 {
     GError *err = NULL;
-    g_autofree char *dbus_daemon = NULL;
     int ret;
 
-    dbus_daemon = g_build_filename(G_STRINGIFY(SRCDIR),
-                                   "tests",
-                                   "dbus-vmstate-daemon.sh",
-                                   NULL);
-    g_setenv("G_TEST_DBUS_DAEMON", dbus_daemon, true);
-
     g_test_init(&argc, &argv, NULL);
 
     workdir = g_dir_make_tmp("dbus-vmstate-test-XXXXXX", &err);
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index b735f55fc40..5f8cff172c8 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -130,7 +130,8 @@ if dbus_daemon.found() and gdbus_codegen.found()
                                 input: meson.project_source_root() / 'backends/dbus-vmstate1.xml',
                                 command: [gdbus_codegen, '@INPUT@',
                                           '--interface-prefix', 'org.qemu',
-                                          '--generate-c-code', '@BASENAME@']).to_list()
+                                          '--generate-c-code', '@BASENAME@',
+                                          '--output-directory', meson.current_build_dir()]).to_list()
 else
   dbus_vmstate1 = []
 endif

-- 
2.53.0


Re: [PATCH 58/60] tests/qtest: fix dbus-vmstate-test compilation
Posted by Fabiano Rosas 2 weeks, 6 days ago
Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> The test is still disabled, and trying to compile it will fail now.
>
> Fix it, and remove the G_TEST_DBUS_DAEMON setting, since it is passed by
> meson test. Fwiw, the test passes here.
>

Hi, I have a series re-enabling this test and doing a few fixes, take a
look whether it helps you. I'm a bit short on time right now, but I
could rebase and post it after the freeze.

https://gitlab.com/farosas/qemu/-/commits/migration-test-dbus-vmstate?ref_type=heads

> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  tests/qtest/dbus-vmstate-test.c | 11 ++---------
>  tests/qtest/meson.build         |  3 ++-
>  2 files changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/tests/qtest/dbus-vmstate-test.c b/tests/qtest/dbus-vmstate-test.c
> index 6c990864e3e..ed4a52d0255 100644
> --- a/tests/qtest/dbus-vmstate-test.c
> +++ b/tests/qtest/dbus-vmstate-test.c
> @@ -3,7 +3,7 @@
>  #include <gio/gio.h>

I remember some CI job failed due to the test not declaring this
dependency.

>  #include "libqtest.h"
>  #include "dbus-vmstate1.h"
> -#include "migration-helpers.h"
> +#include "migration/migration-qmp.h"
>  
>  static char *workdir;
>  
> @@ -229,7 +229,7 @@ test_dbus_vmstate(Test *test)
>  
>      thread = g_thread_new("dbus-vmstate-thread", dbus_vmstate_thread, loop);
>  
> -    migrate_qmp(src_qemu, uri, "{}");
> +    migrate_qmp(src_qemu, dst_qemu, uri, NULL, "{}");

This works, however I have patches queued for the hardfreeze that change
some details in the migration tests infra:

- dst cmdline should use -incoming defer
- migrate_incoming_qmp needs to be called
- no more setting: qtest_set_expected_status(dst_qemu, EXIT_FAILURE);

>      test->src_qemu = src_qemu;
>      if (test->migrate_fail) {
>          wait_for_migration_fail(src_qemu, true);
> @@ -342,15 +342,8 @@ int
>  main(int argc, char **argv)
>  {
>      GError *err = NULL;
> -    g_autofree char *dbus_daemon = NULL;
>      int ret;
>  
> -    dbus_daemon = g_build_filename(G_STRINGIFY(SRCDIR),
> -                                   "tests",
> -                                   "dbus-vmstate-daemon.sh",
> -                                   NULL);
> -    g_setenv("G_TEST_DBUS_DAEMON", dbus_daemon, true);
> -
>      g_test_init(&argc, &argv, NULL);
>  
>      workdir = g_dir_make_tmp("dbus-vmstate-test-XXXXXX", &err);
> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> index b735f55fc40..5f8cff172c8 100644
> --- a/tests/qtest/meson.build
> +++ b/tests/qtest/meson.build
> @@ -130,7 +130,8 @@ if dbus_daemon.found() and gdbus_codegen.found()
>                                  input: meson.project_source_root() / 'backends/dbus-vmstate1.xml',
>                                  command: [gdbus_codegen, '@INPUT@',
>                                            '--interface-prefix', 'org.qemu',
> -                                          '--generate-c-code', '@BASENAME@']).to_list()
> +                                          '--generate-c-code', '@BASENAME@',
> +                                          '--output-directory', meson.current_build_dir()]).to_list()
>  else
>    dbus_vmstate1 = []
>  endif
Re: [PATCH 58/60] tests/qtest: fix dbus-vmstate-test compilation
Posted by Marc-André Lureau 2 weeks, 6 days ago
Hi

On Tue, Mar 17, 2026 at 4:29 PM Fabiano Rosas <farosas@suse.de> wrote:
>
> Marc-André Lureau <marcandre.lureau@redhat.com> writes:
>
> > The test is still disabled, and trying to compile it will fail now.
> >
> > Fix it, and remove the G_TEST_DBUS_DAEMON setting, since it is passed by
> > meson test. Fwiw, the test passes here.
> >
>
> Hi, I have a series re-enabling this test and doing a few fixes, take a
> look whether it helps you. I'm a bit short on time right now, but I
> could rebase and post it after the freeze.
>
> https://gitlab.com/farosas/qemu/-/commits/migration-test-dbus-vmstate?ref_type=heads

Ok, let's get your series merged first. This can indeed wait for the
freeze period, but feel free to send it and ping me!

thanks

>
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  tests/qtest/dbus-vmstate-test.c | 11 ++---------
> >  tests/qtest/meson.build         |  3 ++-
> >  2 files changed, 4 insertions(+), 10 deletions(-)
> >
> > diff --git a/tests/qtest/dbus-vmstate-test.c b/tests/qtest/dbus-vmstate-test.c
> > index 6c990864e3e..ed4a52d0255 100644
> > --- a/tests/qtest/dbus-vmstate-test.c
> > +++ b/tests/qtest/dbus-vmstate-test.c
> > @@ -3,7 +3,7 @@
> >  #include <gio/gio.h>
>
> I remember some CI job failed due to the test not declaring this
> dependency.
>
> >  #include "libqtest.h"
> >  #include "dbus-vmstate1.h"
> > -#include "migration-helpers.h"
> > +#include "migration/migration-qmp.h"
> >
> >  static char *workdir;
> >
> > @@ -229,7 +229,7 @@ test_dbus_vmstate(Test *test)
> >
> >      thread = g_thread_new("dbus-vmstate-thread", dbus_vmstate_thread, loop);
> >
> > -    migrate_qmp(src_qemu, uri, "{}");
> > +    migrate_qmp(src_qemu, dst_qemu, uri, NULL, "{}");
>
> This works, however I have patches queued for the hardfreeze that change
> some details in the migration tests infra:
>
> - dst cmdline should use -incoming defer
> - migrate_incoming_qmp needs to be called
> - no more setting: qtest_set_expected_status(dst_qemu, EXIT_FAILURE);
>
> >      test->src_qemu = src_qemu;
> >      if (test->migrate_fail) {
> >          wait_for_migration_fail(src_qemu, true);
> > @@ -342,15 +342,8 @@ int
> >  main(int argc, char **argv)
> >  {
> >      GError *err = NULL;
> > -    g_autofree char *dbus_daemon = NULL;
> >      int ret;
> >
> > -    dbus_daemon = g_build_filename(G_STRINGIFY(SRCDIR),
> > -                                   "tests",
> > -                                   "dbus-vmstate-daemon.sh",
> > -                                   NULL);
> > -    g_setenv("G_TEST_DBUS_DAEMON", dbus_daemon, true);
> > -
> >      g_test_init(&argc, &argv, NULL);
> >
> >      workdir = g_dir_make_tmp("dbus-vmstate-test-XXXXXX", &err);
> > diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> > index b735f55fc40..5f8cff172c8 100644
> > --- a/tests/qtest/meson.build
> > +++ b/tests/qtest/meson.build
> > @@ -130,7 +130,8 @@ if dbus_daemon.found() and gdbus_codegen.found()
> >                                  input: meson.project_source_root() / 'backends/dbus-vmstate1.xml',
> >                                  command: [gdbus_codegen, '@INPUT@',
> >                                            '--interface-prefix', 'org.qemu',
> > -                                          '--generate-c-code', '@BASENAME@']).to_list()
> > +                                          '--generate-c-code', '@BASENAME@',
> > +                                          '--output-directory', meson.current_build_dir()]).to_list()
> >  else
> >    dbus_vmstate1 = []
> >  endif
>


-- 
Marc-André Lureau