From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Yuanhan Liu" <yuanhan.liu@linux.intel.com>,
"Igor Mammedov" <imammedo@redhat.com>,
=?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
<marcandre.lureau@redhat.com>
Subject: [Qemu-devel] [PULL 22/25] vhost-user-test: learn to tweak various qemu arguments
Date: Fri, 9 Oct 2015 00:18:15 +0300 [thread overview]
Message-ID: <1444338957-15293-23-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1444338957-15293-1-git-send-email-mst@redhat.com>
From: Marc-André Lureau <marcandre.lureau@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.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
tests/vhost-user-test.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 034d89b..791d849 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -30,10 +30,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"
@@ -132,6 +132,9 @@ static gboolean g_cond_wait_until(CompatGCond cond, CompatGMutex mutex,
}
#endif
+static const char *tmpfs;
+static const char *root;
+
static void wait_for_fds(TestServer *s)
{
gint64 end_time;
@@ -317,7 +320,7 @@ static const char *init_hugepagefs(const char *path)
return path;
}
-static TestServer *test_server_new(const gchar *tmpfs, const gchar *name)
+static TestServer *test_server_new(const gchar *name)
{
TestServer *server = g_new0(TestServer, 1);
gchar *chr_path;
@@ -337,9 +340,13 @@ static TestServer *test_server_new(const gchar *tmpfs, const gchar *name)
return server;
}
-#define GET_QEMU_CMD(s, root) \
- g_strdup_printf(QEMU_CMD, (root), (s)->socket_path)
+#define GET_QEMU_CMD(s) \
+ g_strdup_printf(QEMU_CMD, 512, 512, (root), (s)->chr_name, \
+ (s)->socket_path, (s)->chr_name)
+#define GET_QEMU_CMDE(s, mem, extra, ...) \
+ g_strdup_printf(QEMU_CMD extra, (mem), (mem), (root), (s)->chr_name, \
+ (s)->socket_path, (s)->chr_name, ##__VA_ARGS__)
static void test_server_free(TestServer *server)
{
@@ -365,8 +372,6 @@ int main(int argc, char **argv)
char *qemu_cmd = NULL;
int ret;
char template[] = "/tmp/vhost-test-XXXXXX";
- const char *tmpfs;
- const char *root;
g_test_init(&argc, &argv, NULL);
@@ -387,12 +392,12 @@ int main(int argc, char **argv)
root = tmpfs;
}
- server = test_server_new(tmpfs, "test");
+ server = test_server_new("test");
/* run the main loop thread so the chardev may operate */
g_thread_new(NULL, thread_function, NULL);
- qemu_cmd = GET_QEMU_CMD(server, root);
+ qemu_cmd = GET_QEMU_CMD(server);
s = qtest_start(qemu_cmd);
g_free(qemu_cmd);
--
MST
next prev parent reply other threads:[~2015-10-08 21:18 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-08 21:16 [Qemu-devel] [PULL 00/25] virtio,pc features, fixes Michael S. Tsirkin
2015-10-08 21:16 ` [Qemu-devel] [PULL 01/25] configure: probe for memfd Michael S. Tsirkin
2015-10-08 21:16 ` [Qemu-devel] [PULL 02/25] linux-headers: add unistd.h Michael S. Tsirkin
2015-10-08 21:16 ` [Qemu-devel] [PULL 03/25] util: add linux-only memfd fallback Michael S. Tsirkin
2015-10-08 21:16 ` [Qemu-devel] [PULL 04/25] util: add memfd helpers Michael S. Tsirkin
2015-10-08 21:16 ` [Qemu-devel] [PULL 05/25] util: add fallback for qemu_memfd_alloc() Michael S. Tsirkin
2015-10-08 21:16 ` [Qemu-devel] [PULL 06/25] vhost: document log resizing Michael S. Tsirkin
2015-10-08 21:16 ` [Qemu-devel] [PULL 07/25] vhost: add vhost_set_log_base op Michael S. Tsirkin
2015-10-08 21:17 ` [Qemu-devel] [PULL 08/25] vhost-user: add vhost_user_requires_shm_log() Michael S. Tsirkin
2015-10-08 21:17 ` [Qemu-devel] [PULL 09/25] vhost: alloc shareable log Michael S. Tsirkin
2015-10-08 21:17 ` [Qemu-devel] [PULL 10/25] vhost-user: send log shm fd along with log_base Michael S. Tsirkin
2015-10-08 21:17 ` [Qemu-devel] [PULL 11/25] vhost-user: add a migration blocker Michael S. Tsirkin
2015-10-08 21:17 ` [Qemu-devel] [PULL 12/25] vhost: use a function for each call Michael S. Tsirkin
2015-10-09 6:40 ` Thibaut Collet
2015-10-09 7:37 ` Michael S. Tsirkin
2015-10-08 21:17 ` [Qemu-devel] [PULL 13/25] vhost-user: document migration log Michael S. Tsirkin
2015-10-08 21:17 ` [Qemu-devel] [PULL 14/25] net: add trace_vhost_user_event Michael S. Tsirkin
2015-10-08 21:17 ` [Qemu-devel] [PULL 15/25] vhost user: add support of live migration Michael S. Tsirkin
2015-10-08 21:17 ` [Qemu-devel] [PULL 16/25] vhost user: add rarp sending after live migration for legacy guest Michael S. Tsirkin
2015-10-08 21:17 ` [Qemu-devel] [PULL 17/25] vhost-user: use an enum helper for features mask Michael S. Tsirkin
2015-10-08 21:17 ` [Qemu-devel] [PULL 18/25] vhost: add migration block if memfd failed Michael S. Tsirkin
2015-10-08 21:18 ` [Qemu-devel] [PULL 19/25] vhost-user-test: move wait_for_fds() out Michael S. Tsirkin
2015-10-08 21:18 ` [Qemu-devel] [PULL 20/25] vhost-user-test: remove useless static check Michael S. Tsirkin
2015-10-08 21:18 ` [Qemu-devel] [PULL 21/25] vhost-user-test: wrap server in TestServer struct Michael S. Tsirkin
2015-10-08 21:18 ` Michael S. Tsirkin [this message]
2015-10-08 21:18 ` [Qemu-devel] [PULL 23/25] vhost-user-test: add live-migration test Michael S. Tsirkin
2015-10-08 21:18 ` [Qemu-devel] [PULL 24/25] vhost-user-test: check ownership during migration Michael S. Tsirkin
2015-10-08 21:18 ` [Qemu-devel] [PULL 25/25] intel_iommu: Add support for translation for devices behind bridges Michael S. Tsirkin
2015-10-09 11:05 ` [Qemu-devel] [PULL 00/25] virtio,pc features, fixes Peter Maydell
2015-10-09 11:09 ` Peter Maydell
2015-10-09 13:10 ` Eduardo Otubo
2015-10-09 13:37 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444338957-15293-23-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=imammedo@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=yuanhan.liu@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).