diff mbox

[043/124] vmstate: Test for VMSTATE_INT64_ARRAY

Message ID 1398091304-10677-44-git-send-email-quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela April 21, 2014, 2:40 p.m. UTC
Remove unused VMSTATE_INT64_ARRAY_V.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/vmstate.h |  9 +++------
 tests/test-vmstate.c        | 10 ++++++++++
 2 files changed, 13 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 49446a8..0a562aa 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -633,6 +633,9 @@  extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_INT32_ARRAY(_f, _s, _n)                               \
     VMSTATE_INT32_ARRAY_TEST(_f, _s, _n, NULL)

+#define VMSTATE_INT64_ARRAY(_f, _s, _n)                               \
+    VMSTATE_ARRAY_TEST(_f, _s, _n, NULL, vmstate_info_int64, int64_t)
+
 #define VMSTATE_UINT16_2DARRAY_V(_f, _s, _n1, _n2, _v)                \
     VMSTATE_2DARRAY(_f, _s, _n1, _n2, _v, vmstate_info_uint16, uint16_t)

@@ -657,12 +660,6 @@  extern const VMStateInfo vmstate_info_bitmap;
 #define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num)                \
     VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t)

-#define VMSTATE_INT64_ARRAY_V(_f, _s, _n, _v)                         \
-    VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_int64, int64_t)
-
-#define VMSTATE_INT64_ARRAY(_f, _s, _n)                               \
-    VMSTATE_INT64_ARRAY_V(_f, _s, _n, 0)
-
 #define VMSTATE_FLOAT64_ARRAY_V(_f, _s, _n, _v)                       \
     VMSTATE_ARRAY(_f, _s, _n, _v, vmstate_info_float64, float64)

diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c
index d7f2223..a930bde 100644
--- a/tests/test-vmstate.c
+++ b/tests/test-vmstate.c
@@ -522,6 +522,7 @@  typedef struct TestArray {
     int16_t i16_1[VMSTATE_ARRAY_SIZE];
     int32_t i32_1[VMSTATE_ARRAY_SIZE];
     int32_t i32_2[VMSTATE_ARRAY_SIZE];
+    int64_t i64_1[VMSTATE_ARRAY_SIZE];
 } TestArray;

 TestArray obj_array = {
@@ -538,6 +539,7 @@  TestArray obj_array = {
     .i16_1 = {41, 42, 43, 44, 45},
     .i32_1 = {51, 52, 53, 54, 55},
     .i32_2 = {55, 54, 53, 52, 51},
+    .i64_1 = {61, 62, 63, 64, 65},
 };

 static const VMStateDescription vmstate_array_primitive = {
@@ -554,6 +556,7 @@  static const VMStateDescription vmstate_array_primitive = {
         VMSTATE_UINT64_ARRAY(u64_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_INT16_ARRAY(i16_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_INT32_ARRAY(i32_1, TestArray, VMSTATE_ARRAY_SIZE),
+        VMSTATE_INT64_ARRAY(i64_1, TestArray, VMSTATE_ARRAY_SIZE),
         VMSTATE_END_OF_LIST()
     }
 };
@@ -575,6 +578,11 @@  uint8_t wire_array_primitive[] = {
     /* i32_1 */ 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x34,
                 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x36,
                 0x00, 0x00, 0x00, 0x37,
+    /* i64_1 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
+                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41,
     QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
 };

@@ -599,6 +607,7 @@  static void obj_array_copy(void *arg1, void *arg2)
         target->i16_1[i] = source->i16_1[i];
         target->i32_1[i] = source->i32_1[i];
         target->i32_2[i] = source->i32_2[i];
+        target->i64_1[i] = source->i64_1[i];
     }
 }

@@ -634,6 +643,7 @@  static void test_array_primitive(void)
         ELEM_EQUAL(u64_1, i);
         ELEM_EQUAL(i16_1, i);
         ELEM_EQUAL(i32_1, i);
+        ELEM_EQUAL(i64_1, i);
     }
 }