[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 01/10] migration-test: Create cmd_soure and cmd_target
From: |
Thomas Huth |
Subject: |
Re: [PATCH v2 01/10] migration-test: Create cmd_soure and cmd_target |
Date: |
Wed, 18 Dec 2019 11:40:24 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
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 <address@hidden>
> ---
> 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
- [PATCH v2 00/10] Migration Arguments cleanup, Juan Quintela, 2019/12/17
- [PATCH v2 01/10] migration-test: Create cmd_soure and cmd_target, Juan Quintela, 2019/12/17
- Re: [PATCH v2 01/10] migration-test: Create cmd_soure and cmd_target,
Thomas Huth <=
- [PATCH v2 04/10] migration-test: Move memory size to common commandline, Juan Quintela, 2019/12/17
- [PATCH v2 05/10] migration-test: Move shmem handling to common commandline, Juan Quintela, 2019/12/17
- [PATCH v2 02/10] migration-test: Move hide_stderr to common commandline, Juan Quintela, 2019/12/17
- [PATCH v2 06/10] migration-test: Move -name handling to common commandline, Juan Quintela, 2019/12/17
- [PATCH v2 03/10] migration-test: Move -machine to common commandline, Juan Quintela, 2019/12/17
- [PATCH v2 09/10] migration-test: Rename cmd_src/dst to arch_source/arch_target, Juan Quintela, 2019/12/17
- [PATCH v2 07/10] migration-test: Move -serial handling to common commandline, Juan Quintela, 2019/12/17
- [PATCH v2 08/10] migration-test: Move -incomming handling to common commandline, Juan Quintela, 2019/12/17