From: Marc-André Lureau <marcandre.lur...@redhat.com> Add a new macro to make the qemu command line with other values of memory size, and specific chardev id.
Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> --- tests/vhost-user-test.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 8daef01..b2ac454 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -37,10 +37,10 @@ #endif #define QEMU_CMD_ACCEL " -machine accel=tcg" -#define QEMU_CMD_MEM " -m 512 -object memory-backend-file,id=mem,size=512M,"\ +#define QEMU_CMD_MEM " -m %d -object memory-backend-file,id=mem,size=%dM,"\ "mem-path=%s,share=on -numa node,memdev=mem" -#define QEMU_CMD_CHR " -chardev socket,id=chr0,path=%s" -#define QEMU_CMD_NETDEV " -netdev vhost-user,id=net0,chardev=chr0,vhostforce" +#define QEMU_CMD_CHR " -chardev socket,id=%s,path=%s" +#define QEMU_CMD_NETDEV " -netdev vhost-user,id=net0,chardev=%s,vhostforce" #define QEMU_CMD_NET " -device virtio-net-pci,netdev=net0 " #define QEMU_CMD_ROM " -option-rom ../pc-bios/pxe-virtio.rom" @@ -389,9 +389,13 @@ static TestServer *test_server_new(const gchar *name) return server; } -#define GET_QEMU_CMD(s) \ - g_strdup_printf(QEMU_CMD, (hugefs), (s)->socket_path) +#define GET_QEMU_CMD(s) \ + g_strdup_printf(QEMU_CMD, 512, 512, (hugefs), \ + (s)->chr_name, (s)->socket_path, (s)->chr_name) +#define GET_QEMU_CMDE(s, mem, extra, ...) \ + g_strdup_printf(QEMU_CMD extra, (mem), (mem), (hugefs), \ + (s)->chr_name, (s)->socket_path, (s)->chr_name, ##__VA_ARGS__) static void test_server_free(TestServer *server) { -- 2.4.3