qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 03/42] migration-test: simplify shmem_opts handling


From: Juan Quintela
Subject: Re: [PATCH 03/42] migration-test: simplify shmem_opts handling
Date: Wed, 21 Jun 2023 11:42:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Peter Xu <peterx@redhat.com> wrote:
> On Fri, Jun 09, 2023 at 12:49:04AM +0200, Juan Quintela wrote:
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  tests/qtest/migration-test.c | 9 ++++-----
>>  1 file changed, 4 insertions(+), 5 deletions(-)
>> 
>> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
>> index 73b2f01427..95ccc9bce7 100644
>> --- a/tests/qtest/migration-test.c
>> +++ b/tests/qtest/migration-test.c
>> @@ -681,9 +681,6 @@ static int test_migrate_start(QTestState **from, 
>> QTestState **to,
>>              "-object memory-backend-file,id=mem0,size=%s"
>>              ",mem-path=%s,share=on -numa node,memdev=mem0",
>>              memory_size, shmem_path);
>> -    } else {
>> -        shmem_path = NULL;
>> -        shmem_opts = g_strdup("");
>>      }
>>  
>>      cmd_source = g_strdup_printf("-accel kvm%s -accel tcg%s%s "
>> @@ -696,7 +693,8 @@ static int test_migrate_start(QTestState **from, 
>> QTestState **to,
>>                                   machine_opts ? " -machine " : "",
>>                                   machine_opts ? machine_opts : "",
>>                                   memory_size, tmpfs,
>> -                                 arch_source, shmem_opts,
>> +                                 arch_source,
>> +                                 shmem_opts ? shmem_opts : "",
>>                                   args->opts_source ? args->opts_source : "",
>>                                   ignore_stderr ? ignore_stderr : "");
>>  
>> @@ -718,7 +716,8 @@ static int test_migrate_start(QTestState **from, 
>> QTestState **to,
>>                                   machine_opts ? " -machine " : "",
>>                                   machine_opts ? machine_opts : "",
>>                                   memory_size, tmpfs, uri,
>> -                                 arch_target, shmem_opts,
>> +                                 arch_target,
>> +                                 shmem_opts ? shmem_opts : "",
>
> Isn't this adding duplications instead?

I don't follow.

> Meanwhile, shmem_opts right now is auto-free.  If we do this we don't need
> it to be auto-free anymore..

We need.
It can still be from g_strdup_printf().

What this patch change is that it will never be (again) "".

It is going to be NULL or a real string, like all the other options.
The real string is generated, so it needs to be auto_free.

Later, Juan.

>>                                   args->opts_target ? args->opts_target : "",
>>                                   ignore_stderr ? ignore_stderr : "");
>>      *to = qtest_init(cmd_target);
>> -- 
>> 2.40.1
>> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]