qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH v3 2/4] tests/qtest/migration: Add infrastructure to skip tests on older QEMUs
Date: Tue, 9 Jan 2024 10:26:22 +0800	[thread overview]
Message-ID: <ZZyuzqbL5oaUVGhj@x1n> (raw)
In-Reply-To: <87a5pf3mnq.fsf@suse.de>

On Mon, Jan 08, 2024 at 11:49:45AM -0300, Fabiano Rosas wrote:
> >> +
> >> +    if (major > tgt_major) {
> >> +        return -1;
> >
> > This means the QEMU version is newer, the function will return negative.
> > Is this what we want?  It seems it's inverted.
> 
> The return "points" to which once is the more recent:
> 
> QEMU version | since: version
> -1           0         1

Here if returns -1, then below [1] will skip the test?

> 
> > In all cases, document this function with retval would be helpful too.
> >
> 
> Ok.
> 
> >> +    }
> >> +    if (major < tgt_major) {
> >> +        return 1;
> >> +    }
> >
> > Instead of all these, I'm wondering whether we can allow "since" to be an
> > array of integers, like [8, 2, 0].  Would that be much easier?
> 
> I don't see why push the complexity towards the person writing the
> tests. The string is much more natural to specify.

To me QEMU_VER(8,2,0) is as easy to write and read, too.  What Dan proposed
looks also good in the other thread.

I don't really have a strong opinion here especially for the test case. But
imho it'll be still nice to avoid string <-> int if the string is not required.

[...]

> >> @@ -850,6 +856,17 @@ static int test_migrate_start(QTestState **from, QTestState **to,
> >>          qtest_qmp_set_event_callback(*from,
> >>                                       migrate_watch_for_stop,
> >>                                       &got_src_stop);
> >> +
> >> +        if (args->since && migration_vercmp(*from, args->since) < 0) {

[1]

> >> +            g_autofree char *msg = NULL;
> >> +
> >> +            msg = g_strdup_printf("Test requires at least QEMU version %s",
> >> +                                  args->since);
> >> +            g_test_skip(msg);
> >> +            qtest_quit(*from);
> >> +
> >> +            return -1;
> >> +        }

-- 
Peter Xu



  reply	other threads:[~2024-01-09  2:26 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-05 18:04 [PATCH v3 0/4] migration & CI: Add a CI job for migration compat testing Fabiano Rosas
2024-01-05 18:04 ` [PATCH v3 1/4] tests/qtest: Add a helper to query the QEMU version Fabiano Rosas
2024-01-08  8:13   ` Peter Xu
2024-01-05 18:04 ` [PATCH v3 2/4] tests/qtest/migration: Add infrastructure to skip tests on older QEMUs Fabiano Rosas
2024-01-08  8:13   ` Peter Xu
2024-01-08  8:39     ` Peter Xu
2024-01-08 14:49     ` Fabiano Rosas
2024-01-09  2:26       ` Peter Xu [this message]
2024-01-09 16:50         ` Fabiano Rosas
2024-01-08 14:57   ` Daniel P. Berrangé
2024-01-05 18:04 ` [PATCH v3 3/4] ci: Add a migration compatibility test job Fabiano Rosas
2024-01-09  7:14   ` Peter Xu
2024-01-09 13:00     ` Fabiano Rosas
2024-01-10  3:58       ` Peter Xu
2024-01-09 18:15   ` Cédric Le Goater
2024-01-09 20:58     ` Fabiano Rosas
2024-01-10 10:30       ` Thomas Huth
2024-01-05 18:04 ` [PATCH v3 4/4] [NOT FOR MERGE] tests/qtest/migration: Adapt tests to use older QEMUs Fabiano Rosas
2024-01-08  8:15   ` Peter Xu
2024-01-08 15:37     ` Fabiano Rosas
2024-01-09  3:51       ` Peter Xu
2024-01-09 14:46         ` Fabiano Rosas
2024-01-10  4:08           ` Peter Xu
2024-01-10 14:42             ` Fabiano Rosas
2024-01-11  2:35               ` Peter Xu
2024-01-11 13:58                 ` Fabiano Rosas
2024-01-15  4:13                   ` Peter Xu
2024-01-15 13:45                     ` Fabiano Rosas
2024-01-15 23:28                       ` Peter Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZZyuzqbL5oaUVGhj@x1n \
    --to=peterx@redhat.com \
    --cc=berrange@redhat.com \
    --cc=farosas@suse.de \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).