qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Steven Sistare <steven.sistare@oracle.com>
Cc: qemu-devel@nongnu.org, Fabiano Rosas <farosas@suse.de>,
	Laurent Vivier <lvivier@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH V1 11/11] migration-test: test cpr-exec
Date: Tue, 30 Sep 2025 15:02:58 -0400	[thread overview]
Message-ID: <aNwpYiUpFwtTKcVi@x1.local> (raw)
In-Reply-To: <c9a32330-56f7-4940-bdd4-9c87f24a0a2e@oracle.com>

On Tue, Sep 30, 2025 at 02:23:49PM -0400, Steven Sistare wrote:
> On 9/30/2025 1:08 PM, Peter Xu wrote:
> > On Fri, Sep 19, 2025 at 07:12:33AM -0700, Steve Sistare wrote:
> > > Add a test for the cpr-exec migration mode.
> > > 
> > > Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
> > 
> > Looks good, only some nitpicks or pure questions below.
> > 
> > > ---
> > >   tests/qtest/migration/cpr-tests.c | 120 ++++++++++++++++++++++++++++++++++++++
> > >   1 file changed, 120 insertions(+)
> > > 
> > > diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-tests.c
> > > index 5e764a6..f33af76 100644
> > > --- a/tests/qtest/migration/cpr-tests.c
> > > +++ b/tests/qtest/migration/cpr-tests.c
> > > @@ -110,6 +110,125 @@ static void test_mode_transfer_defer(void)
> > >       test_mode_transfer_common(true);
> > >   }
> > > +static void set_cpr_exec_args(QTestState *who, MigrateCommon *args)
> > > +{
> > > +    g_autofree char *qtest_from_args = NULL;
> > > +    g_autofree char *from_args = NULL;
> > > +    g_autofree char *to_args = NULL;
> > > +    g_autofree char *exec_args = NULL;
> > > +    g_auto(GStrv) argv = NULL;
> > > +    char *from_str, *src, *dst;
> > > +
> > > +    args->start.hide_stderr = false;    /* omit redirection word from args */
> > 
> > It's default off, right?  Could I request for some more explanations?
> 
> Yes, the default is false, so I will omit this line.  I will change it to
> an assertion. (IIRC when I first wrote this code 1-2 years ago, the cpr-exec
> test was a derivative of a precopy common test that set hide_stderr=true).
> 
> hide_stderr must be false when deriving cpr-exec arguments because of
> this code in framework.c:
> 
>     if (!getenv("QTEST_LOG") && args->hide_stderr) {
>         ignore_stderr = "2>/dev/null";
> 
> ignore_stderr is appended to the command line.  For cpr-exec the command line
> may not include redirection, because we pass it to execv(), not to the shell.

Please kindly add this rich comment above the assertion..

> 
> > Could we also set it in test_mode_exec() directly if needed?
> 
> Yes, one can set hide_stderr when launching the source VM.
> 
> > > +    migrate_args(&from_args, &to_args, args->listen_uri, &args->start);
> > > +    qtest_from_args = qtest_qemu_args(from_args);
> > > +
> > > +    /* De-dup spaces so argv does not contain empty strings */
> > > +    from_str = src = dst = g_strstrip(qtest_from_args);
> > > +    do {
> > > +        if (*src != ' ' || src[-1] != ' ') {
> > > +            *dst++ = *src;
> > > +        }
> > > +    } while (*src++);
> > 
> > Pure ask.. when will empty string be present?
> 
> migrate_args() format strings "%s %s %s" produce "   " when the arguments
> are empty strings.  Then g_strsplit("   ") would produce an array of 3
> empty strings.

... and here too.

Thanks,

-- 
Peter Xu



  reply	other threads:[~2025-09-30 19:04 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19 14:12 [PATCH V1 00/11] cpr-exec test Steve Sistare
2025-09-19 14:12 ` [PATCH V1 01/11] tests/qtest: export qtest_qemu_binary Steve Sistare
2025-09-29 14:47   ` Fabiano Rosas
2025-09-19 14:12 ` [PATCH V1 02/11] tests/qtest: qtest_qemu_args Steve Sistare
2025-09-29 14:51   ` Fabiano Rosas
2025-09-19 14:12 ` [PATCH V1 03/11] tests/qtest: qtest_create_test_state Steve Sistare
2025-09-29 14:52   ` Fabiano Rosas
2025-09-19 14:12 ` [PATCH V1 04/11] tests/qtest: qtest_qemu_spawn_func Steve Sistare
2025-09-29 14:57   ` Fabiano Rosas
2025-09-19 14:12 ` [PATCH V1 05/11] tests/qtest: qtest_init_after_exec Steve Sistare
2025-09-29 14:59   ` Fabiano Rosas
2025-09-19 14:12 ` [PATCH V1 06/11] migration-test: only_source option Steve Sistare
2025-09-29 20:27   ` Fabiano Rosas
2025-09-19 14:12 ` [PATCH V1 07/11] migration-test: shm path accessor Steve Sistare
2025-09-29 20:28   ` Fabiano Rosas
2025-09-19 14:12 ` [PATCH V1 08/11] migration-test: misc exports Steve Sistare
2025-09-19 14:12 ` [PATCH V1 09/11] migration-test: migrate_args Steve Sistare
2025-09-29 20:32   ` Fabiano Rosas
2025-09-30 14:35     ` Steven Sistare
2025-09-30 19:51   ` Fabiano Rosas
2025-09-30 19:59     ` Steven Sistare
2025-09-30 21:14       ` Steven Sistare
2025-10-01 12:16         ` Fabiano Rosas
2025-09-19 14:12 ` [PATCH V1 10/11] migration-test: strv parameter Steve Sistare
2025-09-19 14:12 ` [PATCH V1 11/11] migration-test: test cpr-exec Steve Sistare
2025-09-30 17:08   ` Peter Xu
2025-09-30 18:23     ` Steven Sistare
2025-09-30 19:02       ` Peter Xu [this message]
2025-09-30 19:07         ` Steven Sistare
2025-09-30 14:35 ` [PATCH V1 00/11] cpr-exec test Fabiano Rosas

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=aNwpYiUpFwtTKcVi@x1.local \
    --to=peterx@redhat.com \
    --cc=farosas@suse.de \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=steven.sistare@oracle.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).