From: Kevin Wolf <kwolf@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH 3/6] qtest: add C version of test infrastructure
Date: Wed, 18 Jan 2012 17:00:31 +0100 [thread overview]
Message-ID: <4F16EC9F.9020503@redhat.com> (raw)
In-Reply-To: <1326479558-3016-3-git-send-email-aliguori@us.ibm.com>
Am 13.01.2012 19:32, schrieb Anthony Liguori:
> This also includes a qtest wrapper script to make it easier to launch qtest
> tests directly.
>
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> +QTestState *qtest_init(const char *extra_args)
> +{
> + QTestState *s;
> + struct sockaddr_un addr;
> + int sock, ret, i;
> + gchar *socket_path;
> + gchar *pid_file;
> + gchar *command;
> + const char *qemu_binary;
> + pid_t pid;
> +
> + qemu_binary = getenv("QTEST_QEMU_BINARY");
> + g_assert(qemu_binary != NULL);
> +
> + socket_path = g_strdup_printf("/tmp/qtest-%d.sock", getpid());
> + pid_file = g_strdup_printf("/tmp/qtest-%d.pid", getpid());
> +
> + s = g_malloc(sizeof(*s));
> +
> + sock = socket(PF_UNIX, SOCK_STREAM, 0);
> + g_assert_no_errno(sock);
> +
> + addr.sun_family = AF_UNIX;
> + snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socket_path);
> +
> + pid = fork();
> + if (pid == 0) {
> + command = g_strdup_printf("%s "
> + "-qtest unix:%s,server,nowait "
> + "-qtest-log /dev/null "
> + "-pidfile %s "
> + "-machine accel=qtest "
> + "%s", qemu_binary, socket_path,
> + pid_file,
> + extra_args ?: "");
> +
> + ret = system(command);
> + exit(ret);
> + g_free(command);
> + }
> +
> + do {
> + sleep(1);
This is the line that takes the greatest part of the time for make
check-qtest. Can we use some shorter delay if it's required at all?
> + ret = connect(sock, (struct sockaddr *)&addr, sizeof(addr));
> + } while (ret == -1);
> + g_assert_no_errno(ret);
> +
> + s->fd = sock;
> + s->rx = g_string_new("");
> + s->pid_file = pid_file;
> + for (i = 0; i < MAX_IRQ; i++) {
> + s->irq_level[i] = false;
> + }
> +
> + g_free(socket_path);
> +
> + return s;
> +}
Kevin
next prev parent reply other threads:[~2012-01-18 15:57 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-13 18:32 [Qemu-devel] [PATCH 1/6] qtest: add test framework Anthony Liguori
2012-01-13 18:32 ` [Qemu-devel] [PATCH 2/6] qtest: add support for -M pc Anthony Liguori
2012-01-13 18:32 ` [Qemu-devel] [PATCH 3/6] qtest: add C version of test infrastructure Anthony Liguori
2012-01-17 11:33 ` Stefan Hajnoczi
2012-01-17 13:33 ` Paolo Bonzini
2012-01-17 13:39 ` Stefan Hajnoczi
2012-01-17 16:09 ` Paolo Bonzini
2012-01-18 16:00 ` Kevin Wolf [this message]
2012-01-18 16:02 ` Paolo Bonzini
2012-01-18 16:08 ` Anthony Liguori
2012-01-13 18:32 ` [Qemu-devel] [PATCH 4/6] make: add check targets based on gtester Anthony Liguori
2012-01-16 17:16 ` Paolo Bonzini
2012-01-16 18:14 ` Anthony Liguori
2012-01-17 10:42 ` Paolo Bonzini
2012-01-17 14:04 ` Paolo Bonzini
2012-01-17 14:22 ` Anthony Liguori
2012-01-13 18:32 ` [Qemu-devel] [PATCH 5/6] rtc: split out macros into a header file and use in test case Anthony Liguori
2012-01-13 18:32 ` [Qemu-devel] [PATCH 6/6] qtest: add rtc-test test-case Anthony Liguori
2012-01-16 16:59 ` [Qemu-devel] [PATCH 1/6] qtest: add test framework Stefan Hajnoczi
2012-01-16 17:08 ` Avi Kivity
2012-01-16 17:20 ` Anthony Liguori
2012-01-16 17:08 ` Anthony Liguori
2012-01-17 11:13 ` Stefan Hajnoczi
2012-01-18 9:05 ` Stefan Hajnoczi
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=4F16EC9F.9020503@redhat.com \
--to=kwolf@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.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).