Received: from eggs.gnu.org ([2001:4830:134:3::10]:32998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byemg-00040S-Kj for qemu-devel@nongnu.org; Mon, 24 Oct 2016 08:55:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byemd-0007Fx-HU for qemu-devel@nongnu.org; Mon, 24 Oct 2016 08:55:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57098) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1byemd-0007Fh-Bi for qemu-devel@nongnu.org; Mon, 24 Oct 2016 08:55:19 -0400 From: Markus Armbruster References: <20161020103636.22228-1-dgilbert@redhat.com> <20161020103636.22228-3-dgilbert@redhat.com> Date: Mon, 24 Oct 2016 14:55:16 +0200 In-Reply-To: <20161020103636.22228-3-dgilbert@redhat.com> (David Alan Gilbert's message of "Thu, 20 Oct 2016 11:36:36 +0100") Message-ID: <8737jlgb4b.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 2/2] test-vmstate: Silence expected errors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert (git)" Cc: qemu-devel@nongnu.org, pbonzini@redhat.com, peter.maydell@linaro.org "Dr. David Alan Gilbert (git)" writes: > From: "Dr. David Alan Gilbert" > > test-vmstate has some expected failure tests (from explicitly > truncating an input stream); these trigger errors in the migration > code that are now reported; silence these errors. > > Signed-off-by: Dr. David Alan Gilbert > --- > tests/test-vmstate.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c > index d8da26f..79cca87 100644 > --- a/tests/test-vmstate.c > +++ b/tests/test-vmstate.c > @@ -27,8 +27,10 @@ > #include "qemu-common.h" > #include "migration/migration.h" > #include "migration/vmstate.h" > +#include "monitor/monitor.h" > #include "qemu/coroutine.h" > #include "io/channel-file.h" > +#include "libqtest.h" > > static char temp_file[] = "/tmp/vmst.test.XXXXXX"; > static int temp_fd; > @@ -132,6 +134,9 @@ static int load_vmstate(const VMStateDescription *desc, > void (*obj_copy)(void *, void*), > int version, uint8_t *wire, size_t size) > { > + /* Silence errors during the expected failures */ > + cur_mon = &stubs_silent_monitor; > + > /* We test with zero size */ > obj_copy(obj_clone, obj); > FAILURE(load_vmstate_one(desc, obj, version, wire, 0)); > @@ -154,6 +159,9 @@ static int load_vmstate(const VMStateDescription *desc, > FAILURE(load_vmstate_one(desc, obj, version, wire + (size/2), size/2)); > > } > + /* Now we shouldn't get any more errors - go back to normal */ I feel this comment is of marginal value, especially once the pattern becomes more widely used. > + cur_mon = NULL; > + > obj_copy(obj, obj_clone); > return load_vmstate_one(desc, obj, version, wire, size); > } Works. My autopilot would do old_mon = cur_mon; cur_mon = &stubs_silent_monitor; ... cur_mon = old_mon because it avoids making assumptions on cur_mon's value. Pick what you like better.