Daniel P. Berrangé <berra...@redhat.com> writes:

> On Thu, Jan 04, 2024 at 02:18:55PM -0300, Fabiano Rosas wrote:
>> 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    | 29 +++++++++++++++++++++++++++++
>>  3 files changed, 41 insertions(+)
>> 
>> diff --git a/tests/qtest/migration-helpers.c 
>> b/tests/qtest/migration-helpers.c
>> index 24fb7b3525..20220bfda0 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", major, minor + !!micro);
>> +
>> +    return strcmp(version, tgt_version);
>
> Alphabetical version comparison will fail in 2025 when we
> hit QEMU 10.0, as 10.0 will compare older than 9.0
>

Indeed, I'll fix it.

Thanks

Reply via email to