From patchwork Thu Aug 29 16:48:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bligh X-Patchwork-Id: 270882 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C22252C00AA for ; Fri, 30 Aug 2013 02:48:53 +1000 (EST) Received: from localhost ([::1]:44903 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF5Os-0006V9-96 for incoming@patchwork.ozlabs.org; Thu, 29 Aug 2013 12:48:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF5Oc-0006Tj-97 for qemu-devel@nongnu.org; Thu, 29 Aug 2013 12:48:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VF5Ob-0006aE-5T for qemu-devel@nongnu.org; Thu, 29 Aug 2013 12:48:34 -0400 Received: from mail.avalus.com ([2001:41c8:10:1dd::10]:43984) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VF5Oa-0006a1-Ud for qemu-devel@nongnu.org; Thu, 29 Aug 2013 12:48:33 -0400 Received: by mail.avalus.com (Postfix) with ESMTPSA id 2DB69C561A2; Thu, 29 Aug 2013 17:48:20 +0100 (BST) From: Alex Bligh To: qemu-devel@nongnu.org, Charlie Shepherd Date: Thu, 29 Aug 2013 17:48:16 +0100 Message-Id: <1377794897-11215-1-git-send-email-alex@alex.org.uk> X-Mailer: git-send-email 1.7.9.5 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:41c8:10:1dd::10 Cc: Kevin Wolf , Anthony Liguori , Alex Bligh , Jan Kiszka , liu ping fan , Gerd Hoffmann , Stefan Hajnoczi , Anthony Perard , Paolo Bonzini , MORITA Kazutaka , rth@twiddle.net Subject: [Qemu-devel] [PATCH] aio / timers: fix build of test/test-aio.c on non-linux platforms X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org tests/test-aio.c used pipe2 which is Linux only. Use qemu_pipe and qemu_set_nonblock for portabillity. Addition of O_CLOEXEC is a harmless bonus. Signed-off-by: Alex Bligh --- tests/test-aio.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/test-aio.c b/tests/test-aio.c index 07a1f61..4215701 100644 --- a/tests/test-aio.c +++ b/tests/test-aio.c @@ -13,6 +13,7 @@ #include #include "block/aio.h" #include "qemu/timer.h" +#include "qemu/sockets.h" AioContext *ctx; @@ -375,7 +376,10 @@ static void test_timer_schedule(void) /* aio_poll will not block to wait for timers to complete unless it has * an fd to wait on. Fixing this breaks other tests. So create a dummy one. */ - g_assert(!pipe2(pipefd, O_NONBLOCK)); + g_assert(!qemu_pipe(pipefd)); + qemu_set_nonblock(pipefd[0]); + qemu_set_nonblock(pipefd[1]); + aio_set_fd_handler(ctx, pipefd[0], dummy_io_handler_read, NULL, NULL); aio_poll(ctx, false); @@ -716,7 +720,10 @@ static void test_source_timer_schedule(void) /* aio_poll will not block to wait for timers to complete unless it has * an fd to wait on. Fixing this breaks other tests. So create a dummy one. */ - g_assert(!pipe2(pipefd, O_NONBLOCK)); + g_assert(!qemu_pipe(pipefd)); + qemu_set_nonblock(pipefd[0]); + qemu_set_nonblock(pipefd[1]); + aio_set_fd_handler(ctx, pipefd[0], dummy_io_handler_read, NULL, NULL); do {} while (g_main_context_iteration(NULL, false));