On 08/12/2023 16.02, Fabiano Rosas wrote:
Fabiano Rosas <faro...@suse.de> writes:

We can run the migration tests with two different QEMU binaries to
test migration compatibility between QEMU versions. This means we'll
be running the tests with an older QEMU in either source or
destination.

We need to avoid trying to test functionality that is unknown to the
older QEMU. This could mean new features, bug fixes, error message
changes, QEMU command line changes, migration API changes, etc.

Add a 'since' argument to the tests that inform when the functionality
that is being test has been added to QEMU so we can skip the test on
older versions.

Also add a version comparison function so we can adapt test code
depending on the QEMU binary version being used.

Signed-off-by: Fabiano Rosas <faro...@suse.de>
---
  tests/qtest/migration-helpers.c | 11 +++++++++++
  tests/qtest/migration-helpers.h |  1 +
  tests/qtest/migration-test.c    | 28 ++++++++++++++++++++++++++++
  3 files changed, 40 insertions(+)

diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c
index 24fb7b3525..d21f5cd8c0 100644
--- a/tests/qtest/migration-helpers.c
+++ b/tests/qtest/migration-helpers.c
@@ -292,3 +292,14 @@ char *resolve_machine_version(const char *alias, const 
char *var1,
return find_common_machine_version(machine_name, var1, var2);
  }
+
+int migration_vercmp(QTestState *who, const char *tgt_version)
+{
+    int major, minor, micro;
+    g_autofree char *version = NULL;
+
+    qtest_query_version(who, &major, &minor, &micro);
+    version = g_strdup_printf("%d.%d.%d", major, minor, micro);

I just noticed this is not right. I need to increment the minor when
there's a micro to account for the versions in between releases. The
whole point of this series is to test a X.Y.0 release vs. a X.Y.Z
development branch.

Also this looks like it cannot deal with two-digit minor versions ... we still have machine types for QEMU 2.12.0 around ... do we care here?

 Thomas



Reply via email to