From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8CDN-0000l5-Bo for qemu-devel@nongnu.org; Thu, 15 Mar 2012 11:03:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8CDD-0001bA-Db for qemu-devel@nongnu.org; Thu, 15 Mar 2012 11:03:40 -0400 Received: from e6.ny.us.ibm.com ([32.97.182.146]:44307) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8CDD-0001aP-2r for qemu-devel@nongnu.org; Thu, 15 Mar 2012 11:03:31 -0400 Received: from /spool/local by e6.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 15 Mar 2012 11:03:25 -0400 Received: from d01relay06.pok.ibm.com (d01relay06.pok.ibm.com [9.56.227.116]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id C4D3D6E8067 for ; Thu, 15 Mar 2012 11:03:10 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay06.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q2FF37Mx2121782 for ; Thu, 15 Mar 2012 11:03:07 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q2FF37tN009952 for ; Thu, 15 Mar 2012 12:03:07 -0300 Message-ID: <4F6204A7.3070606@us.ibm.com> Date: Thu, 15 Mar 2012 10:03:03 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1331818666-31718-1-git-send-email-aliguori@us.ibm.com> <1331818666-31718-4-git-send-email-aliguori@us.ibm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/9] qtest: add C version of test infrastructure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , qemu-devel@nongnu.org On 03/15/2012 09:42 AM, Stefan Hajnoczi wrote: > On Thu, Mar 15, 2012 at 1:37 PM, Anthony Liguori wrote: >> + 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); >> + ret = connect(sock, (struct sockaddr *)&addr, sizeof(addr)); >> + } while (ret == -1); > > I believe Kevin suggested using -qtest unix:%s and creating the listen > socket in the test program rather than inside QEMU. The advantage is > that we never sleep(3), instead we accept(2) the connection from QEMU > and get going right away. Yeah, I missed that, it's an easy change to make. I'll update. Regards, Anthony Liguori > > This can be added as a patch later. > > Kevin: Do you already have a patch or does someone need to write it? > > Stefan >