aboutsummaryrefslogtreecommitdiff
path: root/tests/test-thread-pool.c
diff options
context:
space:
mode:
authorAnthony Liguori <anthony@codemonkey.ws>2013-08-20 09:52:18 -0500
committerAnthony Liguori <anthony@codemonkey.ws>2013-08-20 09:52:18 -0500
commit9176e8fb8f78206bd4039f001aca0d931a47d663 (patch)
tree01b2298af04ffc11e0546cb88150286a36f6b26c /tests/test-thread-pool.c
parent72420ce9f0bafef7d55563a8bd14237a5fe88a87 (diff)
parentf2e5dca46b5ba4588c0756c5f272123585cbbf23 (diff)
Merge remote-tracking branch 'stefanha/block-next' into staging
# By Stefan Hajnoczi # Via Stefan Hajnoczi * stefanha/block-next: aio: drop io_flush argument tests: drop event_active_cb() thread-pool: drop thread_pool_active() dataplane/virtio-blk: drop flush_true() and flush_io() block/ssh: drop return_true() block/sheepdog: drop have_co_req() and aio_flush_request() block/rbd: drop qemu_rbd_aio_flush_cb() block/nbd: drop nbd_have_request() block/linux-aio: drop qemu_laio_completion_cb() block/iscsi: drop iscsi_process_flush() block/gluster: drop qemu_gluster_aio_flush_cb() block/curl: drop curl_aio_flush() aio: stop using .io_flush() tests: adjust test-thread-pool to new aio_poll() semantics tests: adjust test-aio to new aio_poll() semantics dataplane/virtio-blk: check exit conditions before aio_poll() block: stop relying on io_flush() in bdrv_drain_all() block: ensure bdrv_drain_all() works during bdrv_delete() Message-id: 1376921877-9576-1-git-send-email-stefanha@redhat.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
Diffstat (limited to 'tests/test-thread-pool.c')
-rw-r--r--tests/test-thread-pool.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/test-thread-pool.c b/tests/test-thread-pool.c
index b62338f375..8188d1a69d 100644
--- a/tests/test-thread-pool.c
+++ b/tests/test-thread-pool.c
@@ -40,19 +40,13 @@ static void done_cb(void *opaque, int ret)
active--;
}
-/* Wait until all aio and bh activity has finished */
-static void qemu_aio_wait_all(void)
-{
- while (aio_poll(ctx, true)) {
- /* Do nothing */
- }
-}
-
static void test_submit(void)
{
WorkerTestData data = { .n = 0 };
thread_pool_submit(pool, worker_cb, &data);
- qemu_aio_wait_all();
+ while (data.n == 0) {
+ aio_poll(ctx, true);
+ }
g_assert_cmpint(data.n, ==, 1);
}
@@ -65,7 +59,9 @@ static void test_submit_aio(void)
/* The callbacks are not called until after the first wait. */
active = 1;
g_assert_cmpint(data.ret, ==, -EINPROGRESS);
- qemu_aio_wait_all();
+ while (data.ret == -EINPROGRESS) {
+ aio_poll(ctx, true);
+ }
g_assert_cmpint(active, ==, 0);
g_assert_cmpint(data.n, ==, 1);
g_assert_cmpint(data.ret, ==, 0);
@@ -103,7 +99,9 @@ static void test_submit_co(void)
/* qemu_aio_wait_all will execute the rest of the coroutine. */
- qemu_aio_wait_all();
+ while (data.ret == -EINPROGRESS) {
+ aio_poll(ctx, true);
+ }
/* Back here after the coroutine has finished. */
@@ -187,7 +185,9 @@ static void test_cancel(void)
}
/* Finish execution and execute any remaining callbacks. */
- qemu_aio_wait_all();
+ while (active > 0) {
+ aio_poll(ctx, true);
+ }
g_assert_cmpint(active, ==, 0);
for (i = 0; i < 100; i++) {
if (data[i].n == 3) {