From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51258) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WX093-0006Cf-C4 for qemu-devel@nongnu.org; Sun, 06 Apr 2014 23:22:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WX08y-0008JJ-CK for qemu-devel@nongnu.org; Sun, 06 Apr 2014 23:22:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42603) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WX08y-0008JD-4o for qemu-devel@nongnu.org; Sun, 06 Apr 2014 23:22:44 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s373Mh5g025682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 6 Apr 2014 23:22:43 -0400 From: Juan Quintela Date: Mon, 7 Apr 2014 05:20:50 +0200 Message-Id: <1396840915-10384-33-git-send-email-quintela@redhat.com> In-Reply-To: <1396840915-10384-1-git-send-email-quintela@redhat.com> References: <1396840915-10384-1-git-send-email-quintela@redhat.com> Subject: [Qemu-devel] [PATCH 32/97] vmstate: Test for VMSTATE_UINT8_ARRAY List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Remove VMSTATE_UINT8_ARRAY_V that was unused. Signed-off-by: Juan Quintela --- include/migration/vmstate.h | 9 +++------ tests/test-vmstate.c | 11 +++++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index ac5a939..c74cdf3 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -606,6 +606,9 @@ extern const VMStateInfo vmstate_info_bitmap; #define VMSTATE_BOOL_ARRAY(_f, _s, _n) \ VMSTATE_BOOL_ARRAY_TEST(_f, _s, _n, NULL) +#define VMSTATE_UINT8_ARRAY(_f, _s, _n) \ + VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_uint8, uint8_t) + #define VMSTATE_UINT16_ARRAY_V(_f, _s, _n, _v) \ VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint16, uint16_t) @@ -621,12 +624,6 @@ extern const VMStateInfo vmstate_info_bitmap; #define VMSTATE_UINT8_2DARRAY_V(_f, _s, _n1, _n2, _v) \ VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint8, uint8_t) -#define VMSTATE_UINT8_ARRAY_V(_f, _s, _n, _v) \ - VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_uint8, uint8_t) - -#define VMSTATE_UINT8_ARRAY(_f, _s, _n) \ - VMSTATE_UINT8_ARRAY_V(_f, _s, _n, 0) - #define VMSTATE_UINT8_SUB_ARRAY(_f, _s, _start, _num) \ VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint8, uint8_t) diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index 656e563..8a73d4c 100644 --- a/tests/test-vmstate.c +++ b/tests/test-vmstate.c @@ -540,12 +540,16 @@ typedef struct TestArray { int32_t size; bool b_1[VMSTATE_ARRAY_SIZE]; bool b_2[VMSTATE_ARRAY_SIZE]; + uint8_t u8_1[VMSTATE_ARRAY_SIZE]; + uint8_t u8_2[VMSTATE_ARRAY_SIZE]; } TestArray; TestArray obj_array = { .size = VMSTATE_ARRAY_SIZE, .b_1 = { false, true, false, true, false}, .b_2 = { true, false, true, false, true}, + .u8_1 = { 1, 2, 3, 4, 5}, + .u8_2 = { 5, 4, 3, 2, 1}, }; static const VMStateDescription vmstate_array_primitive = { @@ -556,6 +560,7 @@ static const VMStateDescription vmstate_array_primitive = { .fields = (VMStateField[]) { VMSTATE_INT32(size, TestArray), VMSTATE_BOOL_ARRAY(b_1, TestArray, VMSTATE_ARRAY_SIZE), + VMSTATE_UINT8_ARRAY(u8_1, TestArray, VMSTATE_ARRAY_SIZE), VMSTATE_END_OF_LIST() } }; @@ -563,6 +568,7 @@ static const VMStateDescription vmstate_array_primitive = { uint8_t wire_array_primitive[] = { /* size */ 0x00, 0x00, 0x00, 0x05, /* b_1 */ 0x00, 0x01, 0x00, 0x01, 0x00, + /* u8_1 */ 0x01, 0x02, 0x03, 0x04, 0x05, QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */ }; @@ -611,10 +617,14 @@ static void test_array_primitive(void) #define FIELD_ASSERT(name) g_assert_cmpint(obj.name, ==, obj_array.name) #define ELEM_ASSERT(name, i) \ g_assert_cmpint(obj.name[i], ==, obj_array.name[i]) +#define ELEM_NOT_ASSERT(name, i) \ + g_assert_cmpint(obj.name[i], !=, obj_array.name[i]) FIELD_ASSERT(size); for (i = 0; i < VMSTATE_ARRAY_SIZE; i++) { ELEM_ASSERT(b_1, i); + ELEM_ASSERT(u8_1, i); + ELEM_NOT_ASSERT(u8_2, i); } /* We save the file again. We want the EOF this time */ @@ -701,6 +711,7 @@ static void test_array_test(void) } #undef FIELD_ASSERT #undef ELEM_ASSERT +#undef ELEM_NOT_ASSERT typedef struct TestStruct { -- 1.9.0