qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 041/124] vmstate: Test for VMSTATE_INT16_ARRAY


From: Juan Quintela
Subject: [Qemu-devel] [PATCH 041/124] vmstate: Test for VMSTATE_INT16_ARRAY
Date: Mon, 21 Apr 2014 16:40:21 +0200

Remove unused VMSTATE_INT16_ARRAY_V

Signed-off-by: Juan Quintela <address@hidden>
---
 include/migration/vmstate.h | 9 +++------
 tests/test-vmstate.c        | 6 ++++++
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 7c8bc54..db8f295 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -624,6 +624,9 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT64_ARRAY(_f, _s, _n)                              \
     VMSTATE_UINT64_ARRAY_TEST(_f, _s, _n, NULL)

+#define VMSTATE_INT16_ARRAY(_f, _s, _n)                               \
+    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_int16, int16_t)
+
 #define VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, _v)                \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint16, uint16_t)

@@ -645,12 +648,6 @@ extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT32_2DARRAY(_f, _s, _n1, _n2)                      \
     VMSTATE_UINT32_2DARRAY_V(_f, _s, _n1, _n2, 0)

-#define VMSTATE_INT16_ARRAY_V(_f, _s, _n, _v)                         \
-    VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int16, int16_t)
-
-#define VMSTATE_INT16_ARRAY(_f, _s, _n)                               \
-    VMSTATE_INT16_ARRAY_V(_f, _s, _n, 0)
-
 #define VMSTATE_INT32_ARRAY_V(_f, _s, _n, _v)                         \
     VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int32, int32_t)

diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c
index d4c15a2..c31d85f 100644
--- a/tests/test-vmstate.c
+++ b/tests/test-vmstate.c
@@ -519,6 +519,7 @@ typedef struct TestArray {
     uint32_t u32_2[VMSTATE_ARRAY_SIZE];
     uint64_t u64_1[VMSTATE_ARRAY_SIZE];
     uint64_t u64_2[VMSTATE_ARRAY_SIZE];
+    int16_t i16_1[VMSTATE_ARRAY_SIZE];
 } TestArray;

 TestArray obj_array = {
@@ -532,6 +533,7 @@ TestArray obj_array = {
     .u32_2 = {25, 24, 23, 22, 21},
     .u64_1 = {31, 32, 33, 34, 35},
     .u64_2 = {35, 34, 33, 32, 31},
+    .i16_1 = {41, 42, 43, 44, 45},
 };

 static const VMStateDescription vmstate_array_primitive = {
@@ -546,6 +548,7 @@ static const VMStateDescription vmstate_array_primitive = {
         VMSTATE_UINT16_ARRAY(u16_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_UINT32_ARRAY(u32_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_UINT64_ARRAY(u64_1, TestArray, VMSTATE_ARRAY_SIZE),
+        VMSTATE_INT16_ARRAY(i16_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -563,6 +566,7 @@ uint8_t wire_array_primitive[] = {
                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21,
                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22,
                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23,
+    /* i16_1 */ 0x00, 0x29, 0x00, 0x2a, 0x00, 0x2b, 0x00, 0x2c, 0x00, 0x2d,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };

@@ -584,6 +588,7 @@ static void obj_array_copy(void *arg1, void *arg2)
         target->u32_2[i] = source->u32_2[i];
         target->u64_1[i] = source->u64_1[i];
         target->u64_2[i] = source->u64_2[i];
+        target->i16_1[i] = source->i16_1[i];
     }
 }

@@ -617,6 +622,7 @@ static void test_array_primitive(void)
         ELEM_EQUAL(u16_1, i);
         ELEM_EQUAL(u32_1, i);
         ELEM_EQUAL(u64_1, i);
+        ELEM_EQUAL(i16_1, i);
     }
 }

-- 
1.9.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]