Signed-off-by: Juan Quintela <quint...@redhat.com> --- tests/test-vmstate.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index eef5484..c937661 100644 --- a/tests/test-vmstate.c +++ b/tests/test-vmstate.c @@ -1659,6 +1659,7 @@ typedef struct TestStruct2 { SubStruct c[3]; uint16_t size4; SubStruct *p_1; + SubStruct *p_2; } TestStruct2; /* @@ -1683,6 +1684,8 @@ static const VMStateDescription vmstate_struct_varray = { VMSTATE_UINT16_EQUAL(size4, TestStruct2), VMSTATE_STRUCT_VARRAY_POINTER_UINT16(p_1, TestStruct2, size4, vmstate_sub_struct, SubStruct), + VMSTATE_STRUCT_VARRAY_POINTER_UINT32(p_2, TestStruct2, size2, + vmstate_sub_struct, SubStruct), VMSTATE_STRUCT_VARRAY_UINT8(a, TestStruct2, size, vmstate_sub_struct, SubStruct), VMSTATE_END_OF_LIST() @@ -1741,6 +1744,21 @@ uint8_t wire_struct_varray[] = { /* i64 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5d, /* buffer */ 0x62, 0x79, 0x65, 0x32, 0x20, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21, 0x00, + /* p_2[0] */ + /* i32 */ 0x00, 0x00, 0x00, 0x65, + /* i64 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, + /* buffer */ 0x62, 0x79, 0x65, 0x33, 0x20, 0x20, 0x77, 0x6f, + 0x72, 0x6c, 0x64, 0x21, 0x00, + /* p_2[1] */ + /* i32 */ 0x00, 0x00, 0x00, 0x66, + /* i64 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, + /* buffer */ 0x62, 0x79, 0x65, 0x34, 0x20, 0x20, 0x77, 0x6f, + 0x72, 0x6c, 0x64, 0x21, 0x00, + /* p_2[2] */ + /* i32 */ 0x00, 0x00, 0x00, 0x67, + /* i64 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, + /* buffer */ 0x62, 0x79, 0x65, 0x35, 0x20, 0x20, 0x77, 0x6f, + 0x72, 0x6c, 0x64, 0x21, 0x00, /* a[0] */ /* i32 */ 0x00, 0x00, 0x00, 0x15, /* i64 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, @@ -1782,6 +1800,9 @@ static void obj_struct2_copy(void *arg1, void *arg2) target->p_1[i].i32 = source->p_1[i].i32; target->p_1[i].i64 = source->p_1[i].i64; memcpy(target->p_1[i].buffer, source->p_1[i].buffer, 13); + target->p_2[i].i32 = source->p_2[i].i32; + target->p_2[i].i64 = source->p_2[i].i64; + memcpy(target->p_2[i].buffer, source->p_2[i].buffer, 13); } } @@ -1793,6 +1814,7 @@ static TestStruct2 *create_struct2(void) obj->size3 = 3; obj->size4 = 3; obj->p_1 = g_malloc0(sizeof(SubStruct) * 3); + obj->p_2 = g_malloc0(sizeof(SubStruct) * 3); return obj; } @@ -1815,6 +1837,9 @@ static TestStruct2 *create_struct2_init(void) obj->p_1[i].i32 = i + 81; obj->p_1[i].i64 = i + 91; snprintf((char *)obj->p_1[i].buffer, 13, "bye%d world!", i); + obj->p_2[i].i32 = i + 101; + obj->p_2[i].i64 = i + 111; + snprintf((char *)obj->p_2[i].buffer, 13, "bye%d world!", i + 3); } return obj; @@ -1841,6 +1866,7 @@ static void test_struct_varray(void) memset(obj->b, 0, sizeof(obj->b)); memset(obj->c, 0, sizeof(obj->c)); memset(obj->p_1, 0, sizeof(*obj->p_1) * 3); + memset(obj->p_2, 0, sizeof(*obj->p_2) * 3); obj->size = j; obj_struct2->size = j; wire_struct_varray[0] = j; @@ -1859,6 +1885,7 @@ static void test_struct_varray(void) STRUCT_EQUAL((&obj->b[i]), (&obj_struct2->b[i])); STRUCT_EQUAL((&obj->c[i]), (&obj_struct2->c[i])); STRUCT_EQUAL((&obj->p_1[i]), (&obj_struct2->p_1[i])); + STRUCT_EQUAL((&obj->p_2[i]), (&obj_struct2->p_2[i])); } } } -- 1.9.0