vmstate code split + unit tests
cover vmstate code split + unit tests
This series separates the QEMUFile and VMState code from savevm.c, and adds a few unit tests to the VMState code.
Eduardo Habkost (9):
qemu-file: Make a few functions non-static
migration: Move QEMU_VM_* defines to migration/migration.h
savevm: Convert all tabs to spaces
savevm.c: Coding style fixes
savevm.c: Coding style fix
vmstate: Move VMState code to vmstate.c
qemu-file: Move QEMUFile code to qemu-file.c
savevm: Small comment about why timer QEMUFile/VMState code is in
savevm.c
tests: Some unit tests for vmstate.c
Makefile.objs | 2 + include/migration/migration.h | 11 + include/migration/qemu-file.h | 4 + qemu-file.c | 826 +++++++++++++++++++++ savevm.c | 1590 ++--------------------------------------- tests/.gitignore | 1 + tests/Makefile | 4 + tests/test-vmstate.c | 357 +++++++++ vmstate.c | 650 +++++++++++++++++ 9 files changed, 1921 insertions(+), 1524 deletions(-) create mode 100644 qemu-file.c create mode 100644 tests/test-vmstate.c create mode 100644 vmstate.c
Signature · 1 line
1.8.3.1
PATCH 1/9 qemu-file: Make a few functions non-static
The QEMUFile code will be moved to qemu-file.c. This will require making the following functions non-static because they are used by the savevm.c code:
* qemu_peek_byte()
* qemu_peek_buffer()
* qemu_file_skip()
* qemu_file_set_error()
--- include/migration/qemu-file.h | 4 ++++ savevm.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-)
include/migration/qemu-file.h +4 -0
@@ -121,8 +121,11 @@ static inline void qemu_put_ubyte(QEMUFile *f, unsigned int v)void qemu_put_be16 (QEMUFile *f,unsigned int v);void qemu_put_be32 (QEMUFile *f,unsigned int v);void qemu_put_be64 (QEMUFile *f,uint64_t v); +int qemu_peek_buffer (QEMUFile *f,uint8_t *buf,int size,size_t offset);int qemu_get_buffer (QEMUFile *f,uint8_t *buf,int size); +int qemu_peek_byte (QEMUFile *f,int offset);int qemu_get_byte (QEMUFile *f); +void qemu_file_skip (QEMUFile *f,int size);void qemu_update_position (QEMUFile *f,size_t size);static inline unsigned int qemu_get_ubyte (QEMUFile *f)
@@ -141,6 +144,7 @@ void qemu_file_reset_rate_limit(QEMUFile *f);void qemu_file_set_rate_limit (QEMUFile *f,int64_t new_rate);int64_t qemu_file_get_rate_limit (QEMUFile *f);int qemu_file_get_error (QEMUFile *f); +void qemu_file_set_error (QEMUFile *f,int ret);void qemu_fflush (QEMUFile *f);static inline void qemu_put_be64s (QEMUFile *f,const uint64_t *pv)
savevm.c +4 -4
@@ -578,7 +578,7 @@ int qemu_file_get_error(QEMUFile *f)return f->last_error; } -static void qemu_file_set_error (QEMUFile *f,int ret) +void qemu_file_set_error (QEMUFile *f,int ret) {if (f->last_error ==0 ) { f->last_error = ret;
@@ -827,14 +827,14 @@ void qemu_put_byte(QEMUFile *f, int v) } } -static void qemu_file_skip (QEMUFile *f,int size) +void qemu_file_skip (QEMUFile *f,int size) {if (f->buf_index + size <= f->buf_size) { f->buf_index += size; } } -static int qemu_peek_buffer (QEMUFile *f,uint8_t *buf,int size,size_t offset) +int qemu_peek_buffer (QEMUFile *f,uint8_t *buf,int size,size_t offset) {int pending;int index;
@@ -880,7 +880,7 @@ int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size)return done; } -static int qemu_peek_byte (QEMUFile *f,int offset) +int qemu_peek_byte (QEMUFile *f,int offset) {int index = f->buf_index + offset;
Signature · 1 line
1.8.3.1
PATCH 2/9 migration: Move QEMU_VM_* defines to migration/migration.h
In reply to Eduardo HabkostThe VMState code will be moved to vmstate.c and it uses some of the QEMU_VM_* constants, so move it to a header.
--- include/migration/migration.h | 11 +++++++++++ savevm.c | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-)
include/migration/migration.h +11 -0
@@ -23,6 +23,17 @@#include "qapi-types.h" #include "exec/cpu-common.h" +#define QEMU_VM_FILE_MAGIC 0x5145564d +#define QEMU_VM_FILE_VERSION_COMPAT 0x00000002 +#define QEMU_VM_FILE_VERSION 0x00000003 + +#define QEMU_VM_EOF 0x00 +#define QEMU_VM_SECTION_START 0x01 +#define QEMU_VM_SECTION_PART 0x02 +#define QEMU_VM_SECTION_END 0x03 +#define QEMU_VM_SECTION_FULL 0x04 +#define QEMU_VM_SUBSECTION 0x05 +struct MigrationParams {bool blk;bool shared;
savevm.c +0 -11
@@ -1821,17 +1821,6 @@ static void vmstate_save(QEMUFile *f, SaveStateEntry *se)vmstate_save_state (f,se->vmsd, se->opaque); } -#define QEMU_VM_FILE_MAGIC 0x5145564d -#define QEMU_VM_FILE_VERSION_COMPAT 0x00000002 -#define QEMU_VM_FILE_VERSION 0x00000003 - -#define QEMU_VM_EOF 0x00 -#define QEMU_VM_SECTION_START 0x01 -#define QEMU_VM_SECTION_PART 0x02 -#define QEMU_VM_SECTION_END 0x03 -#define QEMU_VM_SECTION_FULL 0x04 -#define QEMU_VM_SUBSECTION 0x05 -bool qemu_savevm_state_blocked (Error **errp) {SaveStateEntry *se;
Signature · 1 line
1.8.3.1
PATCH 3/9 savevm: Convert all tabs to spaces
In reply to Eduardo Habkost--- savevm.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
savevm.c +9 -9
@@ -53,7 +53,7 @@#define ARP_OP_REQUEST_REV 0x3static int announce_self_create (uint8_t *buf, -uint8_t *mac_addr) +uint8_t *mac_addr) {/* Ethernet header. */ memset (buf,0xff ,6 );/* destination MAC addr */
@@ -100,16 +100,16 @@ static void qemu_announce_self_once(void *opaque)timer_mod (timer,qemu_clock_get_ms (QEMU_CLOCK_REALTIME ) +50 + (SELF_ANNOUNCE_ROUNDS - count -1 ) *100 ); }else { -timer_del (timer); -timer_free (timer); +timer_del (timer); +timer_free (timer); } }void qemu_announce_self (void ) { -static QEMUTimer *timer; - timer =timer_new_ms (QEMU_CLOCK_REALTIME , qemu_announce_self_once, &timer); -qemu_announce_self_once (&timer); +static QEMUTimer *timer; + timer =timer_new_ms (QEMU_CLOCK_REALTIME , qemu_announce_self_once, &timer); +qemu_announce_self_once (&timer); }/***********************************************************/
@@ -420,8 +420,8 @@ QEMUFile *qemu_fdopen(int fd, const char *mode)QEMUFileSocket *s;if (mode ==NULL || - (mode[0 ] !='r' && mode[0 ] !='w' ) || - mode[1 ] !='b' || mode[2 ] !=0 ) { + (mode[0 ] !='r' && mode[0 ] !='w' ) || + mode[1 ] !='b' || mode[2 ] !=0 ) {fprintf (stderr,"qemu_fdopen: Argument validity check failed\n" );return NULL ; }
@@ -1959,7 +1959,7 @@ void qemu_savevm_state_complete(QEMUFile *f)int len;if ((!se->ops || !se->ops->save_state) && !se->vmsd) { -continue ; +continue ; }trace_savevm_section_start ();/* Section type */
Signature · 1 line
1.8.3.1
PATCH 4/9 savevm.c: Coding style fixes
In reply to Eduardo Habkost--- savevm.c | 75 +++++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 44 insertions(+), 31 deletions(-)
savevm.c +44 -31
@@ -137,14 +137,12 @@ struct QEMUFile {int last_error; }; -typedef struct QEMUFileStdio -{ +typedef struct QEMUFileStdio {FILE *stdio_file;QEMUFile *file; }QEMUFileStdio ; -typedef struct QEMUFileSocket -{ +typedef struct QEMUFileSocket {int fd;QEMUFile *file; }QEMUFileSocket ;
@@ -208,7 +206,8 @@ static int stdio_get_fd(void *opaque)return fileno (s->stdio_file); } -static int stdio_put_buffer (void *opaque,const uint8_t *buf,int64_t pos,int size) +static int stdio_put_buffer (void *opaque,const uint8_t *buf,int64_t pos, +int size) {QEMUFileStdio *s = opaque;return fwrite (buf,1 , size, s->stdio_file);
@@ -310,7 +309,7 @@ QEMUFile *qemu_popen_cmd(const char *command, const char *mode) s->stdio_file = stdio_file; -if (mode[0 ] =='r' ) { +if (mode[0 ] =='r' ) { s->file =qemu_fopen_ops (s, &stdio_pipe_read_ops); }else { s->file =qemu_fopen_ops (s, &stdio_pipe_write_ops);
@@ -429,7 +428,7 @@ QEMUFile *qemu_fdopen(int fd, const char *mode) s =g_malloc0 (sizeof (QEMUFileSocket)); s->fd = fd; -if (mode[0 ] =='r' ) { +if (mode[0 ] =='r' ) { s->file =qemu_fopen_ops (s, &unix_read_ops); }else { s->file =qemu_fopen_ops (s, &unix_write_ops);
@@ -491,10 +490,11 @@ QEMUFile *qemu_fopen(const char *filename, const char *mode) s =g_malloc0 (sizeof (QEMUFileStdio)); s->stdio_file =fopen (filename, mode); -if (!s->stdio_file) +if (!s->stdio_file) { goto fail; - -if (mode[0 ] =='w' ) { + } + +if (mode[0 ] =='w' ) { s->file =qemu_fopen_ops (s, &stdio_file_write_ops); }else { s->file =qemu_fopen_ops (s, &stdio_file_read_ops);
@@ -550,8 +550,9 @@ static const QEMUFileOps bdrv_write_ops = {static QEMUFile *qemu_fopen_bdrv (BlockDriverState *bs,int is_writable) { -if (is_writable) +if (is_writable) {return qemu_fopen_ops (bs, &bdrv_write_ops); + }return qemu_fopen_ops (bs, &bdrv_read_ops); }
@@ -703,8 +704,9 @@ static void qemu_fill_buffer(QEMUFile *f) f->pos += len; }else if (len ==0 ) {qemu_file_set_error (f, -EIO ); - }else if (len != -EAGAIN ) + }else if (len != -EAGAIN ) {qemu_file_set_error (f, len); + } }int qemu_get_fd (QEMUFile *f)
@@ -791,8 +793,9 @@ void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size)while (size >0 ) { l =IO_BUF_SIZE - f->buf_index; -if (l > size) +if (l > size) { l = size; + }memcpy (f->buf + f->buf_index, buf, l); f->bytes_xfer += l;if (f->ops->writev_buffer) {
@@ -1100,8 +1103,9 @@ static int get_int32_equal(QEMUFile *f, void *pv, size_t size)int32_t v2;qemu_get_sbe32s (f, &v2); -if (*v == v2) +if (*v == v2) {return 0 ; + }return -EINVAL ; }
@@ -1120,8 +1124,9 @@ static int get_int32_le(QEMUFile *f, void *pv, size_t size)int32_t new;qemu_get_sbe32s (f, &new); -if (*old <= new) +if (*old <= new) {return 0 ; + }return -EINVAL ; }
@@ -1287,8 +1292,9 @@ static int get_uint8_equal(QEMUFile *f, void *pv, size_t size)uint8_t v2;qemu_get_8s (f, &v2); -if (*v == v2) +if (*v == v2) {return 0 ; + }return -EINVAL ; }
@@ -1307,8 +1313,9 @@ static int get_uint16_equal(QEMUFile *f, void *pv, size_t size)uint16_t v2;qemu_get_be16s (f, &v2); -if (*v == v2) +if (*v == v2) {return 0 ; + }return -EINVAL ; }
@@ -1502,8 +1509,9 @@ static int calculate_compat_instance_id(const char *idstr)int instance_id =0 ; QTAILQ_FOREACH(se, &savevm_handlers, entry) { -if (!se->compat) +if (!se->compat) {continue ; + }if (strcmp (idstr, se->compat->idstr) ==0 && instance_id <= se->compat->instance_id) {
@@ -1690,10 +1698,11 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, }if (vmsd->pre_load) {int ret = vmsd->pre_load (opaque); -if (ret) +if (ret) {return ret; + } } -while (field->name) { +while (field->name) { if ((field->field_exists && field->field_exists(opaque, version_id)) || (!field->field_exists &&
@@ -1729,7 +1738,8 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, addr = *(void **)addr; }if (field->flags &VMS_STRUCT ) { - ret =vmstate_load_state (f, field->vmsd, addr, field->vmsd->version_id); + ret =vmstate_load_state (f, field->vmsd, addr, + field->vmsd->version_id); }else { ret = field->info->get (f, addr, size);
@@ -1759,7 +1769,7 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,if (vmsd->pre_save) { vmsd->pre_save (opaque); } -while (field->name) { +while (field->name) {if (!field->field_exists || field->field_exists (opaque, vmsd->version_id)) {void *base_addr = opaque + field->offset;
@@ -1818,7 +1828,7 @@ static void vmstate_save(QEMUFile *f, SaveStateEntry *se) se->ops->save_state (f, se->opaque);return ; } -vmstate_save_state (f,se->vmsd, se->opaque); +vmstate_save_state (f, se->vmsd, se->opaque); }bool qemu_savevm_state_blocked (Error **errp)
@@ -1846,7 +1856,7 @@ void qemu_savevm_state_begin(QEMUFile *f, } se->ops->set_params (params, se->opaque); } - +qemu_put_be32 (f,QEMU_VM_FILE_MAGIC );qemu_put_be32 (f,QEMU_VM_FILE_VERSION );
@@ -2106,7 +2116,7 @@ static SaveStateEntry *find_se(const char *idstr, int instance_id)static const VMStateDescription *vmstate_get_subsection (const VMStateSubsection *sub,char *idstr) { -while (sub && sub->needed) { +while (sub && sub->needed) {if (strcmp (idstr, sub->vmsd->name) ==0 ) {return sub->vmsd; }
@@ -2198,16 +2208,18 @@ int qemu_loadvm_state(QEMUFile *f) } v =qemu_get_be32 (f); -if (v !=QEMU_VM_FILE_MAGIC ) +if (v !=QEMU_VM_FILE_MAGIC ) {return -EINVAL ; + } v =qemu_get_be32 (f);if (v ==QEMU_VM_FILE_VERSION_COMPAT ) {fprintf (stderr,"SaveVM v2 format is obsolete and don't work anymore\n" );return -ENOTSUP ; } -if (v !=QEMU_VM_FILE_VERSION ) +if (v !=QEMU_VM_FILE_VERSION ) {return -ENOTSUP ; + }while ((section_type =qemu_get_byte (f)) !=QEMU_VM_EOF ) {uint32_t instance_id, version_id, section_id;
@@ -2326,8 +2338,7 @@ static int del_existing_snapshots(Monitor *mon, const char *name) bs =NULL ;while ((bs =bdrv_next (bs))) {if (bdrv_can_snapshot (bs) && -bdrv_snapshot_find (bs, snapshot, name) >=0 ) - { +bdrv_snapshot_find (bs, snapshot, name) >=0 ) {bdrv_snapshot_delete_by_id_or_name (bs, name, &err);if (error_is_set (&err)) { monitor_printf(mon,
@@ -2437,8 +2448,9 @@ void do_savevm(Monitor *mon, const QDict *qdict) } the_end: -if (saved_vm_running) +if (saved_vm_running) {vm_start (); + } }void qmp_xen_save_devices_state (const char *filename,Error **errp)
@@ -2462,8 +2474,9 @@ void qmp_xen_save_devices_state(const char *filename, Error **errp) } the_end: -if (saved_vm_running) +if (saved_vm_running) {vm_start (); + } }int load_vmstate (const char *name)
Signature · 1 line
1.8.3.1
PATCH 5/9 savevm.c: Coding style fix
In reply to Eduardo Habkost---
I am submitting this as a separate patch because I don't know if this will be the preferred way of breaking that line.
--- savevm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
savevm.c +2 -1
@@ -2114,7 +2114,8 @@ static SaveStateEntry *find_se(const char *idstr, int instance_id)return NULL ; } -static const VMStateDescription *vmstate_get_subsection (const VMStateSubsection *sub,char *idstr) +static const VMStateDescription * +vmstate_get_subsection (const VMStateSubsection *sub,char *idstr) {while (sub && sub->needed) {if (strcmp (idstr, sub->vmsd->name) ==0 ) {
Signature · 1 line
1.8.3.1
PATCH 6/9 vmstate: Move VMState code to vmstate.c
In reply to Eduardo HabkostThis will allow unit tests to be written for VMState code without pulling dependencies from the savevm code.
--- Makefile.objs | 1 + savevm.c | 645 --------------------------------------------------------- vmstate.c | 650 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 651 insertions(+), 645 deletions(-) create mode 100644 vmstate.c
Makefile.objs +1 -0
@@ -51,6 +51,7 @@ common-obj-$(CONFIG_POSIX) += os-posix.o common-obj-$(CONFIG_LINUX) += fsdev/ common-obj-y += migration.o migration-tcp.o +common-obj-y += vmstate.o common-obj-$(CONFIG_RDMA) += migration-rdma.o common-obj-y += qemu-char.o #aio.o common-obj-y += block-migration.o
savevm.c +0 -645
675 lines not on this page · raw message
vmstate.c new file +650 -0
650 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 7/9 qemu-file: Move QEMUFile code to qemu-file.c
In reply to Eduardo Habkost--- Makefile.objs | 1 + qemu-file.c | 826 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ savevm.c | 820 --------------------------------------------------------- 3 files changed, 827 insertions(+), 820 deletions(-) create mode 100644 qemu-file.c
Makefile.objs +1 -0
@@ -52,6 +52,7 @@ common-obj-$(CONFIG_LINUX) += fsdev/ common-obj-y += migration.o migration-tcp.o common-obj-y += vmstate.o +common-obj-y += qemu-file.o common-obj-$(CONFIG_RDMA) += migration-rdma.o common-obj-y += qemu-char.o #aio.o common-obj-y += block-migration.o
qemu-file.c new file +826 -0
826 lines not on this page · raw message
savevm.c +0 -820
832 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH 8/9 savevm: Small comment about why timer QEMUFile/VMState code is in savevm.c
In reply to Eduardo Habkost--- savevm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
savevm.c +6 -2
@@ -166,7 +166,9 @@ static QEMUFile *qemu_fopen_bdrv(BlockDriverState *bs, int is_writable) } -/* timer */ +/* QEMUFile timer support. +* Not in qemu-file.c to not add qemu-file.c as dependency to qemu-file.c +*/ void timer_put (QEMUFile *f,QEMUTimer *ts) {
@@ -189,7 +191,9 @@ void timer_get(QEMUFile *f, QEMUTimer *ts) } -/* timers */ +/* VMState timer support. +* Not in vmstate.c to not add qemu-file.c as dependency to vmstate.c +*/ static int get_timer (QEMUFile *f,void *pv,size_t size) {
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 8/9] savevm: Small comment about why timer QEMUFile/VMState code is in savevm.c
Am 28.11.2013 15:01, schrieb Eduardo Habkost:
Quoted 10 lines
Signed-off-by Eduardo Habkost <[email protected]>--- savevm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)savevm.c +0
-0
savevm.c static QEMUFile *qemu_fopen_bdrv(BlockDriverState *bs, int is_writable) · line 170
Quoted 6 lines
savevm.c +2
-1@@ -166,7 +166,9 @@ static QEMUFile *qemu_fopen_bdrv(BlockDriverState *bs, int is_writable) } -/* timer */ +/* QEMUFile timer support. +* Not in qemu-file.c to not add qemu-file.c as dependency to qemu-file.c
Typo?
Andreas
Quoted 16 lines
savevm.c +4
-1+*/ void timer_put (QEMUFile *f,QEMUTimer *ts) {@@ -189,7 +191,9 @@ void timer_get(QEMUFile *f, QEMUTimer *ts) } -/* timers */ +/* VMState timer support. +* Not in vmstate.c to not add qemu-file.c as dependency to vmstate.c +*/ static int get_timer (QEMUFile *f,void *pv,size_t size) {
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Re: [Qemu-devel] [PATCH 8/9] savevm: Small comment about why timer QEMUFile/VMState code is in savevm.c
Quoted 14 lines · Andreas Färber
Am 28.11.2013 15:01, schrieb Eduardo Habkost:
Quoted 13 lines
Signed-off-by Eduardo Habkost <[email protected]>--- savevm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)savevm.c +0
-0@@ -166,7 +166,9 @@ static QEMUFile *qemu_fopen_bdrv(BlockDriverState *bs, int is_writable) }
Quoted 5 lines
savevm.c static QEMUFile *qemu_fopen_bdrv(BlockDriverState *bs, int is_writable) · line 170
Quoted 3 lines
savevm.c +2
-1-/* timer */ +/* QEMUFile timer support. +* Not in qemu-file.c to not add qemu-file.c as dependency to qemu-file.c Typo?
Yes. It was meant to be "add qemu-timer.c as dependency to qemu-file.c". Thanks!
Signature · 1 line
Eduardo
PATCH v2 8/9 savevm: Small comment about why timer QEMUFile/VMState code is in savevm.c
---
Changes v1 -> v2:
* Fix typo: qemu-file.c -> qemu-timer.c
--- savevm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
savevm.c +6 -2
@@ -166,7 +166,9 @@ static QEMUFile *qemu_fopen_bdrv(BlockDriverState *bs, int is_writable) } -/* timer */ +/* QEMUFile timer support. +* Not in qemu-file.c to not add qemu-timer.c as dependency to qemu-file.c +*/ void timer_put (QEMUFile *f,QEMUTimer *ts) {
@@ -189,7 +191,9 @@ void timer_get(QEMUFile *f, QEMUTimer *ts) } -/* timers */ +/* VMState timer support. +* Not in vmstate.c to not add qemu-timer.c as dependency to vmstate.c +*/ static int get_timer (QEMUFile *f,void *pv,size_t size) {
Signature · 1 line
1.8.3.1
PATCH 9/9 tests: Some unit tests for vmstate.c
In reply to Eduardo Habkost * Basic load/save tests
* Tests for loading older versions
* Tests for .field_exists() handling
--- tests/.gitignore | 1 + tests/Makefile | 4 + tests/test-vmstate.c | 357 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 362 insertions(+) create mode 100644 tests/test-vmstate.c
tests/.gitignore +1 -0
@@ -20,6 +20,7 @@ test-qmp-commands test-qmp-input-strict test-qmp-marshal.c test-thread-pool +test-vmstate test-x86-cpuid test-xbzrle *-test
tests/Makefile +4 -0
@@ -52,6 +52,7 @@ check-unit-y += tests/test-int128$(EXESUF) gcov-files-test-int128-y = check-unit-y += tests/test-bitops$(EXESUF) check-unit-y += tests/test-qdev-global-props$(EXESUF) +check-unit-y += tests/test-vmstate$(EXESUF) check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
@@ -162,6 +163,9 @@ tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \ qom/object.o qom/container.o qom/qom-qobject.o \ $(test-qapi-obj-y) \ libqemuutil.a libqemustub.a +tests/test-vmstate$(EXESUF): tests/test-vmstate.o \ + vmstate.o qemu-file.o \ + libqemuutil.a tests/test-qapi-types.c tests/test-qapi-types.h :\ $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
tests/test-vmstate.c new file +357 -0
357 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Quoted 25 lines · Eduardo Habkost
This series separates the QEMUFile and VMState code from
savevm.c, and adds a few unit tests to the VMState code.Eduardo Habkost (9):
qemu-file: Make a few functions non-static
migration: Move QEMU_VM_* defines tomigration/migration.h
savevm: Convert all tabs to spaces
savevm.c: Coding style fixes
savevm.c: Coding style fix
vmstate: Move VMState code tovmstate.c
qemu-file: Move QEMUFile code toqemu-file.c
savevm: Small comment about why timer QEMUFile/VMState code is in
savevm.c
tests: Some unit tests forvmstate.cMakefile.objs | 2 + include/migration/migration.h | 11 + include/migration/qemu-file.h | 4 + qemu-file.c | 826 +++++++++++++++++++++ savevm.c | 1590 ++--------------------------------------- tests/.gitignore | 1 + tests/Makefile | 4 + tests/test-vmstate.c | 357 +++++++++ vmstate.c | 650 +++++++++++++++++ 9 files changed, 1921 insertions(+), 1524 deletions(-)
Quoted 4 lines
create mode 100644
qemu-file.c
create mode 100644tests/test-vmstate.c
create mode 100644vmstate.c
Series Reviewed-by: Orit Wasserman <[email protected]> (with v2 of patch 8)