2 * Block node draining tests
4 * Copyright (c) 2017 Kevin Wolf <kwolf@redhat.com>
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 #include "qemu/osdep.h"
26 #include "block/block.h"
27 #include "block/blockjob_int.h"
28 #include "sysemu/block-backend.h"
29 #include "qapi/error.h"
31 typedef struct BDRVTestState
{
35 static void coroutine_fn
bdrv_test_co_drain_begin(BlockDriverState
*bs
)
37 BDRVTestState
*s
= bs
->opaque
;
41 static void coroutine_fn
bdrv_test_co_drain_end(BlockDriverState
*bs
)
43 BDRVTestState
*s
= bs
->opaque
;
47 static void bdrv_test_close(BlockDriverState
*bs
)
49 BDRVTestState
*s
= bs
->opaque
;
50 g_assert_cmpint(s
->drain_count
, >, 0);
53 static int coroutine_fn
bdrv_test_co_preadv(BlockDriverState
*bs
,
54 uint64_t offset
, uint64_t bytes
,
55 QEMUIOVector
*qiov
, int flags
)
57 /* We want this request to stay until the polling loop in drain waits for
58 * it to complete. We need to sleep a while as bdrv_drain_invoke() comes
59 * first and polls its result, too, but it shouldn't accidentally complete
60 * this request yet. */
61 qemu_co_sleep_ns(QEMU_CLOCK_REALTIME
, 100000);
66 static BlockDriver bdrv_test
= {
67 .format_name
= "test",
68 .instance_size
= sizeof(BDRVTestState
),
70 .bdrv_close
= bdrv_test_close
,
71 .bdrv_co_preadv
= bdrv_test_co_preadv
,
73 .bdrv_co_drain_begin
= bdrv_test_co_drain_begin
,
74 .bdrv_co_drain_end
= bdrv_test_co_drain_end
,
76 .bdrv_child_perm
= bdrv_format_default_perms
,
79 static void aio_ret_cb(void *opaque
, int ret
)
81 int *aio_ret
= opaque
;
85 typedef struct CallInCoroutineData
{
88 } CallInCoroutineData
;
90 static coroutine_fn
void call_in_coroutine_entry(void *opaque
)
92 CallInCoroutineData
*data
= opaque
;
98 static void call_in_coroutine(void (*entry
)(void))
101 CallInCoroutineData data
= {
106 co
= qemu_coroutine_create(call_in_coroutine_entry
, &data
);
107 qemu_coroutine_enter(co
);
109 aio_poll(qemu_get_aio_context(), true);
120 static void do_drain_begin(enum drain_type drain_type
, BlockDriverState
*bs
)
122 switch (drain_type
) {
123 case BDRV_DRAIN_ALL
: bdrv_drain_all_begin(); break;
124 case BDRV_DRAIN
: bdrv_drained_begin(bs
); break;
125 case BDRV_SUBTREE_DRAIN
: bdrv_subtree_drained_begin(bs
); break;
126 default: g_assert_not_reached();
130 static void do_drain_end(enum drain_type drain_type
, BlockDriverState
*bs
)
132 switch (drain_type
) {
133 case BDRV_DRAIN_ALL
: bdrv_drain_all_end(); break;
134 case BDRV_DRAIN
: bdrv_drained_end(bs
); break;
135 case BDRV_SUBTREE_DRAIN
: bdrv_subtree_drained_end(bs
); break;
136 default: g_assert_not_reached();
140 static void test_drv_cb_common(enum drain_type drain_type
, bool recursive
)
143 BlockDriverState
*bs
, *backing
;
144 BDRVTestState
*s
, *backing_s
;
153 qemu_iovec_init_external(&qiov
, &iov
, 1);
155 blk
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
156 bs
= bdrv_new_open_driver(&bdrv_test
, "test-node", BDRV_O_RDWR
,
159 blk_insert_bs(blk
, bs
, &error_abort
);
161 backing
= bdrv_new_open_driver(&bdrv_test
, "backing", 0, &error_abort
);
162 backing_s
= backing
->opaque
;
163 bdrv_set_backing_hd(bs
, backing
, &error_abort
);
165 /* Simple bdrv_drain_all_begin/end pair, check that CBs are called */
166 g_assert_cmpint(s
->drain_count
, ==, 0);
167 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
169 do_drain_begin(drain_type
, bs
);
171 g_assert_cmpint(s
->drain_count
, ==, 1);
172 g_assert_cmpint(backing_s
->drain_count
, ==, !!recursive
);
174 do_drain_end(drain_type
, bs
);
176 g_assert_cmpint(s
->drain_count
, ==, 0);
177 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
179 /* Now do the same while a request is pending */
180 aio_ret
= -EINPROGRESS
;
181 acb
= blk_aio_preadv(blk
, 0, &qiov
, 0, aio_ret_cb
, &aio_ret
);
182 g_assert(acb
!= NULL
);
183 g_assert_cmpint(aio_ret
, ==, -EINPROGRESS
);
185 g_assert_cmpint(s
->drain_count
, ==, 0);
186 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
188 do_drain_begin(drain_type
, bs
);
190 g_assert_cmpint(aio_ret
, ==, 0);
191 g_assert_cmpint(s
->drain_count
, ==, 1);
192 g_assert_cmpint(backing_s
->drain_count
, ==, !!recursive
);
194 do_drain_end(drain_type
, bs
);
196 g_assert_cmpint(s
->drain_count
, ==, 0);
197 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
204 static void test_drv_cb_drain_all(void)
206 test_drv_cb_common(BDRV_DRAIN_ALL
, true);
209 static void test_drv_cb_drain(void)
211 test_drv_cb_common(BDRV_DRAIN
, false);
214 static void test_drv_cb_drain_subtree(void)
216 test_drv_cb_common(BDRV_SUBTREE_DRAIN
, true);
219 static void test_drv_cb_co_drain(void)
221 call_in_coroutine(test_drv_cb_drain
);
224 static void test_drv_cb_co_drain_subtree(void)
226 call_in_coroutine(test_drv_cb_drain_subtree
);
229 static void test_quiesce_common(enum drain_type drain_type
, bool recursive
)
232 BlockDriverState
*bs
, *backing
;
234 blk
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
235 bs
= bdrv_new_open_driver(&bdrv_test
, "test-node", BDRV_O_RDWR
,
237 blk_insert_bs(blk
, bs
, &error_abort
);
239 backing
= bdrv_new_open_driver(&bdrv_test
, "backing", 0, &error_abort
);
240 bdrv_set_backing_hd(bs
, backing
, &error_abort
);
242 g_assert_cmpint(bs
->quiesce_counter
, ==, 0);
243 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
245 do_drain_begin(drain_type
, bs
);
247 g_assert_cmpint(bs
->quiesce_counter
, ==, 1);
248 g_assert_cmpint(backing
->quiesce_counter
, ==, !!recursive
);
250 do_drain_end(drain_type
, bs
);
252 g_assert_cmpint(bs
->quiesce_counter
, ==, 0);
253 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
260 static void test_quiesce_drain_all(void)
262 // XXX drain_all doesn't quiesce
263 //test_quiesce_common(BDRV_DRAIN_ALL, true);
266 static void test_quiesce_drain(void)
268 test_quiesce_common(BDRV_DRAIN
, false);
271 static void test_quiesce_drain_subtree(void)
273 test_quiesce_common(BDRV_SUBTREE_DRAIN
, true);
276 static void test_quiesce_co_drain(void)
278 call_in_coroutine(test_quiesce_drain
);
281 static void test_quiesce_co_drain_subtree(void)
283 call_in_coroutine(test_quiesce_drain_subtree
);
286 static void test_nested(void)
289 BlockDriverState
*bs
, *backing
;
290 BDRVTestState
*s
, *backing_s
;
291 enum drain_type outer
, inner
;
293 blk
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
294 bs
= bdrv_new_open_driver(&bdrv_test
, "test-node", BDRV_O_RDWR
,
297 blk_insert_bs(blk
, bs
, &error_abort
);
299 backing
= bdrv_new_open_driver(&bdrv_test
, "backing", 0, &error_abort
);
300 backing_s
= backing
->opaque
;
301 bdrv_set_backing_hd(bs
, backing
, &error_abort
);
303 for (outer
= 0; outer
< DRAIN_TYPE_MAX
; outer
++) {
304 for (inner
= 0; inner
< DRAIN_TYPE_MAX
; inner
++) {
305 /* XXX bdrv_drain_all() doesn't increase the quiesce_counter */
306 int bs_quiesce
= (outer
!= BDRV_DRAIN_ALL
) +
307 (inner
!= BDRV_DRAIN_ALL
);
308 int backing_quiesce
= (outer
== BDRV_SUBTREE_DRAIN
) +
309 (inner
== BDRV_SUBTREE_DRAIN
);
310 int backing_cb_cnt
= (outer
!= BDRV_DRAIN
) +
311 (inner
!= BDRV_DRAIN
);
313 g_assert_cmpint(bs
->quiesce_counter
, ==, 0);
314 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
315 g_assert_cmpint(s
->drain_count
, ==, 0);
316 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
318 do_drain_begin(outer
, bs
);
319 do_drain_begin(inner
, bs
);
321 g_assert_cmpint(bs
->quiesce_counter
, ==, bs_quiesce
);
322 g_assert_cmpint(backing
->quiesce_counter
, ==, backing_quiesce
);
323 g_assert_cmpint(s
->drain_count
, ==, 2);
324 g_assert_cmpint(backing_s
->drain_count
, ==, backing_cb_cnt
);
326 do_drain_end(inner
, bs
);
327 do_drain_end(outer
, bs
);
329 g_assert_cmpint(bs
->quiesce_counter
, ==, 0);
330 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
331 g_assert_cmpint(s
->drain_count
, ==, 0);
332 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
341 static void test_multiparent(void)
343 BlockBackend
*blk_a
, *blk_b
;
344 BlockDriverState
*bs_a
, *bs_b
, *backing
;
345 BDRVTestState
*a_s
, *b_s
, *backing_s
;
347 blk_a
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
348 bs_a
= bdrv_new_open_driver(&bdrv_test
, "test-node-a", BDRV_O_RDWR
,
351 blk_insert_bs(blk_a
, bs_a
, &error_abort
);
353 blk_b
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
354 bs_b
= bdrv_new_open_driver(&bdrv_test
, "test-node-b", BDRV_O_RDWR
,
357 blk_insert_bs(blk_b
, bs_b
, &error_abort
);
359 backing
= bdrv_new_open_driver(&bdrv_test
, "backing", 0, &error_abort
);
360 backing_s
= backing
->opaque
;
361 bdrv_set_backing_hd(bs_a
, backing
, &error_abort
);
362 bdrv_set_backing_hd(bs_b
, backing
, &error_abort
);
364 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 0);
365 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 0);
366 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
367 g_assert_cmpint(a_s
->drain_count
, ==, 0);
368 g_assert_cmpint(b_s
->drain_count
, ==, 0);
369 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
371 do_drain_begin(BDRV_SUBTREE_DRAIN
, bs_a
);
373 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 1);
374 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 1);
375 g_assert_cmpint(backing
->quiesce_counter
, ==, 1);
376 g_assert_cmpint(a_s
->drain_count
, ==, 1);
377 g_assert_cmpint(b_s
->drain_count
, ==, 1);
378 g_assert_cmpint(backing_s
->drain_count
, ==, 1);
380 do_drain_begin(BDRV_SUBTREE_DRAIN
, bs_b
);
382 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 2);
383 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 2);
384 g_assert_cmpint(backing
->quiesce_counter
, ==, 2);
385 g_assert_cmpint(a_s
->drain_count
, ==, 2);
386 g_assert_cmpint(b_s
->drain_count
, ==, 2);
387 g_assert_cmpint(backing_s
->drain_count
, ==, 2);
389 do_drain_end(BDRV_SUBTREE_DRAIN
, bs_b
);
391 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 1);
392 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 1);
393 g_assert_cmpint(backing
->quiesce_counter
, ==, 1);
394 g_assert_cmpint(a_s
->drain_count
, ==, 1);
395 g_assert_cmpint(b_s
->drain_count
, ==, 1);
396 g_assert_cmpint(backing_s
->drain_count
, ==, 1);
398 do_drain_end(BDRV_SUBTREE_DRAIN
, bs_a
);
400 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 0);
401 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 0);
402 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
403 g_assert_cmpint(a_s
->drain_count
, ==, 0);
404 g_assert_cmpint(b_s
->drain_count
, ==, 0);
405 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
414 static void test_graph_change(void)
416 BlockBackend
*blk_a
, *blk_b
;
417 BlockDriverState
*bs_a
, *bs_b
, *backing
;
418 BDRVTestState
*a_s
, *b_s
, *backing_s
;
420 blk_a
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
421 bs_a
= bdrv_new_open_driver(&bdrv_test
, "test-node-a", BDRV_O_RDWR
,
424 blk_insert_bs(blk_a
, bs_a
, &error_abort
);
426 blk_b
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
427 bs_b
= bdrv_new_open_driver(&bdrv_test
, "test-node-b", BDRV_O_RDWR
,
430 blk_insert_bs(blk_b
, bs_b
, &error_abort
);
432 backing
= bdrv_new_open_driver(&bdrv_test
, "backing", 0, &error_abort
);
433 backing_s
= backing
->opaque
;
434 bdrv_set_backing_hd(bs_a
, backing
, &error_abort
);
436 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 0);
437 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 0);
438 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
439 g_assert_cmpint(a_s
->drain_count
, ==, 0);
440 g_assert_cmpint(b_s
->drain_count
, ==, 0);
441 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
443 do_drain_begin(BDRV_SUBTREE_DRAIN
, bs_a
);
444 do_drain_begin(BDRV_SUBTREE_DRAIN
, bs_a
);
445 do_drain_begin(BDRV_SUBTREE_DRAIN
, bs_a
);
446 do_drain_begin(BDRV_SUBTREE_DRAIN
, bs_b
);
447 do_drain_begin(BDRV_SUBTREE_DRAIN
, bs_b
);
449 bdrv_set_backing_hd(bs_b
, backing
, &error_abort
);
450 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 5);
451 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 5);
452 g_assert_cmpint(backing
->quiesce_counter
, ==, 5);
453 g_assert_cmpint(a_s
->drain_count
, ==, 5);
454 g_assert_cmpint(b_s
->drain_count
, ==, 5);
455 g_assert_cmpint(backing_s
->drain_count
, ==, 5);
457 bdrv_set_backing_hd(bs_b
, NULL
, &error_abort
);
458 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 3);
459 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 2);
460 g_assert_cmpint(backing
->quiesce_counter
, ==, 3);
461 g_assert_cmpint(a_s
->drain_count
, ==, 3);
462 g_assert_cmpint(b_s
->drain_count
, ==, 2);
463 g_assert_cmpint(backing_s
->drain_count
, ==, 3);
465 bdrv_set_backing_hd(bs_b
, backing
, &error_abort
);
466 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 5);
467 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 5);
468 g_assert_cmpint(backing
->quiesce_counter
, ==, 5);
469 g_assert_cmpint(a_s
->drain_count
, ==, 5);
470 g_assert_cmpint(b_s
->drain_count
, ==, 5);
471 g_assert_cmpint(backing_s
->drain_count
, ==, 5);
473 do_drain_end(BDRV_SUBTREE_DRAIN
, bs_b
);
474 do_drain_end(BDRV_SUBTREE_DRAIN
, bs_b
);
475 do_drain_end(BDRV_SUBTREE_DRAIN
, bs_a
);
476 do_drain_end(BDRV_SUBTREE_DRAIN
, bs_a
);
477 do_drain_end(BDRV_SUBTREE_DRAIN
, bs_a
);
479 g_assert_cmpint(bs_a
->quiesce_counter
, ==, 0);
480 g_assert_cmpint(bs_b
->quiesce_counter
, ==, 0);
481 g_assert_cmpint(backing
->quiesce_counter
, ==, 0);
482 g_assert_cmpint(a_s
->drain_count
, ==, 0);
483 g_assert_cmpint(b_s
->drain_count
, ==, 0);
484 g_assert_cmpint(backing_s
->drain_count
, ==, 0);
494 typedef struct TestBlockJob
{
496 bool should_complete
;
499 static void test_job_completed(BlockJob
*job
, void *opaque
)
501 block_job_completed(job
, 0);
504 static void coroutine_fn
test_job_start(void *opaque
)
506 TestBlockJob
*s
= opaque
;
508 block_job_event_ready(&s
->common
);
509 while (!s
->should_complete
) {
510 block_job_sleep_ns(&s
->common
, 100000);
513 block_job_defer_to_main_loop(&s
->common
, test_job_completed
, NULL
);
516 static void test_job_complete(BlockJob
*job
, Error
**errp
)
518 TestBlockJob
*s
= container_of(job
, TestBlockJob
, common
);
519 s
->should_complete
= true;
522 BlockJobDriver test_job_driver
= {
523 .instance_size
= sizeof(TestBlockJob
),
524 .start
= test_job_start
,
525 .complete
= test_job_complete
,
528 static void test_blockjob_common(enum drain_type drain_type
)
530 BlockBackend
*blk_src
, *blk_target
;
531 BlockDriverState
*src
, *target
;
535 src
= bdrv_new_open_driver(&bdrv_test
, "source", BDRV_O_RDWR
,
537 blk_src
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
538 blk_insert_bs(blk_src
, src
, &error_abort
);
540 target
= bdrv_new_open_driver(&bdrv_test
, "target", BDRV_O_RDWR
,
542 blk_target
= blk_new(BLK_PERM_ALL
, BLK_PERM_ALL
);
543 blk_insert_bs(blk_target
, target
, &error_abort
);
545 job
= block_job_create("job0", &test_job_driver
, NULL
, src
, 0, BLK_PERM_ALL
,
546 0, 0, NULL
, NULL
, &error_abort
);
547 block_job_add_bdrv(job
, "target", target
, 0, BLK_PERM_ALL
, &error_abort
);
548 block_job_start(job
);
550 g_assert_cmpint(job
->pause_count
, ==, 0);
551 g_assert_false(job
->paused
);
552 g_assert_false(job
->busy
); /* We're in block_job_sleep_ns() */
554 do_drain_begin(drain_type
, src
);
556 if (drain_type
== BDRV_DRAIN_ALL
) {
557 /* bdrv_drain_all() drains both src and target */
558 g_assert_cmpint(job
->pause_count
, ==, 2);
560 g_assert_cmpint(job
->pause_count
, ==, 1);
562 /* XXX We don't wait until the job is actually paused. Is this okay? */
563 /* g_assert_true(job->paused); */
564 g_assert_false(job
->busy
); /* The job is paused */
566 do_drain_end(drain_type
, src
);
568 g_assert_cmpint(job
->pause_count
, ==, 0);
569 g_assert_false(job
->paused
);
570 g_assert_false(job
->busy
); /* We're in block_job_sleep_ns() */
572 do_drain_begin(drain_type
, target
);
574 if (drain_type
== BDRV_DRAIN_ALL
) {
575 /* bdrv_drain_all() drains both src and target */
576 g_assert_cmpint(job
->pause_count
, ==, 2);
578 g_assert_cmpint(job
->pause_count
, ==, 1);
580 /* XXX We don't wait until the job is actually paused. Is this okay? */
581 /* g_assert_true(job->paused); */
582 g_assert_false(job
->busy
); /* The job is paused */
584 do_drain_end(drain_type
, target
);
586 g_assert_cmpint(job
->pause_count
, ==, 0);
587 g_assert_false(job
->paused
);
588 g_assert_false(job
->busy
); /* We're in block_job_sleep_ns() */
590 ret
= block_job_complete_sync(job
, &error_abort
);
591 g_assert_cmpint(ret
, ==, 0);
594 blk_unref(blk_target
);
599 static void test_blockjob_drain_all(void)
601 test_blockjob_common(BDRV_DRAIN_ALL
);
604 static void test_blockjob_drain(void)
606 test_blockjob_common(BDRV_DRAIN
);
609 static void test_blockjob_drain_subtree(void)
611 test_blockjob_common(BDRV_SUBTREE_DRAIN
);
614 int main(int argc
, char **argv
)
617 qemu_init_main_loop(&error_abort
);
619 g_test_init(&argc
, &argv
, NULL
);
621 g_test_add_func("/bdrv-drain/driver-cb/drain_all", test_drv_cb_drain_all
);
622 g_test_add_func("/bdrv-drain/driver-cb/drain", test_drv_cb_drain
);
623 g_test_add_func("/bdrv-drain/driver-cb/drain_subtree",
624 test_drv_cb_drain_subtree
);
626 // XXX bdrv_drain_all() doesn't work in coroutine context
627 g_test_add_func("/bdrv-drain/driver-cb/co/drain", test_drv_cb_co_drain
);
628 g_test_add_func("/bdrv-drain/driver-cb/co/drain_subtree",
629 test_drv_cb_co_drain_subtree
);
632 g_test_add_func("/bdrv-drain/quiesce/drain_all", test_quiesce_drain_all
);
633 g_test_add_func("/bdrv-drain/quiesce/drain", test_quiesce_drain
);
634 g_test_add_func("/bdrv-drain/quiesce/drain_subtree",
635 test_quiesce_drain_subtree
);
637 // XXX bdrv_drain_all() doesn't work in coroutine context
638 g_test_add_func("/bdrv-drain/quiesce/co/drain", test_quiesce_co_drain
);
639 g_test_add_func("/bdrv-drain/quiesce/co/drain_subtree",
640 test_quiesce_co_drain_subtree
);
642 g_test_add_func("/bdrv-drain/nested", test_nested
);
643 g_test_add_func("/bdrv-drain/multiparent", test_multiparent
);
644 g_test_add_func("/bdrv-drain/graph-change", test_graph_change
);
646 g_test_add_func("/bdrv-drain/blockjob/drain_all", test_blockjob_drain_all
);
647 g_test_add_func("/bdrv-drain/blockjob/drain", test_blockjob_drain
);
648 g_test_add_func("/bdrv-drain/blockjob/drain_subtree",
649 test_blockjob_drain_subtree
);