[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] test-vmstate: Silence expected errors
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] test-vmstate: Silence expected errors |
Date: |
Mon, 24 Oct 2016 14:55:16 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
"Dr. David Alan Gilbert (git)" <address@hidden> writes:
> From: "Dr. David Alan Gilbert" <address@hidden>
>
> 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 <address@hidden>
> ---
> 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.