Signed-off-by: Juan Quintela <quint...@redhat.com> --- tests/test-vmstate.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index ae27679..79bdf9d 100644 --- a/tests/test-vmstate.c +++ b/tests/test-vmstate.c @@ -974,6 +974,8 @@ static void test_buffer_test(void) typedef struct TestVBuffer { int32_t size; uint8_t *buffer; + uint32_t size2; + uint8_t *buffer2; } TestVBuffer; static const VMStateDescription vmstate_vbuffer_simple = { @@ -983,14 +985,18 @@ static const VMStateDescription vmstate_vbuffer_simple = { .minimum_version_id_old = 1, .fields = (VMStateField[]) { VMSTATE_INT32_EQUAL(size, TestVBuffer), + VMSTATE_UINT32_EQUAL(size2, TestVBuffer), VMSTATE_VBUFFER_INT32(buffer, TestVBuffer, size), + VMSTATE_VBUFFER_UINT32(buffer2, TestVBuffer, size2), VMSTATE_END_OF_LIST() } }; uint8_t wire_vbuffer_simple[] = { /* size */ 0x00, 0x00, 0x00, 0x05, + /* size2 */ 0x00, 0x00, 0x00, 0x05, /* buffer */ 0x01, 0x02, 0x03, 0x04, 0x05, + /* buffer2 */ 0x06, 0x07, 0x08, 0x09, 0x0a, QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */ }; @@ -1001,8 +1007,10 @@ static void obj_vbuffer_copy(void *arg1, void *arg2) int i; target->size = source->size; + target->size2 = source->size2; for (i = 0; i < VMSTATE_ARRAY_SIZE; i++) { target->buffer[i] = source->buffer[i]; + target->buffer2[i] = source->buffer2[i]; } } @@ -1011,6 +1019,8 @@ static TestVBuffer *create_vbuffer(void) TestVBuffer *obj = g_malloc0(sizeof(*obj)); obj->size = VMSTATE_ARRAY_SIZE; obj->buffer = g_malloc0(VMSTATE_ARRAY_SIZE); + obj->size2 = VMSTATE_ARRAY_SIZE; + obj->buffer2 = g_malloc0(VMSTATE_ARRAY_SIZE); return obj; } @@ -1022,6 +1032,7 @@ static TestVBuffer *create_vbuffer_init(void) for (i = 0; i < VMSTATE_ARRAY_SIZE; i++) { obj->buffer[i] = i + 1; + obj->buffer2[i] = i + 6; } return obj; } @@ -1043,6 +1054,7 @@ static void test_vbuffer_simple(void) sizeof(wire_vbuffer_simple))); SUCCESS(memcmp(obj->buffer, obj_vbuffer->buffer, VMSTATE_ARRAY_SIZE)); + SUCCESS(memcmp(obj->buffer2, obj_vbuffer->buffer2, VMSTATE_ARRAY_SIZE)); } typedef struct TestVersioned { -- 1.9.0