From: Stefan Hajnoczi <[email protected]> test-nested-aio-poll relies on internal details of how fdmon-poll.c handles AioContext polling. Skip it when other fdmon implementations are in use.
The reason why fdmon-io_uring.c behaves differently from fdmon-poll.c is that its fdmon_ops->need_wait() function returns true when io_uring_enter(2) must be called (e.g. to submit pending SQEs). AioContext polling is skipped when ->need_wait() returns true, so the test case will never enter AioContext polling mode with fdmon-io_uring.c. Restrict this test to fdmon-poll.c and drop the aio_context_use_g_source() call since it's no longer necessary. Note that this test is only built on POSIX systems so it is safe to include "util/aio-posix.h". Signed-off-by: Stefan Hajnoczi <[email protected]> Reviewed-by: Eric Blake <[email protected]> Message-ID: <[email protected]> Reviewed-by: Kevin Wolf <[email protected]> Signed-off-by: Kevin Wolf <[email protected]> --- tests/unit/test-nested-aio-poll.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/unit/test-nested-aio-poll.c b/tests/unit/test-nested-aio-poll.c index d8fd92c43b..d13ecccd8c 100644 --- a/tests/unit/test-nested-aio-poll.c +++ b/tests/unit/test-nested-aio-poll.c @@ -15,6 +15,7 @@ #include "qemu/osdep.h" #include "block/aio.h" #include "qapi/error.h" +#include "util/aio-posix.h" typedef struct { AioContext *ctx; @@ -71,17 +72,17 @@ static void test(void) .ctx = aio_context_new(&error_abort), }; + if (td.ctx->fdmon_ops != &fdmon_poll_ops) { + /* This test is tied to fdmon-poll.c */ + g_test_skip("fdmon_poll_ops not in use"); + return; + } + qemu_set_current_aio_context(td.ctx); /* Enable polling */ aio_context_set_poll_params(td.ctx, 1000000, 2, 2, &error_abort); - /* - * The GSource is unused but this has the side-effect of changing the fdmon - * that AioContext uses. - */ - aio_get_g_source(td.ctx); - /* Make the event notifier active (set) right away */ event_notifier_init(&td.poll_notifier, 1); aio_set_event_notifier(td.ctx, &td.poll_notifier, -- 2.51.1
