Signed-off-by: Juan Quintela <quint...@redhat.com> --- tests/test-vmstate.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index 7b49dda..5609ff0 100644 --- a/tests/test-vmstate.c +++ b/tests/test-vmstate.c @@ -955,11 +955,13 @@ static void test_array_sub(void) typedef struct TestBuffer { uint8_t buffer[6]; uint8_t partial[13]; + uint8_t middle[13]; } TestBuffer; TestBuffer obj_buffer = { .buffer = "hello", .partial = "This is Juan", + .middle = "hello world!" }; static const VMStateDescription vmstate_buffer_simple = { @@ -970,6 +972,7 @@ static const VMStateDescription vmstate_buffer_simple = { .fields = (VMStateField[]) { VMSTATE_BUFFER(buffer, TestBuffer), VMSTATE_PARTIAL_BUFFER(partial, TestBuffer, 4), + VMSTATE_BUFFER_START_MIDDLE(middle, TestBuffer, 6), VMSTATE_END_OF_LIST() } }; @@ -977,6 +980,7 @@ static const VMStateDescription vmstate_buffer_simple = { uint8_t wire_buffer_simple[] = { /* buffer */ 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00, /* partial */ 0x54, 0x68, 0x69, 0x73, + /* middle */ 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21, 0x00, QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */ }; @@ -1024,6 +1028,8 @@ static void test_buffer_simple(void) SUCCESS(memcmp(obj.buffer, obj_buffer.buffer, sizeof(obj.buffer))); SUCCESS(memcmp(obj.partial, obj_buffer.partial, 4)); FAILURE(memcmp(obj.partial+4, obj_buffer.partial+4, sizeof(obj.partial)-4)); + FAILURE(memcmp(obj.middle, obj_buffer.middle, 6)); + SUCCESS(memcmp(obj.middle+6, obj_buffer.middle+6, sizeof(obj.middle)-6)); } #undef FIELD_ASSERT -- 1.9.0