[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 092/124] vmstate: Test for VMSTATE_BUFFER_START_MIDD
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 092/124] vmstate: Test for VMSTATE_BUFFER_START_MIDDLE |
Date: |
Mon, 21 Apr 2014 16:41:12 +0200 |
Signed-off-by: Juan Quintela <address@hidden>
---
tests/test-vmstate.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c
index ddfa017..8b114fa 100644
--- a/tests/test-vmstate.c
+++ b/tests/test-vmstate.c
@@ -868,11 +868,13 @@ static void test_array_sub(void)
typedef struct TestBuffer {
uint8_t buffer[6];
uint8_t partial[13];
+ uint8_t middle[13];
} TestBuffer;
TestBuffer obj_buffer = {
.buffer = "hello",
.partial = "This is Juan",
+ .middle = "hello world!"
};
static const VMStateDescription vmstate_buffer_simple = {
@@ -883,6 +885,7 @@ static const VMStateDescription vmstate_buffer_simple = {
.fields = (VMStateField[]) {
VMSTATE_BUFFER(buffer, TestBuffer),
VMSTATE_PARTIAL_BUFFER(partial, TestBuffer, 4),
+ VMSTATE_BUFFER_START_MIDDLE(middle, TestBuffer, 6),
VMSTATE_END_OF_LIST()
}
};
@@ -890,6 +893,7 @@ static const VMStateDescription vmstate_buffer_simple = {
uint8_t wire_buffer_simple[] = {
/* buffer */ 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00,
/* partial */ 0x54, 0x68, 0x69, 0x73,
+ /* middle */ 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21, 0x00,
QEMU_VM_EOF, /* just to ensure we won't get EOF reported prematurely */
};
@@ -900,6 +904,7 @@ static void obj_buffer_copy(void *arg1, void *arg2)
memcpy(target->buffer, source->buffer, 6);
memcpy(target->partial, source->partial, 13);
+ memcpy(target->middle, source->middle, 13);
}
static void test_buffer_simple(void)
@@ -919,6 +924,8 @@ static void test_buffer_simple(void)
SUCCESS(memcmp(obj.buffer, obj_buffer.buffer, sizeof(obj.buffer)));
SUCCESS(memcmp(obj.partial, obj_buffer.partial, 4));
FAILURE(memcmp(obj.partial+4, obj_buffer.partial+4,
sizeof(obj.partial)-4));
+ FAILURE(memcmp(obj.middle, obj_buffer.middle, 6));
+ SUCCESS(memcmp(obj.middle+6, obj_buffer.middle+6, sizeof(obj.middle)-6));
}
typedef struct TestVersioned {
--
1.9.0
- [Qemu-devel] [PATCH 084/124] vmstate: Create VMSTATE_OPENCODED_UNSAFE, (continued)
- [Qemu-devel] [PATCH 084/124] vmstate: Create VMSTATE_OPENCODED_UNSAFE, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 085/124] vmstate: Create VMSTATE_SYNTHETIC, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 086/124] vmstate: version_id is gone from fields, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 087/124] vmstate: Test for VMSTATE_SYNTHETIC, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 089/124] vmstate: Test for VMSTATE_UINT32_SUB_ARRAY, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 090/124] vmstate: Test for VMSTATE_BUFFER, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 088/124] vmstate: Test for VMSTATE_UINT8_SUB_ARRAY, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 091/124] vmstate: Test for VMSTATE_PARTIAL_BUFFER, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 093/124] vmstate: Test for VMSTATE_BUFFER_TEST, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 094/124] vmstate: Use VMSTATE_UINT8_2DARRAY instead of VMSTATE_BUFFER_TEST, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 092/124] vmstate: Test for VMSTATE_BUFFER_START_MIDDLE,
Juan Quintela <=
- [Qemu-devel] [PATCH 095/124] vmstate: Test for VMSTATE_BUFFER_UNSAFE, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 096/124] vmstate: Remove unused VMSTATE_SUB_VBUFFER, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 097/124] vmstate: Remove unused VMSTATE_PARTIAL_VBUFFER_UINT32, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 099/124] vmstate: Rename VMSTATE_PARTIAL_VBUFFER to VMSTATE_VBUFFER_INT32, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 098/124] vmstate: Test for VMSTATE_PARTIAL_VBUFFER, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 100/124] vmstate: Create VMS_VBUFFER_UINT32, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 101/124] vmstate: Rename VMS_VBUFFER to VMST_VBUFFER_INT32 for consintency, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 102/124] vmstate: Test for VMSTATE_VBUFFER_UINT32, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 104/124] vmstate: Test for VMSTATE_POINTER, Juan Quintela, 2014/04/21
- [Qemu-devel] [PATCH 105/124] vmstate: Test for VMSTATE_POINTER_UNSAFE, Juan Quintela, 2014/04/21