[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/42] aio / timers: fix build of test/test-aio.c on
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 09/42] aio / timers: fix build of test/test-aio.c on non-linux platforms |
Date: |
Fri, 6 Sep 2013 17:38:40 +0200 |
From: Alex Bligh <address@hidden>
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 <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
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 532a1de..c4fe0fc 100644
--- a/tests/test-aio.c
+++ b/tests/test-aio.c
@@ -13,6 +13,7 @@
#include <glib.h>
#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));
--
1.8.3.1
- [Qemu-devel] [PULL 00/42] Block patches, Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 01/42] throttle: Add a new throttling API implementing continuous leaky bucket., Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 03/42] block: Enable the new throttling code in the block layer., Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 02/42] throttle: Add units tests, Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 04/42] block: Add support for throttling burst max in QMP and the command line., Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 05/42] block: Add iops_size to do the iops accounting for a given io size., Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 06/42] qemu-iotests: Adjust test result 039, Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 08/42] w32: Fix access to host devices (regression), Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 07/42] add qemu-img convert -n option (skip target volume creation), Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 10/42] vvfat: use bdrv_new() to allocate BlockDriverState, Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 09/42] aio / timers: fix build of test/test-aio.c on non-linux platforms,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 11/42] iscsi: use bdrv_new() instead of stack structure, Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 12/42] block: implement reference count for BlockDriverState, Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 13/42] block: make bdrv_delete() static, Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 14/42] migration: omit drive ref as we have bdrv_ref now, Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 15/42] xen_disk: simplify blk_disconnect with refcnt, Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 27/42] qemu-img: always probe the input image for allocated sectors, Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 28/42] block: make bdrv_has_zero_init return false for copy-on-write-images, Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 29/42] block: introduce bdrv_get_block_status API, Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 31/42] block: return get_block_status data and flags for formats, Stefan Hajnoczi, 2013/09/06
- [Qemu-devel] [PULL 30/42] block: define get_block_status return value, Stefan Hajnoczi, 2013/09/06