qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Juan Quintela <quintela@redhat.com>, qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [PATCH v2 01/10] migration-test: Create cmd_soure and cmd_target
Date: Wed, 18 Dec 2019 11:40:24 +0100	[thread overview]
Message-ID: <bd9939c4-9eff-9028-03bd-93e14f3defcd@redhat.com> (raw)
In-Reply-To: <20191218015520.2881-2-quintela@redhat.com>

On 18/12/2019 02.55, Juan Quintela wrote:
> We are repeating almost everything for each machine while creating the
> command line for migration.  And once for source and another for
> destination.  We start putting there opts_src and opts_dst.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  tests/migration-test.c | 44 ++++++++++++++++++++++++------------------
>  1 file changed, 25 insertions(+), 19 deletions(-)
> 
> diff --git a/tests/migration-test.c b/tests/migration-test.c
> index a5343fdc66..fbddcf2317 100644
> --- a/tests/migration-test.c
> +++ b/tests/migration-test.c
> @@ -557,6 +557,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,
>                                 const char *opts_dst)
>  {
>      gchar *cmd_src, *cmd_dst;
> +    gchar *cmd_source, *cmd_target;

The naming looks quite unfortunate to me ... "cmd_src" can easily be
mixed up with "cmd_source" ... but maybe you could do it without these
additional variables (see below) ...

[...]
> @@ -671,11 +671,17 @@ static int test_migrate_start(QTestState **from, QTestState **to,
>          cmd_dst = tmp;
>      }
>  
> -    *from = qtest_init(cmd_src);
> +    cmd_source = g_strdup_printf("%s %s",
> +                                 cmd_src, opts_src);
>      g_free(cmd_src);
> +    *from = qtest_init(cmd_source);
> +    g_free(cmd_source);
>  
> -    *to = qtest_init(cmd_dst);
> +    cmd_target = g_strdup_printf("%s %s",
> +                                 cmd_dst, opts_dst);
>      g_free(cmd_dst);
> +    *to = qtest_init(cmd_target);
> +    g_free(cmd_target);

May I suggest to qtest_initf() here instead:

  *from = qtest_initf("%s %s", cmd_src, opts_src);

  *to = qtest_initf("%s %s", cmd_dst, opts_dst);


And maybe you could even move the extra_opts here, too? e.g.:

  *from = qtest_initf("%s %s %s", cmd_src, extra_opts ?: "", opts_src);

  *to = qtest_initf("%s %s %s", cmd_dst,  extra_opts ?: "", opts_dst);

 Thomas



  reply	other threads:[~2019-12-18 10:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18  1:55 [PATCH v2 00/10] Migration Arguments cleanup Juan Quintela
2019-12-18  1:55 ` [PATCH v2 01/10] migration-test: Create cmd_soure and cmd_target Juan Quintela
2019-12-18 10:40   ` Thomas Huth [this message]
2019-12-18 10:58     ` Juan Quintela
2019-12-18  1:55 ` [PATCH v2 02/10] migration-test: Move hide_stderr to common commandline Juan Quintela
2019-12-18  1:55 ` [PATCH v2 03/10] migration-test: Move -machine " Juan Quintela
2019-12-18  1:55 ` [PATCH v2 04/10] migration-test: Move memory size " Juan Quintela
2019-12-18  1:55 ` [PATCH v2 05/10] migration-test: Move shmem handling " Juan Quintela
2019-12-18  1:55 ` [PATCH v2 06/10] migration-test: Move -name " Juan Quintela
2019-12-18  1:55 ` [PATCH v2 07/10] migration-test: Move -serial " Juan Quintela
2019-12-18  1:55 ` [PATCH v2 08/10] migration-test: Move -incomming " Juan Quintela
2019-12-18 10:43   ` Thomas Huth
2019-12-18  1:55 ` [PATCH v2 09/10] migration-test: Rename cmd_src/dst to arch_source/arch_target Juan Quintela
2019-12-18 10:44   ` Thomas Huth
2019-12-18  1:55 ` [PATCH v2 10/10] migration-test: Use a struct for test_migrate_start parameters Juan Quintela

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=bd9939c4-9eff-9028-03bd-93e14f3defcd@redhat.com \
    --to=thuth@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@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).