* [Qemu-devel] [PATCH] aio / timers: fix build of test/test-aio.c on non-linux platforms
@ 2013-08-29 16:48 Alex Bligh
2013-09-03 9:56 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Alex Bligh @ 2013-08-29 16:48 UTC (permalink / raw)
To: qemu-devel, Charlie Shepherd
Cc: Kevin Wolf, Anthony Liguori, Alex Bligh, Jan Kiszka, liu ping fan,
Gerd Hoffmann, Stefan Hajnoczi, Anthony Perard, Paolo Bonzini,
MORITA Kazutaka, rth
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 <alex@alex.org.uk>
---
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 <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.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] aio / timers: fix build of test/test-aio.c on non-linux platforms
2013-08-29 16:48 [Qemu-devel] [PATCH] aio / timers: fix build of test/test-aio.c on non-linux platforms Alex Bligh
@ 2013-09-03 9:56 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2013-09-03 9:56 UTC (permalink / raw)
To: Alex Bligh
Cc: Kevin Wolf, Anthony Liguori, Jan Kiszka, qemu-devel, liu ping fan,
Charlie Shepherd, Gerd Hoffmann, Anthony Perard, Paolo Bonzini,
MORITA Kazutaka, rth
On Thu, Aug 29, 2013 at 05:48:16PM +0100, Alex Bligh wrote:
> 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 <alex@alex.org.uk>
> ---
> tests/test-aio.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-03 9:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-29 16:48 [Qemu-devel] [PATCH] aio / timers: fix build of test/test-aio.c on non-linux platforms Alex Bligh
2013-09-03 9:56 ` Stefan Hajnoczi
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).