qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 5/5] migration: Route more error paths


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 5/5] migration: Route more error paths
Date: Wed, 20 Sep 2017 08:26:22 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

On 09/19/2017 10:55 PM, Fam Zheng wrote:
> On Tue, 09/19 19:00, Dr. David Alan Gilbert (git) wrote:
>> From: "Dr. David Alan Gilbert" <address@hidden>
>>
>> vmstate_save is called in a few places, and vmstate_save_state is
>> called in lots of places.
>>
>> Route error returns from the easier cases back up;  there are lots
>> of more complex cases where there own error paths need fixing.
> 

>> +++ b/tests/test-vmstate.c
>> @@ -70,7 +70,7 @@ static void save_vmstate(const VMStateDescription *desc, 
>> void *obj)
>>      QEMUFile *f = open_test_file(true);
>>  
>>      /* Save file with vmstate */
>> -    vmstate_save_state(f, desc, obj, NULL);
>> +    g_assert(!vmstate_save_state(f, desc, obj, NULL));
> 
> Though this is test code, isn't putting anything with a side effect into an
> assert expression a very bad pattern in general?

Indeed - although we don't disable asserts (as of commit 262a69f4), this
should still be separated into running vmstate_save_state()
unconditionally, then asserting that the result stored into a temporary
variable matches expectations.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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