[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/17] tests/qtest/migration: Introduce find_common_machine_versio
From: |
Juan Quintela |
Subject: |
[PULL 11/17] tests/qtest/migration: Introduce find_common_machine_version |
Date: |
Fri, 20 Oct 2023 08:57:45 +0200 |
From: Fabiano Rosas <farosas@suse.de>
When using two different QEMU binaries for migration testing, we'll
need to find what is the machine version that will work with both
binaries. Add a helper for that.
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231018192741.25885-7-farosas@suse.de>
---
tests/qtest/migration-helpers.h | 2 ++
tests/qtest/migration-helpers.c | 26 ++++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helpers.h
index 4f51d0f8bc..d1c2351d33 100644
--- a/tests/qtest/migration-helpers.h
+++ b/tests/qtest/migration-helpers.h
@@ -43,4 +43,6 @@ void wait_for_migration_complete(QTestState *who);
void wait_for_migration_fail(QTestState *from, bool allow_active);
+char *find_common_machine_version(const char *mtype, const char *var1,
+ const char *var2);
#endif /* MIGRATION_HELPERS_H */
diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c
index 0c185db450..13449c1fe1 100644
--- a/tests/qtest/migration-helpers.c
+++ b/tests/qtest/migration-helpers.c
@@ -240,3 +240,29 @@ void wait_for_migration_fail(QTestState *from, bool
allow_active)
g_assert(qdict_get_bool(rsp_return, "running"));
qobject_unref(rsp_return);
}
+
+char *find_common_machine_version(const char *mtype, const char *var1,
+ const char *var2)
+{
+ g_autofree char *type1 = qtest_resolve_machine_alias(var1, mtype);
+ g_autofree char *type2 = qtest_resolve_machine_alias(var2, mtype);
+
+ g_assert(type1 && type2);
+
+ if (g_str_equal(type1, type2)) {
+ /* either can be used */
+ return g_strdup(type1);
+ }
+
+ if (qtest_has_machine_with_env(var2, type1)) {
+ return g_strdup(type1);
+ }
+
+ if (qtest_has_machine_with_env(var1, type2)) {
+ return g_strdup(type2);
+ }
+
+ g_test_message("No common machine version for machine type '%s' between "
+ "binaries %s and %s", mtype, getenv(var1), getenv(var2));
+ g_assert_not_reached();
+}
--
2.41.0
- [PULL 00/17] Migration 20231020 patches, Juan Quintela, 2023/10/20
- [PULL 01/17] tests/qtest/migration-test: Disable the analyze-migration.py test on s390x, Juan Quintela, 2023/10/20
- [PULL 02/17] migration: simplify blockers, Juan Quintela, 2023/10/20
- [PULL 03/17] migration: Fix parse_ramblock() on overwritten retvals, Juan Quintela, 2023/10/20
- [PULL 05/17] migration/multifd: Stop checking p->quit in multifd_send_thread, Juan Quintela, 2023/10/20
- [PULL 06/17] tests/qtest: Allow qtest_qemu_binary to use a custom environment variable, Juan Quintela, 2023/10/20
- [PULL 04/17] migration: simplify notifiers, Juan Quintela, 2023/10/20
- [PULL 07/17] tests/qtest: Introduce qtest_init_with_env, Juan Quintela, 2023/10/20
- [PULL 08/17] tests/qtest: Allow qtest_get_machines to use an alternate QEMU binary, Juan Quintela, 2023/10/20
- [PULL 09/17] tests/qtest: Introduce qtest_has_machine_with_env, Juan Quintela, 2023/10/20
- [PULL 11/17] tests/qtest/migration: Introduce find_common_machine_version,
Juan Quintela <=
- [PULL 10/17] tests/qtest: Introduce qtest_resolve_machine_alias, Juan Quintela, 2023/10/20
- [PULL 12/17] tests/qtest/migration: Define a machine for all architectures, Juan Quintela, 2023/10/20
- [PULL 13/17] tests/qtest/migration: Specify the geometry of the bootsector, Juan Quintela, 2023/10/20
- [PULL 16/17] tests/qtest/migration: Allow user to specify a machine type, Juan Quintela, 2023/10/20
- [PULL 14/17] tests/qtest/migration: Set q35 as the default machine for x86_86, Juan Quintela, 2023/10/20
- [PULL 17/17] tests/qtest: Don't print messages from query instances, Juan Quintela, 2023/10/20
- [PULL 15/17] tests/qtest/migration: Support more than one QEMU binary, Juan Quintela, 2023/10/20
- Re: [PULL 00/17] Migration 20231020 patches, Stefan Hajnoczi, 2023/10/20