From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3ruP-0006z4-HE for qemu-devel@nongnu.org; Tue, 21 Aug 2012 13:06:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T3ruI-0002fN-Jf for qemu-devel@nongnu.org; Tue, 21 Aug 2012 13:06:29 -0400 Received: from mail-gg0-f173.google.com ([209.85.161.173]:58041) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3ruI-0002fG-FH for qemu-devel@nongnu.org; Tue, 21 Aug 2012 13:06:22 -0400 Received: by ggna5 with SMTP id a5so32818ggn.4 for ; Tue, 21 Aug 2012 10:06:22 -0700 (PDT) Sender: fluxion From: Michael Roth Date: Tue, 21 Aug 2012 12:05:35 -0500 Message-Id: <1345568757-14365-2-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1345568757-14365-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1345568757-14365-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 01/23] qtest: fix infinite loop when QEMU aborts abruptly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com From: Anthony Liguori >>From Markus: Makes "make check" hang: QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 gtester -k --verbose -m=quick tests/crash-test tests/rtc-test TEST: tests/crash-test... (pid=972) qemu-system-x86_64: Device needs media, but drive is empty [Nothing happens, wait a while, then hit ^C] make: *** [check-qtest-x86_64] Interrupt This was due to the fact that we weren't checked for errors when reading from the QMP socket. This patch adds appropriate error checking. Reported-by: Markus Armbruster Signed-off-by: Anthony Liguori (cherry picked from commit 039380a8e18f618cdacf72486449c04dc1b70eef) Signed-off-by: Michael Roth --- tests/libqtest.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/libqtest.c b/tests/libqtest.c index 6d333ef..0664323 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -290,6 +290,11 @@ void qtest_qmp(QTestState *s, const char *fmt, ...) continue; } + if (len == -1 || len == 0) { + fprintf(stderr, "Broken pipe\n"); + exit(1); + } + switch (c) { case '{': nesting++; -- 1.7.9.5