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" <dgilb...@redhat.com> >> >> 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
signature.asc
Description: OpenPGP digital signature