* [PULL 00/13] QTest patches for 2025-10-01
@ 2025-10-01 21:52 Fabiano Rosas
2025-10-01 21:52 ` [PULL 01/13] tests/qtest: Add missing checks for the availability of machines Fabiano Rosas
` (13 more replies)
0 siblings, 14 replies; 15+ messages in thread
From: Fabiano Rosas @ 2025-10-01 21:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson
The following changes since commit 29b77c1a2db2d796bc3847852a5c8dc2a1e6e83b:
Merge tag 'rust-ci-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging (2025-09-30 09:29:38 -0700)
are available in the Git repository at:
https://gitlab.com/farosas/qemu.git tags/qtest-20251001-pull-request
for you to fetch changes up to ca5be51a51fc6b6402838310ae8d0162fc03ecef:
migration-test: strv parameter (2025-10-01 17:09:23 -0300)
----------------------------------------------------------------
Qtest pull request
- Fix for qtest_get_machines QEMU var caching
- Fixes for migration-test in --without-default-devices build
- Preparation patches for cpr-exec test
----------------------------------------------------------------
Steve Sistare (11):
tests/qtest: optimize qtest_get_machines
tests/qtest: export qtest_qemu_binary
tests/qtest: qtest_qemu_args
tests/qtest: qtest_create_test_state
tests/qtest: qtest_qemu_spawn_func
tests/qtest: qtest_init_after_exec
migration-test: only_source option
migration-test: shm path accessor
migration-test: misc exports
migration-test: migrate_args
migration-test: strv parameter
Thomas Huth (2):
tests/qtest: Add missing checks for the availability of machines
tests/qtest/migration: Fix cpr-tests in case the machine is not
available
tests/qtest/bios-tables-test.c | 2 +-
tests/qtest/cpu-plug-test.c | 2 +-
tests/qtest/libqtest.c | 120 ++++++++++++++++++--------
tests/qtest/libqtest.h | 25 ++++++
tests/qtest/migration/bootfile.c | 5 ++
tests/qtest/migration/bootfile.h | 1 +
tests/qtest/migration/cpr-tests.c | 5 +-
tests/qtest/migration/framework.c | 107 +++++++++++++++--------
tests/qtest/migration/framework.h | 7 +-
tests/qtest/migration/migration-qmp.c | 16 ++++
tests/qtest/migration/migration-qmp.h | 2 +
tests/qtest/riscv-csr-test.c | 4 +-
12 files changed, 217 insertions(+), 79 deletions(-)
--
2.35.3
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PULL 01/13] tests/qtest: Add missing checks for the availability of machines
2025-10-01 21:52 [PULL 00/13] QTest patches for 2025-10-01 Fabiano Rosas
@ 2025-10-01 21:52 ` Fabiano Rosas
2025-10-01 21:52 ` [PULL 02/13] tests/qtest/migration: Fix cpr-tests in case the machine is not available Fabiano Rosas
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Fabiano Rosas @ 2025-10-01 21:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Thomas Huth
From: Thomas Huth <thuth@redhat.com>
When QEMU has been compiled with "--without-default-devices", the
machines might not be available in the binary. Let's properly check
for the machines before running the tests to avoid that they are
failing in this case.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250930090444.234431-1-thuth@redhat.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/bios-tables-test.c | 2 +-
tests/qtest/cpu-plug-test.c | 2 +-
tests/qtest/riscv-csr-test.c | 4 +++-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 4fa8ac5096..6b892ef23e 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -2864,7 +2864,7 @@ int main(int argc, char *argv[])
test_acpi_riscv64_virt_tcg_acpi_spcr);
}
} else if (strcmp(arch, "loongarch64") == 0) {
- if (has_tcg) {
+ if (has_tcg && qtest_has_machine("virt")) {
qtest_add_func("acpi/virt", test_acpi_loongarch64_virt);
qtest_add_func("acpi/virt/topology",
test_acpi_loongarch64_virt_topology);
diff --git a/tests/qtest/cpu-plug-test.c b/tests/qtest/cpu-plug-test.c
index 44d704680b..0aa4ccc5b6 100644
--- a/tests/qtest/cpu-plug-test.c
+++ b/tests/qtest/cpu-plug-test.c
@@ -190,7 +190,7 @@ int main(int argc, char **argv)
qtest_cb_for_every_machine(add_pseries_test_case, g_test_quick());
} else if (g_str_equal(arch, "s390x")) {
qtest_cb_for_every_machine(add_s390x_test_case, g_test_quick());
- } else if (g_str_equal(arch, "loongarch64")) {
+ } else if (g_str_equal(arch, "loongarch64") && qtest_has_machine("virt")) {
add_loongarch_test_case("virt");
}
diff --git a/tests/qtest/riscv-csr-test.c b/tests/qtest/riscv-csr-test.c
index ff5c29e6c6..bb1b0ffed3 100644
--- a/tests/qtest/riscv-csr-test.c
+++ b/tests/qtest/riscv-csr-test.c
@@ -50,7 +50,9 @@ int main(int argc, char **argv)
{
g_test_init(&argc, &argv, NULL);
- qtest_add_func("/cpu/csr", run_test_csr);
+ if (qtest_has_machine("virt")) {
+ qtest_add_func("/cpu/csr", run_test_csr);
+ }
return g_test_run();
}
--
2.35.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PULL 02/13] tests/qtest/migration: Fix cpr-tests in case the machine is not available
2025-10-01 21:52 [PULL 00/13] QTest patches for 2025-10-01 Fabiano Rosas
2025-10-01 21:52 ` [PULL 01/13] tests/qtest: Add missing checks for the availability of machines Fabiano Rosas
@ 2025-10-01 21:52 ` Fabiano Rosas
2025-10-01 21:52 ` [PULL 03/13] tests/qtest: optimize qtest_get_machines Fabiano Rosas
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Fabiano Rosas @ 2025-10-01 21:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Thomas Huth
From: Thomas Huth <thuth@redhat.com>
When QEMU has been compiled with "--without-default-devices", the
migration cpr-tests are currently failing since the first test leaves
a socket file behind that avoids that the second test can be initialized
correctly. Make sure that we delete the socket file in case that the
migrate_start() failed due to the missing machine.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250930090932.235151-1-thuth@redhat.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/migration/cpr-tests.c | 5 ++++-
tests/qtest/migration/framework.c | 6 ++++--
tests/qtest/migration/framework.h | 2 +-
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-tests.c
index 5e764a6787..c4ce60ff66 100644
--- a/tests/qtest/migration/cpr-tests.c
+++ b/tests/qtest/migration/cpr-tests.c
@@ -97,7 +97,10 @@ static void test_mode_transfer_common(bool incoming_defer)
.start_hook = test_mode_transfer_start,
};
- test_precopy_common(&args);
+ if (test_precopy_common(&args) < 0) {
+ close(cpr_sockfd);
+ unlink(cpr_path);
+ }
}
static void test_mode_transfer(void)
diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/framework.c
index 407c9023c0..a044b35465 100644
--- a/tests/qtest/migration/framework.c
+++ b/tests/qtest/migration/framework.c
@@ -736,7 +736,7 @@ void test_postcopy_recovery_common(MigrateCommon *args)
migrate_postcopy_complete(from, to, args);
}
-void test_precopy_common(MigrateCommon *args)
+int test_precopy_common(MigrateCommon *args)
{
QTestState *from, *to;
void *data_hook = NULL;
@@ -746,7 +746,7 @@ void test_precopy_common(MigrateCommon *args)
g_assert(!args->cpr_channel || args->connect_channels);
if (migrate_start(&from, &to, args->listen_uri, &args->start)) {
- return;
+ return -1;
}
if (args->start_hook) {
@@ -869,6 +869,8 @@ finish:
}
migrate_end(from, to, args->result == MIG_TEST_SUCCEED);
+
+ return 0;
}
static void file_dirty_offset_region(void)
diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/framework.h
index 01e425e64e..744040d53a 100644
--- a/tests/qtest/migration/framework.h
+++ b/tests/qtest/migration/framework.h
@@ -227,7 +227,7 @@ void migrate_end(QTestState *from, QTestState *to, bool test_dest);
void test_postcopy_common(MigrateCommon *args);
void test_postcopy_recovery_common(MigrateCommon *args);
-void test_precopy_common(MigrateCommon *args);
+int test_precopy_common(MigrateCommon *args);
void test_file_common(MigrateCommon *args, bool stop_src);
void *migrate_hook_start_precopy_tcp_multifd_common(QTestState *from,
QTestState *to,
--
2.35.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PULL 03/13] tests/qtest: optimize qtest_get_machines
2025-10-01 21:52 [PULL 00/13] QTest patches for 2025-10-01 Fabiano Rosas
2025-10-01 21:52 ` [PULL 01/13] tests/qtest: Add missing checks for the availability of machines Fabiano Rosas
2025-10-01 21:52 ` [PULL 02/13] tests/qtest/migration: Fix cpr-tests in case the machine is not available Fabiano Rosas
@ 2025-10-01 21:52 ` Fabiano Rosas
2025-10-01 21:52 ` [PULL 04/13] tests/qtest: export qtest_qemu_binary Fabiano Rosas
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Fabiano Rosas @ 2025-10-01 21:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Steve Sistare
From: Steve Sistare <steven.sistare@oracle.com>
qtest_get_machines returns the machines supported by the QEMU binary
described by an environment variable and caches the result. If the
next call to qtest_get_machines passes the same variable name, the cached
result is returned, but if the name changes, the caching is defeated.
To make caching more effective, remember the path of the QEMU binary
instead. Different env vars, eg QTEST_QEMU_BINARY_SRC and
QTEST_QEMU_BINARY_DST, usually resolve to the same path.
Before the optimization, the test /x86_64/migration/precopy/unix/plain
exec's QEMU and calls query-machines 3 times. After optimization, that
only happens once. This does not significantly speed up the tests, but
it reduces QTEST_LOG output, and launches fewer QEMU instances, making
it easier to debug problems.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Message-ID: <87h5ymdzrf.fsf@pond.sub.org>
Link: https://lore.kernel.org/qemu-devel/1758290310-349623-1-git-send-email-steven.sistare@oracle.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/libqtest.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 94526b7f9c..f3d4e0829a 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -1630,7 +1630,8 @@ static void qtest_free_machine_list(struct MachInfo *machines)
static struct MachInfo *qtest_get_machines(const char *var)
{
static struct MachInfo *machines;
- static char *qemu_var;
+ static char *qemu_bin;
+ const char *new_qemu_bin;
QDict *response, *minfo;
QList *list;
const QListEntry *p;
@@ -1639,9 +1640,10 @@ static struct MachInfo *qtest_get_machines(const char *var)
QTestState *qts;
int idx;
- if (g_strcmp0(qemu_var, var)) {
- g_free(qemu_var);
- qemu_var = g_strdup(var);
+ new_qemu_bin = qtest_qemu_binary(var);
+ if (g_strcmp0(qemu_bin, new_qemu_bin)) {
+ g_free(qemu_bin);
+ qemu_bin = g_strdup(new_qemu_bin);
/* new qemu, clear the cache */
qtest_free_machine_list(machines);
@@ -1654,7 +1656,7 @@ static struct MachInfo *qtest_get_machines(const char *var)
silence_spawn_log = !g_test_verbose();
- qts = qtest_init_ext(qemu_var, "-machine none", NULL, true);
+ qts = qtest_init_ext(var, "-machine none", NULL, true);
response = qtest_qmp(qts, "{ 'execute': 'query-machines' }");
g_assert(response);
list = qdict_get_qlist(response, "return");
--
2.35.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PULL 04/13] tests/qtest: export qtest_qemu_binary
2025-10-01 21:52 [PULL 00/13] QTest patches for 2025-10-01 Fabiano Rosas
` (2 preceding siblings ...)
2025-10-01 21:52 ` [PULL 03/13] tests/qtest: optimize qtest_get_machines Fabiano Rosas
@ 2025-10-01 21:52 ` Fabiano Rosas
2025-10-01 21:52 ` [PULL 05/13] tests/qtest: qtest_qemu_args Fabiano Rosas
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Fabiano Rosas @ 2025-10-01 21:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Steve Sistare
From: Steve Sistare <steven.sistare@oracle.com>
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/qemu-devel/1759332851-370353-10-git-send-email-steven.sistare@oracle.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/libqtest.c | 2 +-
tests/qtest/libqtest.h | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index f3d4e0829a..6f76be12a4 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -357,7 +357,7 @@ void qtest_remove_abrt_handler(void *data)
}
}
-static const char *qtest_qemu_binary(const char *var)
+const char *qtest_qemu_binary(const char *var)
{
const char *qemu_bin;
diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h
index fd27521a9c..dc2cdd0b60 100644
--- a/tests/qtest/libqtest.h
+++ b/tests/qtest/libqtest.h
@@ -47,6 +47,15 @@ QTestState *qtest_initf(const char *fmt, ...) G_GNUC_PRINTF(1, 2);
*/
QTestState *qtest_vinitf(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
+/**
+ * qtest_qemu_binary:
+ * @var: environment variable name
+ *
+ * Look up @var and return its value as the qemu binary path.
+ * If @var is NULL, look up the default var name.
+ */
+const char *qtest_qemu_binary(const char *var);
+
/**
* qtest_init:
* @extra_args: other arguments to pass to QEMU. CAUTION: these
--
2.35.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PULL 05/13] tests/qtest: qtest_qemu_args
2025-10-01 21:52 [PULL 00/13] QTest patches for 2025-10-01 Fabiano Rosas
` (3 preceding siblings ...)
2025-10-01 21:52 ` [PULL 04/13] tests/qtest: export qtest_qemu_binary Fabiano Rosas
@ 2025-10-01 21:52 ` Fabiano Rosas
2025-10-01 21:52 ` [PULL 06/13] tests/qtest: qtest_create_test_state Fabiano Rosas
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Fabiano Rosas @ 2025-10-01 21:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Steve Sistare
From: Steve Sistare <steven.sistare@oracle.com>
Define an accessor that returns all the arguments used to exec QEMU.
Collect the arguments that were passed to qtest_spawn_qemu, plus the trace
arguments that were composed inside qtest_spawn_qemu, and move them to a
new function qtest_qemu_args.
This will be needed to test the cpr-exec migration mode.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/qemu-devel/1759332851-370353-11-git-send-email-steven.sistare@oracle.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/libqtest.c | 54 ++++++++++++++++++++++++------------------
tests/qtest/libqtest.h | 8 +++++++
2 files changed, 39 insertions(+), 23 deletions(-)
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 6f76be12a4..551bc8c1b8 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -409,20 +409,12 @@ static pid_t qtest_create_process(char *cmd)
}
#endif /* _WIN32 */
-static QTestState *G_GNUC_PRINTF(2, 3) qtest_spawn_qemu(const char *qemu_bin,
- const char *fmt, ...)
+static QTestState *qtest_spawn_qemu(const char *qemu_bin, const char *args)
{
- va_list ap;
QTestState *s = g_new0(QTestState, 1);
- const char *trace = g_getenv("QTEST_TRACE");
- g_autofree char *tracearg = trace ?
- g_strdup_printf("-trace %s ", trace) : g_strdup("");
g_autoptr(GString) command = g_string_new("");
- va_start(ap, fmt);
- g_string_append_printf(command, CMD_EXEC "%s %s", qemu_bin, tracearg);
- g_string_append_vprintf(command, fmt, ap);
- va_end(ap);
+ g_string_printf(command, CMD_EXEC "%s %s", qemu_bin, args);
qtest_add_abrt_handler(kill_qemu_hook_func, s);
@@ -466,6 +458,33 @@ static char *qtest_socket_path(const char *suffix)
return g_strdup_printf("%s/qtest-%d.%s", g_get_tmp_dir(), getpid(), suffix);
}
+gchar *qtest_qemu_args(const char *extra_args)
+{
+ g_autofree gchar *socket_path = qtest_socket_path("sock");
+ g_autofree gchar *qmp_socket_path = qtest_socket_path("qmp");
+ const char *trace = g_getenv("QTEST_TRACE");
+ g_autofree char *tracearg = trace ? g_strdup_printf("-trace %s ", trace) :
+ g_strdup("");
+ gchar *args = g_strdup_printf(
+ "%s"
+ "-qtest unix:%s "
+ "-qtest-log %s "
+ "-chardev socket,path=%s,id=char0 "
+ "-mon chardev=char0,mode=control "
+ "-display none "
+ "-audio none "
+ "%s"
+ " -accel qtest",
+
+ tracearg,
+ socket_path,
+ getenv("QTEST_LOG") ? DEV_STDERR : DEV_NULL,
+ qmp_socket_path,
+ extra_args ?: "");
+
+ return args;
+}
+
static QTestState *qtest_init_internal(const char *qemu_bin,
const char *extra_args,
bool do_connect)
@@ -474,6 +493,7 @@ static QTestState *qtest_init_internal(const char *qemu_bin,
int sock, qmpsock, i;
g_autofree gchar *socket_path = qtest_socket_path("sock");
g_autofree gchar *qmp_socket_path = qtest_socket_path("qmp");
+ g_autofree gchar *args = qtest_qemu_args(extra_args);
/*
* It's possible that if an earlier test run crashed it might
@@ -488,19 +508,7 @@ static QTestState *qtest_init_internal(const char *qemu_bin,
sock = init_socket(socket_path);
qmpsock = init_socket(qmp_socket_path);
- s = qtest_spawn_qemu(qemu_bin,
- "-qtest unix:%s "
- "-qtest-log %s "
- "-chardev socket,path=%s,id=char0 "
- "-mon chardev=char0,mode=control "
- "-display none "
- "-audio none "
- "%s"
- " -accel qtest",
- socket_path,
- getenv("QTEST_LOG") ? DEV_STDERR : DEV_NULL,
- qmp_socket_path,
- extra_args ?: "");
+ s = qtest_spawn_qemu(qemu_bin, args);
qtest_client_set_rx_handler(s, qtest_client_socket_recv_line);
qtest_client_set_tx_handler(s, qtest_client_socket_send);
diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h
index dc2cdd0b60..7f8dd0a912 100644
--- a/tests/qtest/libqtest.h
+++ b/tests/qtest/libqtest.h
@@ -56,6 +56,14 @@ QTestState *qtest_vinitf(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
*/
const char *qtest_qemu_binary(const char *var);
+/**
+ * qtest_qemu_args:
+ * @extra_args: Other arguments to pass to QEMU.
+ *
+ * Return the command line used to start QEMU, sans binary.
+ */
+gchar *qtest_qemu_args(const char *extra_args);
+
/**
* qtest_init:
* @extra_args: other arguments to pass to QEMU. CAUTION: these
--
2.35.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PULL 06/13] tests/qtest: qtest_create_test_state
2025-10-01 21:52 [PULL 00/13] QTest patches for 2025-10-01 Fabiano Rosas
` (4 preceding siblings ...)
2025-10-01 21:52 ` [PULL 05/13] tests/qtest: qtest_qemu_args Fabiano Rosas
@ 2025-10-01 21:52 ` Fabiano Rosas
2025-10-01 21:52 ` [PULL 07/13] tests/qtest: qtest_qemu_spawn_func Fabiano Rosas
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Fabiano Rosas @ 2025-10-01 21:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Steve Sistare
From: Steve Sistare <steven.sistare@oracle.com>
Refactor qtest_spawn_qemu and create a subroutine to create a QTestState
object, to be used in a subsequent patch.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/qemu-devel/1759332851-370353-12-git-send-email-steven.sistare@oracle.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/libqtest.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 551bc8c1b8..3fa93172c1 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -409,22 +409,29 @@ static pid_t qtest_create_process(char *cmd)
}
#endif /* _WIN32 */
-static QTestState *qtest_spawn_qemu(const char *qemu_bin, const char *args)
+static QTestState *qtest_create_test_state(int pid)
{
QTestState *s = g_new0(QTestState, 1);
+
+ s->qemu_pid = pid;
+ qtest_add_abrt_handler(kill_qemu_hook_func, s);
+ return s;
+}
+
+static QTestState *qtest_spawn_qemu(const char *qemu_bin, const char *args)
+{
+ int pid;
g_autoptr(GString) command = g_string_new("");
g_string_printf(command, CMD_EXEC "%s %s", qemu_bin, args);
- qtest_add_abrt_handler(kill_qemu_hook_func, s);
-
if (!silence_spawn_log) {
g_test_message("starting QEMU: %s", command->str);
}
#ifndef _WIN32
- s->qemu_pid = fork();
- if (s->qemu_pid == 0) {
+ pid = fork();
+ if (pid == 0) {
#ifdef __linux__
/*
* Although we register a ABRT handler to kill off QEMU
@@ -447,10 +454,10 @@ static QTestState *qtest_spawn_qemu(const char *qemu_bin, const char *args)
exit(1);
}
#else
- s->qemu_pid = qtest_create_process(command->str);
+ pid = qtest_create_process(command->str);
#endif /* _WIN32 */
- return s;
+ return qtest_create_test_state(pid);
}
static char *qtest_socket_path(const char *suffix)
--
2.35.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PULL 07/13] tests/qtest: qtest_qemu_spawn_func
2025-10-01 21:52 [PULL 00/13] QTest patches for 2025-10-01 Fabiano Rosas
` (5 preceding siblings ...)
2025-10-01 21:52 ` [PULL 06/13] tests/qtest: qtest_create_test_state Fabiano Rosas
@ 2025-10-01 21:52 ` Fabiano Rosas
2025-10-01 21:52 ` [PULL 08/13] tests/qtest: qtest_init_after_exec Fabiano Rosas
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Fabiano Rosas @ 2025-10-01 21:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Steve Sistare
From: Steve Sistare <steven.sistare@oracle.com>
Allow the qtest_qemu_spawn caller to pass the function to be called
to perform the spawn. The opaque argument is needed by a new spawn
function in a subsequent patch.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/qemu-devel/1759332851-370353-13-git-send-email-steven.sistare@oracle.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/libqtest.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 3fa93172c1..d97144e1d5 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -418,7 +418,8 @@ static QTestState *qtest_create_test_state(int pid)
return s;
}
-static QTestState *qtest_spawn_qemu(const char *qemu_bin, const char *args)
+static QTestState *qtest_spawn_qemu(const char *qemu_bin, const char *args,
+ void *opaque)
{
int pid;
g_autoptr(GString) command = g_string_new("");
@@ -492,9 +493,15 @@ gchar *qtest_qemu_args(const char *extra_args)
return args;
}
+typedef QTestState *(*qtest_qemu_spawn_func)(const char *qemu_bin,
+ const char *extra_args,
+ void *opaque);
+
static QTestState *qtest_init_internal(const char *qemu_bin,
const char *extra_args,
- bool do_connect)
+ bool do_connect,
+ qtest_qemu_spawn_func spawn,
+ void *opaque)
{
QTestState *s;
int sock, qmpsock, i;
@@ -515,7 +522,7 @@ static QTestState *qtest_init_internal(const char *qemu_bin,
sock = init_socket(socket_path);
qmpsock = init_socket(qmp_socket_path);
- s = qtest_spawn_qemu(qemu_bin, args);
+ s = spawn(qemu_bin, args, opaque);
qtest_client_set_rx_handler(s, qtest_client_socket_recv_line);
qtest_client_set_tx_handler(s, qtest_client_socket_send);
@@ -570,7 +577,8 @@ void qtest_connect(QTestState *s)
QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
{
- return qtest_init_internal(qtest_qemu_binary(NULL), extra_args, true);
+ return qtest_init_internal(qtest_qemu_binary(NULL), extra_args, true,
+ qtest_spawn_qemu, NULL);
}
void qtest_qmp_handshake(QTestState *s, QList *capabilities)
@@ -593,7 +601,7 @@ QTestState *qtest_init_ext(const char *var, const char *extra_args,
QList *capabilities, bool do_connect)
{
QTestState *s = qtest_init_internal(qtest_qemu_binary(var), extra_args,
- do_connect);
+ do_connect, qtest_spawn_qemu, NULL);
if (do_connect) {
qtest_qmp_handshake(s, capabilities);
--
2.35.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PULL 08/13] tests/qtest: qtest_init_after_exec
2025-10-01 21:52 [PULL 00/13] QTest patches for 2025-10-01 Fabiano Rosas
` (6 preceding siblings ...)
2025-10-01 21:52 ` [PULL 07/13] tests/qtest: qtest_qemu_spawn_func Fabiano Rosas
@ 2025-10-01 21:52 ` Fabiano Rosas
2025-10-01 21:52 ` [PULL 09/13] migration-test: only_source option Fabiano Rosas
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Fabiano Rosas @ 2025-10-01 21:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Steve Sistare
From: Steve Sistare <steven.sistare@oracle.com>
Define a function to create a QTestState object representing the state
of QEMU after old QEMU exec's new QEMU. This is needed for testing
the cpr-exec migration mode.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/qemu-devel/1759332851-370353-14-git-send-email-steven.sistare@oracle.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/libqtest.c | 19 +++++++++++++++++++
tests/qtest/libqtest.h | 8 ++++++++
2 files changed, 27 insertions(+)
diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index d97144e1d5..933d085869 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -615,6 +615,25 @@ QTestState *qtest_init_ext(const char *var, const char *extra_args,
return s;
}
+static QTestState *qtest_attach_qemu(const char *qemu_bin,
+ const char *extra_args,
+ void *opaque)
+{
+ int pid = *(int *)opaque;
+ return qtest_create_test_state(pid);
+}
+
+QTestState *qtest_init_after_exec(QTestState *qts)
+{
+ void *opaque = (void *)&qts->qemu_pid;
+ QTestState *s;
+
+ s = qtest_init_internal(NULL, NULL, true, qtest_attach_qemu, opaque);
+ qts->qemu_pid = -1;
+ qtest_qmp_handshake(s, NULL);
+ return s;
+}
+
QTestState *qtest_init(const char *extra_args)
{
return qtest_init_ext(NULL, extra_args, NULL, true);
diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h
index 7f8dd0a912..9c118c89ca 100644
--- a/tests/qtest/libqtest.h
+++ b/tests/qtest/libqtest.h
@@ -56,6 +56,14 @@ QTestState *qtest_vinitf(const char *fmt, va_list ap) G_GNUC_PRINTF(1, 0);
*/
const char *qtest_qemu_binary(const char *var);
+/**
+ * qtest_init_after_exec:
+ * @qts: the previous QEMU state
+ *
+ * Return a test state representing new QEMU after @qts exec's it.
+ */
+QTestState *qtest_init_after_exec(QTestState *qts);
+
/**
* qtest_qemu_args:
* @extra_args: Other arguments to pass to QEMU.
--
2.35.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PULL 09/13] migration-test: only_source option
2025-10-01 21:52 [PULL 00/13] QTest patches for 2025-10-01 Fabiano Rosas
` (7 preceding siblings ...)
2025-10-01 21:52 ` [PULL 08/13] tests/qtest: qtest_init_after_exec Fabiano Rosas
@ 2025-10-01 21:52 ` Fabiano Rosas
2025-10-01 21:52 ` [PULL 10/13] migration-test: shm path accessor Fabiano Rosas
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Fabiano Rosas @ 2025-10-01 21:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Steve Sistare
From: Steve Sistare <steven.sistare@oracle.com>
Add the only_source option, analogous to only_target.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/qemu-devel/1759332851-370353-15-git-send-email-steven.sistare@oracle.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/migration/framework.c | 24 +++++++++++++++---------
tests/qtest/migration/framework.h | 2 ++
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/framework.c
index a044b35465..2c13fd1688 100644
--- a/tests/qtest/migration/framework.c
+++ b/tests/qtest/migration/framework.c
@@ -234,7 +234,7 @@ static void migrate_start_set_capabilities(QTestState *from, QTestState *to,
* to mimic as closer as that.
*/
migrate_set_capability(from, "events", true);
- if (!args->defer_target_connect) {
+ if (!args->defer_target_connect && to) {
migrate_set_capability(to, "events", true);
}
@@ -246,8 +246,10 @@ static void migrate_start_set_capabilities(QTestState *from, QTestState *to,
if (args->caps[MIGRATION_CAPABILITY_MULTIFD]) {
migrate_set_parameter_int(from, "multifd-channels",
MULTIFD_TEST_CHANNELS);
- migrate_set_parameter_int(to, "multifd-channels",
- MULTIFD_TEST_CHANNELS);
+ if (to) {
+ migrate_set_parameter_int(to, "multifd-channels",
+ MULTIFD_TEST_CHANNELS);
+ }
}
return;
@@ -410,11 +412,13 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
shmem_opts ? shmem_opts : "",
args->opts_target ? args->opts_target : "",
ignore_stderr);
- *to = qtest_init_ext(QEMU_ENV_DST, cmd_target, capabilities,
- !args->defer_target_connect);
- qtest_qmp_set_event_callback(*to,
- migrate_watch_for_events,
- &dst_state);
+ if (!args->only_source) {
+ *to = qtest_init_ext(QEMU_ENV_DST, cmd_target, capabilities,
+ !args->defer_target_connect);
+ qtest_qmp_set_event_callback(*to,
+ migrate_watch_for_events,
+ &dst_state);
+ }
/*
* Remove shmem file immediately to avoid memory leak in test failed case.
@@ -424,7 +428,9 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
unlink(shmem_path);
}
- migrate_start_set_capabilities(*from, *to, args);
+ migrate_start_set_capabilities(*from,
+ args->only_source ? NULL : *to,
+ args);
return 0;
}
diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/framework.h
index 744040d53a..19d552f78a 100644
--- a/tests/qtest/migration/framework.h
+++ b/tests/qtest/migration/framework.h
@@ -103,6 +103,8 @@ typedef struct {
*/
bool hide_stderr;
bool use_shmem;
+ /* only launch the source process */
+ bool only_source;
/* only launch the target process */
bool only_target;
/* Use dirty ring if true; dirty logging otherwise */
--
2.35.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PULL 10/13] migration-test: shm path accessor
2025-10-01 21:52 [PULL 00/13] QTest patches for 2025-10-01 Fabiano Rosas
` (8 preceding siblings ...)
2025-10-01 21:52 ` [PULL 09/13] migration-test: only_source option Fabiano Rosas
@ 2025-10-01 21:52 ` Fabiano Rosas
2025-10-01 21:52 ` [PULL 11/13] migration-test: misc exports Fabiano Rosas
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Fabiano Rosas @ 2025-10-01 21:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Steve Sistare
From: Steve Sistare <steven.sistare@oracle.com>
Define an accessor for the shm path. It will be referenced from
multiple sites in a subsequent patch.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/qemu-devel/1759332851-370353-16-git-send-email-steven.sistare@oracle.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/migration/framework.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/framework.c
index 2c13fd1688..d20938ccec 100644
--- a/tests/qtest/migration/framework.c
+++ b/tests/qtest/migration/framework.c
@@ -255,6 +255,11 @@ static void migrate_start_set_capabilities(QTestState *from, QTestState *to,
return;
}
+static char *test_shmem_path(void)
+{
+ return g_strdup_printf("/dev/shm/qemu-%d", getpid());
+}
+
int migrate_start(QTestState **from, QTestState **to, const char *uri,
MigrateStart *args)
{
@@ -342,7 +347,7 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
}
if (args->use_shmem) {
- shmem_path = g_strdup_printf("/dev/shm/qemu-%d", getpid());
+ shmem_path = test_shmem_path();
shmem_opts = g_strdup_printf(
"-object memory-backend-file,id=mem0,size=%s"
",mem-path=%s,share=on -numa node,memdev=mem0",
--
2.35.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PULL 11/13] migration-test: misc exports
2025-10-01 21:52 [PULL 00/13] QTest patches for 2025-10-01 Fabiano Rosas
` (9 preceding siblings ...)
2025-10-01 21:52 ` [PULL 10/13] migration-test: shm path accessor Fabiano Rosas
@ 2025-10-01 21:52 ` Fabiano Rosas
2025-10-01 21:52 ` [PULL 12/13] migration-test: migrate_args Fabiano Rosas
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Fabiano Rosas @ 2025-10-01 21:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Steve Sistare
From: Steve Sistare <steven.sistare@oracle.com>
Export misc definitions needed by the cpr-exec test.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/qemu-devel/1759332851-370353-17-git-send-email-steven.sistare@oracle.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/migration/bootfile.c | 5 +++++
tests/qtest/migration/bootfile.h | 1 +
tests/qtest/migration/framework.c | 5 +++++
tests/qtest/migration/framework.h | 1 +
4 files changed, 12 insertions(+)
diff --git a/tests/qtest/migration/bootfile.c b/tests/qtest/migration/bootfile.c
index fac059d11d..479c43231d 100644
--- a/tests/qtest/migration/bootfile.c
+++ b/tests/qtest/migration/bootfile.c
@@ -68,3 +68,8 @@ char *bootfile_create(const char *arch, const char *dir, bool suspend_me)
return bootpath;
}
+
+char *bootfile_get(void)
+{
+ return bootpath;
+}
diff --git a/tests/qtest/migration/bootfile.h b/tests/qtest/migration/bootfile.h
index 6d6a67386e..96e784b163 100644
--- a/tests/qtest/migration/bootfile.h
+++ b/tests/qtest/migration/bootfile.h
@@ -35,5 +35,6 @@
void bootfile_delete(void);
char *bootfile_create(const char *arch, const char *dir, bool suspend_me);
+char *bootfile_get(void);
#endif /* BOOTFILE_H */
diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/framework.c
index d20938ccec..89c85cd314 100644
--- a/tests/qtest/migration/framework.c
+++ b/tests/qtest/migration/framework.c
@@ -1007,6 +1007,11 @@ QTestMigrationState *get_src(void)
return &src_state;
}
+QTestMigrationState *get_dst(void)
+{
+ return &dst_state;
+}
+
MigrationTestEnv *migration_get_env(void)
{
static MigrationTestEnv *env;
diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/framework.h
index 19d552f78a..cc0d09b6da 100644
--- a/tests/qtest/migration/framework.h
+++ b/tests/qtest/migration/framework.h
@@ -237,6 +237,7 @@ void *migrate_hook_start_precopy_tcp_multifd_common(QTestState *from,
typedef struct QTestMigrationState QTestMigrationState;
QTestMigrationState *get_src(void);
+QTestMigrationState *get_dst(void);
#ifdef CONFIG_GNUTLS
void migration_test_add_tls(MigrationTestEnv *env);
--
2.35.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PULL 12/13] migration-test: migrate_args
2025-10-01 21:52 [PULL 00/13] QTest patches for 2025-10-01 Fabiano Rosas
` (10 preceding siblings ...)
2025-10-01 21:52 ` [PULL 11/13] migration-test: misc exports Fabiano Rosas
@ 2025-10-01 21:52 ` Fabiano Rosas
2025-10-01 21:52 ` [PULL 13/13] migration-test: strv parameter Fabiano Rosas
2025-10-03 11:55 ` [PULL 00/13] QTest patches for 2025-10-01 Richard Henderson
13 siblings, 0 replies; 15+ messages in thread
From: Fabiano Rosas @ 2025-10-01 21:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Steve Sistare
From: Steve Sistare <steven.sistare@oracle.com>
Define the subroutine migrate_args to return the arguments that are
used to exec the source or target qemu process.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/qemu-devel/1759332851-370353-18-git-send-email-steven.sistare@oracle.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/migration/framework.c | 65 +++++++++++++++++++------------
tests/qtest/migration/framework.h | 2 +
2 files changed, 43 insertions(+), 24 deletions(-)
diff --git a/tests/qtest/migration/framework.c b/tests/qtest/migration/framework.c
index 89c85cd314..a9be9c2dbf 100644
--- a/tests/qtest/migration/framework.c
+++ b/tests/qtest/migration/framework.c
@@ -260,13 +260,12 @@ static char *test_shmem_path(void)
return g_strdup_printf("/dev/shm/qemu-%d", getpid());
}
-int migrate_start(QTestState **from, QTestState **to, const char *uri,
- MigrateStart *args)
+int migrate_args(char **from, char **to, const char *uri, MigrateStart *args)
{
/* options for source and target */
g_autofree gchar *arch_opts = NULL;
- g_autofree gchar *cmd_source = NULL;
- g_autofree gchar *cmd_target = NULL;
+ gchar *cmd_source = NULL;
+ gchar *cmd_target = NULL;
const gchar *ignore_stderr;
g_autofree char *shmem_opts = NULL;
g_autofree char *shmem_path = NULL;
@@ -275,23 +274,10 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
const char *memory_size;
const char *machine_alias, *machine_opts = "";
g_autofree char *machine = NULL;
- const char *bootpath;
- g_autoptr(QList) capabilities = migrate_start_get_qmp_capabilities(args);
+ const char *bootpath = bootfile_get();
g_autofree char *memory_backend = NULL;
const char *events;
- if (args->use_shmem) {
- if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) {
- g_test_skip("/dev/shm is not supported");
- return -1;
- }
- }
-
- dst_state = (QTestMigrationState) { };
- src_state = (QTestMigrationState) { };
- bootpath = bootfile_create(arch, tmpfs, args->suspend_me);
- src_state.suspend_me = args->suspend_me;
-
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
memory_size = "150M";
@@ -388,12 +374,6 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
shmem_opts ? shmem_opts : "",
args->opts_source ? args->opts_source : "",
ignore_stderr);
- if (!args->only_target) {
- *from = qtest_init_ext(QEMU_ENV_SRC, cmd_source, capabilities, true);
- qtest_qmp_set_event_callback(*from,
- migrate_watch_for_events,
- &src_state);
- }
/*
* If the monitor connection is deferred, enable events on the command line
@@ -417,6 +397,42 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
shmem_opts ? shmem_opts : "",
args->opts_target ? args->opts_target : "",
ignore_stderr);
+
+ *from = cmd_source;
+ *to = cmd_target;
+ return 0;
+}
+
+int migrate_start(QTestState **from, QTestState **to, const char *uri,
+ MigrateStart *args)
+{
+ g_autofree gchar *cmd_source = NULL;
+ g_autofree gchar *cmd_target = NULL;
+ g_autoptr(QList) capabilities = migrate_start_get_qmp_capabilities(args);
+
+ if (args->use_shmem) {
+ if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) {
+ g_test_skip("/dev/shm is not supported");
+ return -1;
+ }
+ }
+
+ dst_state = (QTestMigrationState) { };
+ src_state = (QTestMigrationState) { };
+ bootfile_create(qtest_get_arch(), tmpfs, args->suspend_me);
+ src_state.suspend_me = args->suspend_me;
+
+ if (migrate_args(&cmd_source, &cmd_target, uri, args)) {
+ return -1;
+ }
+
+ if (!args->only_target) {
+ *from = qtest_init_ext(QEMU_ENV_SRC, cmd_source, capabilities, true);
+ qtest_qmp_set_event_callback(*from,
+ migrate_watch_for_events,
+ &src_state);
+ }
+
if (!args->only_source) {
*to = qtest_init_ext(QEMU_ENV_DST, cmd_target, capabilities,
!args->defer_target_connect);
@@ -430,6 +446,7 @@ int migrate_start(QTestState **from, QTestState **to, const char *uri,
* It's valid because QEMU has already opened this file
*/
if (args->use_shmem) {
+ g_autofree char *shmem_path = test_shmem_path();
unlink(shmem_path);
}
diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/framework.h
index cc0d09b6da..9bb584a6bb 100644
--- a/tests/qtest/migration/framework.h
+++ b/tests/qtest/migration/framework.h
@@ -223,6 +223,8 @@ typedef struct {
void wait_for_serial(const char *side);
void migrate_prepare_for_dirty_mem(QTestState *from);
void migrate_wait_for_dirty_mem(QTestState *from, QTestState *to);
+
+int migrate_args(char **from, char **to, const char *uri, MigrateStart *args);
int migrate_start(QTestState **from, QTestState **to, const char *uri,
MigrateStart *args);
void migrate_end(QTestState *from, QTestState *to, bool test_dest);
--
2.35.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PULL 13/13] migration-test: strv parameter
2025-10-01 21:52 [PULL 00/13] QTest patches for 2025-10-01 Fabiano Rosas
` (11 preceding siblings ...)
2025-10-01 21:52 ` [PULL 12/13] migration-test: migrate_args Fabiano Rosas
@ 2025-10-01 21:52 ` Fabiano Rosas
2025-10-03 11:55 ` [PULL 00/13] QTest patches for 2025-10-01 Richard Henderson
13 siblings, 0 replies; 15+ messages in thread
From: Fabiano Rosas @ 2025-10-01 21:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Richard Henderson, Steve Sistare
From: Steve Sistare <steven.sistare@oracle.com>
Define migrate_set_parameter_strv.
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Link: https://lore.kernel.org/qemu-devel/1759332851-370353-19-git-send-email-steven.sistare@oracle.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
tests/qtest/migration/migration-qmp.c | 16 ++++++++++++++++
tests/qtest/migration/migration-qmp.h | 2 ++
2 files changed, 18 insertions(+)
diff --git a/tests/qtest/migration/migration-qmp.c b/tests/qtest/migration/migration-qmp.c
index 66dd369ba7..c803fcee9d 100644
--- a/tests/qtest/migration/migration-qmp.c
+++ b/tests/qtest/migration/migration-qmp.c
@@ -442,6 +442,22 @@ void migrate_set_parameter_str(QTestState *who, const char *parameter,
migrate_check_parameter_str(who, parameter, value);
}
+void migrate_set_parameter_strv(QTestState *who, const char *parameter,
+ char **strv)
+{
+ g_autofree char *args = g_strjoinv("\",\"", strv);
+ g_autoptr(GString) value = g_string_new("");
+ g_autofree char *command = NULL;
+
+ g_string_printf(value, "\"%s\"", args);
+
+ command = g_strdup_printf("{ 'execute': 'migrate-set-parameters',"
+ "'arguments': { %%s: [ %s ]}}",
+ value->str);
+
+ qtest_qmp_assert_success(who, command, parameter);
+}
+
static long long migrate_get_parameter_bool(QTestState *who,
const char *parameter)
{
diff --git a/tests/qtest/migration/migration-qmp.h b/tests/qtest/migration/migration-qmp.h
index faa8181d91..44482d250f 100644
--- a/tests/qtest/migration/migration-qmp.h
+++ b/tests/qtest/migration/migration-qmp.h
@@ -34,6 +34,8 @@ void read_blocktime(QTestState *who);
void wait_for_migration_pass(QTestState *who, QTestMigrationState *src_state);
void migrate_set_parameter_str(QTestState *who, const char *parameter,
const char *value);
+void migrate_set_parameter_strv(QTestState *who, const char *parameter,
+ char **strv);
void migrate_set_parameter_bool(QTestState *who, const char *parameter,
int value);
void migrate_ensure_non_converge(QTestState *who);
--
2.35.3
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PULL 00/13] QTest patches for 2025-10-01
2025-10-01 21:52 [PULL 00/13] QTest patches for 2025-10-01 Fabiano Rosas
` (12 preceding siblings ...)
2025-10-01 21:52 ` [PULL 13/13] migration-test: strv parameter Fabiano Rosas
@ 2025-10-03 11:55 ` Richard Henderson
13 siblings, 0 replies; 15+ messages in thread
From: Richard Henderson @ 2025-10-03 11:55 UTC (permalink / raw)
To: Fabiano Rosas, qemu-devel
On 10/1/25 14:52, Fabiano Rosas wrote:
> The following changes since commit 29b77c1a2db2d796bc3847852a5c8dc2a1e6e83b:
>
> Merge tag 'rust-ci-pull-request' ofhttps://gitlab.com/marcandre.lureau/qemu into staging (2025-09-30 09:29:38 -0700)
>
> are available in the Git repository at:
>
> https://gitlab.com/farosas/qemu.git tags/qtest-20251001-pull-request
>
> for you to fetch changes up to ca5be51a51fc6b6402838310ae8d0162fc03ecef:
>
> migration-test: strv parameter (2025-10-01 17:09:23 -0300)
>
> ----------------------------------------------------------------
> Qtest pull request
>
> - Fix for qtest_get_machines QEMU var caching
> - Fixes for migration-test in --without-default-devices build
> - Preparation patches for cpr-exec test
Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/10.2 as appropriate.
r~
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2025-10-03 11:56 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-01 21:52 [PULL 00/13] QTest patches for 2025-10-01 Fabiano Rosas
2025-10-01 21:52 ` [PULL 01/13] tests/qtest: Add missing checks for the availability of machines Fabiano Rosas
2025-10-01 21:52 ` [PULL 02/13] tests/qtest/migration: Fix cpr-tests in case the machine is not available Fabiano Rosas
2025-10-01 21:52 ` [PULL 03/13] tests/qtest: optimize qtest_get_machines Fabiano Rosas
2025-10-01 21:52 ` [PULL 04/13] tests/qtest: export qtest_qemu_binary Fabiano Rosas
2025-10-01 21:52 ` [PULL 05/13] tests/qtest: qtest_qemu_args Fabiano Rosas
2025-10-01 21:52 ` [PULL 06/13] tests/qtest: qtest_create_test_state Fabiano Rosas
2025-10-01 21:52 ` [PULL 07/13] tests/qtest: qtest_qemu_spawn_func Fabiano Rosas
2025-10-01 21:52 ` [PULL 08/13] tests/qtest: qtest_init_after_exec Fabiano Rosas
2025-10-01 21:52 ` [PULL 09/13] migration-test: only_source option Fabiano Rosas
2025-10-01 21:52 ` [PULL 10/13] migration-test: shm path accessor Fabiano Rosas
2025-10-01 21:52 ` [PULL 11/13] migration-test: misc exports Fabiano Rosas
2025-10-01 21:52 ` [PULL 12/13] migration-test: migrate_args Fabiano Rosas
2025-10-01 21:52 ` [PULL 13/13] migration-test: strv parameter Fabiano Rosas
2025-10-03 11:55 ` [PULL 00/13] QTest patches for 2025-10-01 Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).