mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
test-block-iothread: Check filter node in test_propagate_mirror
Just make the test cover the AioContext of the filter node as well. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
3036a626e9
commit
087ba459a2
1 changed files with 6 additions and 1 deletions
|
@ -593,7 +593,7 @@ static void test_propagate_mirror(void)
|
||||||
IOThread *iothread = iothread_new();
|
IOThread *iothread = iothread_new();
|
||||||
AioContext *ctx = iothread_get_aio_context(iothread);
|
AioContext *ctx = iothread_get_aio_context(iothread);
|
||||||
AioContext *main_ctx = qemu_get_aio_context();
|
AioContext *main_ctx = qemu_get_aio_context();
|
||||||
BlockDriverState *src, *target;
|
BlockDriverState *src, *target, *filter;
|
||||||
BlockBackend *blk;
|
BlockBackend *blk;
|
||||||
Job *job;
|
Job *job;
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
@ -610,11 +610,13 @@ static void test_propagate_mirror(void)
|
||||||
false, "filter_node", MIRROR_COPY_MODE_BACKGROUND,
|
false, "filter_node", MIRROR_COPY_MODE_BACKGROUND,
|
||||||
&error_abort);
|
&error_abort);
|
||||||
job = job_get("job0");
|
job = job_get("job0");
|
||||||
|
filter = bdrv_find_node("filter_node");
|
||||||
|
|
||||||
/* Change the AioContext of src */
|
/* Change the AioContext of src */
|
||||||
bdrv_try_set_aio_context(src, ctx, &error_abort);
|
bdrv_try_set_aio_context(src, ctx, &error_abort);
|
||||||
g_assert(bdrv_get_aio_context(src) == ctx);
|
g_assert(bdrv_get_aio_context(src) == ctx);
|
||||||
g_assert(bdrv_get_aio_context(target) == ctx);
|
g_assert(bdrv_get_aio_context(target) == ctx);
|
||||||
|
g_assert(bdrv_get_aio_context(filter) == ctx);
|
||||||
g_assert(job->aio_context == ctx);
|
g_assert(job->aio_context == ctx);
|
||||||
|
|
||||||
/* Change the AioContext of target */
|
/* Change the AioContext of target */
|
||||||
|
@ -623,6 +625,7 @@ static void test_propagate_mirror(void)
|
||||||
aio_context_release(ctx);
|
aio_context_release(ctx);
|
||||||
g_assert(bdrv_get_aio_context(src) == main_ctx);
|
g_assert(bdrv_get_aio_context(src) == main_ctx);
|
||||||
g_assert(bdrv_get_aio_context(target) == main_ctx);
|
g_assert(bdrv_get_aio_context(target) == main_ctx);
|
||||||
|
g_assert(bdrv_get_aio_context(filter) == main_ctx);
|
||||||
|
|
||||||
/* With a BlockBackend on src, changing target must fail */
|
/* With a BlockBackend on src, changing target must fail */
|
||||||
blk = blk_new(0, BLK_PERM_ALL);
|
blk = blk_new(0, BLK_PERM_ALL);
|
||||||
|
@ -635,6 +638,7 @@ static void test_propagate_mirror(void)
|
||||||
g_assert(blk_get_aio_context(blk) == main_ctx);
|
g_assert(blk_get_aio_context(blk) == main_ctx);
|
||||||
g_assert(bdrv_get_aio_context(src) == main_ctx);
|
g_assert(bdrv_get_aio_context(src) == main_ctx);
|
||||||
g_assert(bdrv_get_aio_context(target) == main_ctx);
|
g_assert(bdrv_get_aio_context(target) == main_ctx);
|
||||||
|
g_assert(bdrv_get_aio_context(filter) == main_ctx);
|
||||||
|
|
||||||
/* ...unless we explicitly allow it */
|
/* ...unless we explicitly allow it */
|
||||||
aio_context_acquire(ctx);
|
aio_context_acquire(ctx);
|
||||||
|
@ -645,6 +649,7 @@ static void test_propagate_mirror(void)
|
||||||
g_assert(blk_get_aio_context(blk) == ctx);
|
g_assert(blk_get_aio_context(blk) == ctx);
|
||||||
g_assert(bdrv_get_aio_context(src) == ctx);
|
g_assert(bdrv_get_aio_context(src) == ctx);
|
||||||
g_assert(bdrv_get_aio_context(target) == ctx);
|
g_assert(bdrv_get_aio_context(target) == ctx);
|
||||||
|
g_assert(bdrv_get_aio_context(filter) == ctx);
|
||||||
|
|
||||||
job_cancel_sync_all();
|
job_cancel_sync_all();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue