virtio: Fix compilation without CONFIG_VHOST_SCSI
[qemu/ar7.git] / tests / test-aio.c
blobc1738706cd20bbfaaa694abbae871d866f92aa05
1 /*
2 * AioContext tests
4 * Copyright Red Hat, Inc. 2012
6 * Authors:
7 * Paolo Bonzini <pbonzini@redhat.com>
9 * This work is licensed under the terms of the GNU LGPL, version 2 or later.
10 * See the COPYING.LIB file in the top-level directory.
13 #include <glib.h>
14 #include "block/aio.h"
16 AioContext *ctx;
18 /* Wait until there are no more BHs or AIO requests */
19 static void wait_for_aio(void)
21 while (aio_poll(ctx, true)) {
22 /* Do nothing */
26 /* Simple callbacks for testing. */
28 typedef struct {
29 QEMUBH *bh;
30 int n;
31 int max;
32 } BHTestData;
34 static void bh_test_cb(void *opaque)
36 BHTestData *data = opaque;
37 if (++data->n < data->max) {
38 qemu_bh_schedule(data->bh);
42 static void bh_delete_cb(void *opaque)
44 BHTestData *data = opaque;
45 if (++data->n < data->max) {
46 qemu_bh_schedule(data->bh);
47 } else {
48 qemu_bh_delete(data->bh);
49 data->bh = NULL;
53 typedef struct {
54 EventNotifier e;
55 int n;
56 int active;
57 bool auto_set;
58 } EventNotifierTestData;
60 static int event_active_cb(EventNotifier *e)
62 EventNotifierTestData *data = container_of(e, EventNotifierTestData, e);
63 return data->active > 0;
66 static void event_ready_cb(EventNotifier *e)
68 EventNotifierTestData *data = container_of(e, EventNotifierTestData, e);
69 g_assert(event_notifier_test_and_clear(e));
70 data->n++;
71 if (data->active > 0) {
72 data->active--;
74 if (data->auto_set && data->active) {
75 event_notifier_set(e);
79 /* Tests using aio_*. */
81 static void test_notify(void)
83 g_assert(!aio_poll(ctx, false));
84 aio_notify(ctx);
85 g_assert(!aio_poll(ctx, true));
86 g_assert(!aio_poll(ctx, false));
89 static void test_bh_schedule(void)
91 BHTestData data = { .n = 0 };
92 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
94 qemu_bh_schedule(data.bh);
95 g_assert_cmpint(data.n, ==, 0);
97 g_assert(aio_poll(ctx, true));
98 g_assert_cmpint(data.n, ==, 1);
100 g_assert(!aio_poll(ctx, false));
101 g_assert_cmpint(data.n, ==, 1);
102 qemu_bh_delete(data.bh);
105 static void test_bh_schedule10(void)
107 BHTestData data = { .n = 0, .max = 10 };
108 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
110 qemu_bh_schedule(data.bh);
111 g_assert_cmpint(data.n, ==, 0);
113 g_assert(aio_poll(ctx, false));
114 g_assert_cmpint(data.n, ==, 1);
116 g_assert(aio_poll(ctx, true));
117 g_assert_cmpint(data.n, ==, 2);
119 wait_for_aio();
120 g_assert_cmpint(data.n, ==, 10);
122 g_assert(!aio_poll(ctx, false));
123 g_assert_cmpint(data.n, ==, 10);
124 qemu_bh_delete(data.bh);
127 static void test_bh_cancel(void)
129 BHTestData data = { .n = 0 };
130 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
132 qemu_bh_schedule(data.bh);
133 g_assert_cmpint(data.n, ==, 0);
135 qemu_bh_cancel(data.bh);
136 g_assert_cmpint(data.n, ==, 0);
138 g_assert(!aio_poll(ctx, false));
139 g_assert_cmpint(data.n, ==, 0);
140 qemu_bh_delete(data.bh);
143 static void test_bh_delete(void)
145 BHTestData data = { .n = 0 };
146 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
148 qemu_bh_schedule(data.bh);
149 g_assert_cmpint(data.n, ==, 0);
151 qemu_bh_delete(data.bh);
152 g_assert_cmpint(data.n, ==, 0);
154 g_assert(!aio_poll(ctx, false));
155 g_assert_cmpint(data.n, ==, 0);
158 static void test_bh_delete_from_cb(void)
160 BHTestData data1 = { .n = 0, .max = 1 };
162 data1.bh = aio_bh_new(ctx, bh_delete_cb, &data1);
164 qemu_bh_schedule(data1.bh);
165 g_assert_cmpint(data1.n, ==, 0);
167 wait_for_aio();
168 g_assert_cmpint(data1.n, ==, data1.max);
169 g_assert(data1.bh == NULL);
171 g_assert(!aio_poll(ctx, false));
172 g_assert(!aio_poll(ctx, true));
175 static void test_bh_delete_from_cb_many(void)
177 BHTestData data1 = { .n = 0, .max = 1 };
178 BHTestData data2 = { .n = 0, .max = 3 };
179 BHTestData data3 = { .n = 0, .max = 2 };
180 BHTestData data4 = { .n = 0, .max = 4 };
182 data1.bh = aio_bh_new(ctx, bh_delete_cb, &data1);
183 data2.bh = aio_bh_new(ctx, bh_delete_cb, &data2);
184 data3.bh = aio_bh_new(ctx, bh_delete_cb, &data3);
185 data4.bh = aio_bh_new(ctx, bh_delete_cb, &data4);
187 qemu_bh_schedule(data1.bh);
188 qemu_bh_schedule(data2.bh);
189 qemu_bh_schedule(data3.bh);
190 qemu_bh_schedule(data4.bh);
191 g_assert_cmpint(data1.n, ==, 0);
192 g_assert_cmpint(data2.n, ==, 0);
193 g_assert_cmpint(data3.n, ==, 0);
194 g_assert_cmpint(data4.n, ==, 0);
196 g_assert(aio_poll(ctx, false));
197 g_assert_cmpint(data1.n, ==, 1);
198 g_assert_cmpint(data2.n, ==, 1);
199 g_assert_cmpint(data3.n, ==, 1);
200 g_assert_cmpint(data4.n, ==, 1);
201 g_assert(data1.bh == NULL);
203 wait_for_aio();
204 g_assert_cmpint(data1.n, ==, data1.max);
205 g_assert_cmpint(data2.n, ==, data2.max);
206 g_assert_cmpint(data3.n, ==, data3.max);
207 g_assert_cmpint(data4.n, ==, data4.max);
208 g_assert(data1.bh == NULL);
209 g_assert(data2.bh == NULL);
210 g_assert(data3.bh == NULL);
211 g_assert(data4.bh == NULL);
214 static void test_bh_flush(void)
216 BHTestData data = { .n = 0 };
217 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
219 qemu_bh_schedule(data.bh);
220 g_assert_cmpint(data.n, ==, 0);
222 wait_for_aio();
223 g_assert_cmpint(data.n, ==, 1);
225 g_assert(!aio_poll(ctx, false));
226 g_assert_cmpint(data.n, ==, 1);
227 qemu_bh_delete(data.bh);
230 static void test_set_event_notifier(void)
232 EventNotifierTestData data = { .n = 0, .active = 0 };
233 event_notifier_init(&data.e, false);
234 aio_set_event_notifier(ctx, &data.e, event_ready_cb, event_active_cb);
235 g_assert(!aio_poll(ctx, false));
236 g_assert_cmpint(data.n, ==, 0);
238 aio_set_event_notifier(ctx, &data.e, NULL, NULL);
239 g_assert(!aio_poll(ctx, false));
240 g_assert_cmpint(data.n, ==, 0);
241 event_notifier_cleanup(&data.e);
244 static void test_wait_event_notifier(void)
246 EventNotifierTestData data = { .n = 0, .active = 1 };
247 event_notifier_init(&data.e, false);
248 aio_set_event_notifier(ctx, &data.e, event_ready_cb, event_active_cb);
249 g_assert(aio_poll(ctx, false));
250 g_assert_cmpint(data.n, ==, 0);
251 g_assert_cmpint(data.active, ==, 1);
253 event_notifier_set(&data.e);
254 g_assert(aio_poll(ctx, false));
255 g_assert_cmpint(data.n, ==, 1);
256 g_assert_cmpint(data.active, ==, 0);
258 g_assert(!aio_poll(ctx, false));
259 g_assert_cmpint(data.n, ==, 1);
260 g_assert_cmpint(data.active, ==, 0);
262 aio_set_event_notifier(ctx, &data.e, NULL, NULL);
263 g_assert(!aio_poll(ctx, false));
264 g_assert_cmpint(data.n, ==, 1);
266 event_notifier_cleanup(&data.e);
269 static void test_flush_event_notifier(void)
271 EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true };
272 event_notifier_init(&data.e, false);
273 aio_set_event_notifier(ctx, &data.e, event_ready_cb, event_active_cb);
274 g_assert(aio_poll(ctx, false));
275 g_assert_cmpint(data.n, ==, 0);
276 g_assert_cmpint(data.active, ==, 10);
278 event_notifier_set(&data.e);
279 g_assert(aio_poll(ctx, false));
280 g_assert_cmpint(data.n, ==, 1);
281 g_assert_cmpint(data.active, ==, 9);
282 g_assert(aio_poll(ctx, false));
284 wait_for_aio();
285 g_assert_cmpint(data.n, ==, 10);
286 g_assert_cmpint(data.active, ==, 0);
287 g_assert(!aio_poll(ctx, false));
289 aio_set_event_notifier(ctx, &data.e, NULL, NULL);
290 g_assert(!aio_poll(ctx, false));
291 event_notifier_cleanup(&data.e);
294 static void test_wait_event_notifier_noflush(void)
296 EventNotifierTestData data = { .n = 0 };
297 EventNotifierTestData dummy = { .n = 0, .active = 1 };
299 event_notifier_init(&data.e, false);
300 aio_set_event_notifier(ctx, &data.e, event_ready_cb, NULL);
302 g_assert(!aio_poll(ctx, false));
303 g_assert_cmpint(data.n, ==, 0);
305 /* Until there is an active descriptor, aio_poll may or may not call
306 * event_ready_cb. Still, it must not block. */
307 event_notifier_set(&data.e);
308 g_assert(!aio_poll(ctx, true));
309 data.n = 0;
311 /* An active event notifier forces aio_poll to look at EventNotifiers. */
312 event_notifier_init(&dummy.e, false);
313 aio_set_event_notifier(ctx, &dummy.e, event_ready_cb, event_active_cb);
315 event_notifier_set(&data.e);
316 g_assert(aio_poll(ctx, false));
317 g_assert_cmpint(data.n, ==, 1);
318 g_assert(aio_poll(ctx, false));
319 g_assert_cmpint(data.n, ==, 1);
321 event_notifier_set(&data.e);
322 g_assert(aio_poll(ctx, false));
323 g_assert_cmpint(data.n, ==, 2);
324 g_assert(aio_poll(ctx, false));
325 g_assert_cmpint(data.n, ==, 2);
327 event_notifier_set(&dummy.e);
328 wait_for_aio();
329 g_assert_cmpint(data.n, ==, 2);
330 g_assert_cmpint(dummy.n, ==, 1);
331 g_assert_cmpint(dummy.active, ==, 0);
333 aio_set_event_notifier(ctx, &dummy.e, NULL, NULL);
334 event_notifier_cleanup(&dummy.e);
336 aio_set_event_notifier(ctx, &data.e, NULL, NULL);
337 g_assert(!aio_poll(ctx, false));
338 g_assert_cmpint(data.n, ==, 2);
340 event_notifier_cleanup(&data.e);
343 /* Now the same tests, using the context as a GSource. They are
344 * very similar to the ones above, with g_main_context_iteration
345 * replacing aio_poll. However:
346 * - sometimes both the AioContext and the glib main loop wake
347 * themselves up. Hence, some "g_assert(!aio_poll(ctx, false));"
348 * are replaced by "while (g_main_context_iteration(NULL, false));".
349 * - there is no exact replacement for a blocking wait.
350 * "while (g_main_context_iteration(NULL, true)" seems to work,
351 * but it is not documented _why_ it works. For these tests a
352 * non-blocking loop like "while (g_main_context_iteration(NULL, false)"
353 * works well, and that's what I am using.
356 static void test_source_notify(void)
358 while (g_main_context_iteration(NULL, false));
359 aio_notify(ctx);
360 g_assert(g_main_context_iteration(NULL, true));
361 g_assert(!g_main_context_iteration(NULL, false));
364 static void test_source_flush(void)
366 g_assert(!g_main_context_iteration(NULL, false));
367 aio_notify(ctx);
368 while (g_main_context_iteration(NULL, false));
369 g_assert(!g_main_context_iteration(NULL, false));
372 static void test_source_bh_schedule(void)
374 BHTestData data = { .n = 0 };
375 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
377 qemu_bh_schedule(data.bh);
378 g_assert_cmpint(data.n, ==, 0);
380 g_assert(g_main_context_iteration(NULL, true));
381 g_assert_cmpint(data.n, ==, 1);
383 g_assert(!g_main_context_iteration(NULL, false));
384 g_assert_cmpint(data.n, ==, 1);
385 qemu_bh_delete(data.bh);
388 static void test_source_bh_schedule10(void)
390 BHTestData data = { .n = 0, .max = 10 };
391 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
393 qemu_bh_schedule(data.bh);
394 g_assert_cmpint(data.n, ==, 0);
396 g_assert(g_main_context_iteration(NULL, false));
397 g_assert_cmpint(data.n, ==, 1);
399 g_assert(g_main_context_iteration(NULL, true));
400 g_assert_cmpint(data.n, ==, 2);
402 while (g_main_context_iteration(NULL, false));
403 g_assert_cmpint(data.n, ==, 10);
405 g_assert(!g_main_context_iteration(NULL, false));
406 g_assert_cmpint(data.n, ==, 10);
407 qemu_bh_delete(data.bh);
410 static void test_source_bh_cancel(void)
412 BHTestData data = { .n = 0 };
413 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
415 qemu_bh_schedule(data.bh);
416 g_assert_cmpint(data.n, ==, 0);
418 qemu_bh_cancel(data.bh);
419 g_assert_cmpint(data.n, ==, 0);
421 while (g_main_context_iteration(NULL, false));
422 g_assert_cmpint(data.n, ==, 0);
423 qemu_bh_delete(data.bh);
426 static void test_source_bh_delete(void)
428 BHTestData data = { .n = 0 };
429 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
431 qemu_bh_schedule(data.bh);
432 g_assert_cmpint(data.n, ==, 0);
434 qemu_bh_delete(data.bh);
435 g_assert_cmpint(data.n, ==, 0);
437 while (g_main_context_iteration(NULL, false));
438 g_assert_cmpint(data.n, ==, 0);
441 static void test_source_bh_delete_from_cb(void)
443 BHTestData data1 = { .n = 0, .max = 1 };
445 data1.bh = aio_bh_new(ctx, bh_delete_cb, &data1);
447 qemu_bh_schedule(data1.bh);
448 g_assert_cmpint(data1.n, ==, 0);
450 g_main_context_iteration(NULL, true);
451 g_assert_cmpint(data1.n, ==, data1.max);
452 g_assert(data1.bh == NULL);
454 g_assert(!g_main_context_iteration(NULL, false));
457 static void test_source_bh_delete_from_cb_many(void)
459 BHTestData data1 = { .n = 0, .max = 1 };
460 BHTestData data2 = { .n = 0, .max = 3 };
461 BHTestData data3 = { .n = 0, .max = 2 };
462 BHTestData data4 = { .n = 0, .max = 4 };
464 data1.bh = aio_bh_new(ctx, bh_delete_cb, &data1);
465 data2.bh = aio_bh_new(ctx, bh_delete_cb, &data2);
466 data3.bh = aio_bh_new(ctx, bh_delete_cb, &data3);
467 data4.bh = aio_bh_new(ctx, bh_delete_cb, &data4);
469 qemu_bh_schedule(data1.bh);
470 qemu_bh_schedule(data2.bh);
471 qemu_bh_schedule(data3.bh);
472 qemu_bh_schedule(data4.bh);
473 g_assert_cmpint(data1.n, ==, 0);
474 g_assert_cmpint(data2.n, ==, 0);
475 g_assert_cmpint(data3.n, ==, 0);
476 g_assert_cmpint(data4.n, ==, 0);
478 g_assert(g_main_context_iteration(NULL, false));
479 g_assert_cmpint(data1.n, ==, 1);
480 g_assert_cmpint(data2.n, ==, 1);
481 g_assert_cmpint(data3.n, ==, 1);
482 g_assert_cmpint(data4.n, ==, 1);
483 g_assert(data1.bh == NULL);
485 while (g_main_context_iteration(NULL, false));
486 g_assert_cmpint(data1.n, ==, data1.max);
487 g_assert_cmpint(data2.n, ==, data2.max);
488 g_assert_cmpint(data3.n, ==, data3.max);
489 g_assert_cmpint(data4.n, ==, data4.max);
490 g_assert(data1.bh == NULL);
491 g_assert(data2.bh == NULL);
492 g_assert(data3.bh == NULL);
493 g_assert(data4.bh == NULL);
496 static void test_source_bh_flush(void)
498 BHTestData data = { .n = 0 };
499 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
501 qemu_bh_schedule(data.bh);
502 g_assert_cmpint(data.n, ==, 0);
504 g_assert(g_main_context_iteration(NULL, true));
505 g_assert_cmpint(data.n, ==, 1);
507 g_assert(!g_main_context_iteration(NULL, false));
508 g_assert_cmpint(data.n, ==, 1);
509 qemu_bh_delete(data.bh);
512 static void test_source_set_event_notifier(void)
514 EventNotifierTestData data = { .n = 0, .active = 0 };
515 event_notifier_init(&data.e, false);
516 aio_set_event_notifier(ctx, &data.e, event_ready_cb, event_active_cb);
517 while (g_main_context_iteration(NULL, false));
518 g_assert_cmpint(data.n, ==, 0);
520 aio_set_event_notifier(ctx, &data.e, NULL, NULL);
521 while (g_main_context_iteration(NULL, false));
522 g_assert_cmpint(data.n, ==, 0);
523 event_notifier_cleanup(&data.e);
526 static void test_source_wait_event_notifier(void)
528 EventNotifierTestData data = { .n = 0, .active = 1 };
529 event_notifier_init(&data.e, false);
530 aio_set_event_notifier(ctx, &data.e, event_ready_cb, event_active_cb);
531 g_assert(g_main_context_iteration(NULL, false));
532 g_assert_cmpint(data.n, ==, 0);
533 g_assert_cmpint(data.active, ==, 1);
535 event_notifier_set(&data.e);
536 g_assert(g_main_context_iteration(NULL, false));
537 g_assert_cmpint(data.n, ==, 1);
538 g_assert_cmpint(data.active, ==, 0);
540 while (g_main_context_iteration(NULL, false));
541 g_assert_cmpint(data.n, ==, 1);
542 g_assert_cmpint(data.active, ==, 0);
544 aio_set_event_notifier(ctx, &data.e, NULL, NULL);
545 while (g_main_context_iteration(NULL, false));
546 g_assert_cmpint(data.n, ==, 1);
548 event_notifier_cleanup(&data.e);
551 static void test_source_flush_event_notifier(void)
553 EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true };
554 event_notifier_init(&data.e, false);
555 aio_set_event_notifier(ctx, &data.e, event_ready_cb, event_active_cb);
556 g_assert(g_main_context_iteration(NULL, false));
557 g_assert_cmpint(data.n, ==, 0);
558 g_assert_cmpint(data.active, ==, 10);
560 event_notifier_set(&data.e);
561 g_assert(g_main_context_iteration(NULL, false));
562 g_assert_cmpint(data.n, ==, 1);
563 g_assert_cmpint(data.active, ==, 9);
564 g_assert(g_main_context_iteration(NULL, false));
566 while (g_main_context_iteration(NULL, false));
567 g_assert_cmpint(data.n, ==, 10);
568 g_assert_cmpint(data.active, ==, 0);
569 g_assert(!g_main_context_iteration(NULL, false));
571 aio_set_event_notifier(ctx, &data.e, NULL, NULL);
572 while (g_main_context_iteration(NULL, false));
573 event_notifier_cleanup(&data.e);
576 static void test_source_wait_event_notifier_noflush(void)
578 EventNotifierTestData data = { .n = 0 };
579 EventNotifierTestData dummy = { .n = 0, .active = 1 };
581 event_notifier_init(&data.e, false);
582 aio_set_event_notifier(ctx, &data.e, event_ready_cb, NULL);
584 while (g_main_context_iteration(NULL, false));
585 g_assert_cmpint(data.n, ==, 0);
587 /* Until there is an active descriptor, glib may or may not call
588 * event_ready_cb. Still, it must not block. */
589 event_notifier_set(&data.e);
590 g_main_context_iteration(NULL, true);
591 data.n = 0;
593 /* An active event notifier forces aio_poll to look at EventNotifiers. */
594 event_notifier_init(&dummy.e, false);
595 aio_set_event_notifier(ctx, &dummy.e, event_ready_cb, event_active_cb);
597 event_notifier_set(&data.e);
598 g_assert(g_main_context_iteration(NULL, false));
599 g_assert_cmpint(data.n, ==, 1);
600 g_assert(!g_main_context_iteration(NULL, false));
601 g_assert_cmpint(data.n, ==, 1);
603 event_notifier_set(&data.e);
604 g_assert(g_main_context_iteration(NULL, false));
605 g_assert_cmpint(data.n, ==, 2);
606 g_assert(!g_main_context_iteration(NULL, false));
607 g_assert_cmpint(data.n, ==, 2);
609 event_notifier_set(&dummy.e);
610 while (g_main_context_iteration(NULL, false));
611 g_assert_cmpint(data.n, ==, 2);
612 g_assert_cmpint(dummy.n, ==, 1);
613 g_assert_cmpint(dummy.active, ==, 0);
615 aio_set_event_notifier(ctx, &dummy.e, NULL, NULL);
616 event_notifier_cleanup(&dummy.e);
618 aio_set_event_notifier(ctx, &data.e, NULL, NULL);
619 while (g_main_context_iteration(NULL, false));
620 g_assert_cmpint(data.n, ==, 2);
622 event_notifier_cleanup(&data.e);
625 /* End of tests. */
627 int main(int argc, char **argv)
629 GSource *src;
631 ctx = aio_context_new();
632 src = aio_get_g_source(ctx);
633 g_source_attach(src, NULL);
634 g_source_unref(src);
636 while (g_main_context_iteration(NULL, false));
638 g_test_init(&argc, &argv, NULL);
639 g_test_add_func("/aio/notify", test_notify);
640 g_test_add_func("/aio/bh/schedule", test_bh_schedule);
641 g_test_add_func("/aio/bh/schedule10", test_bh_schedule10);
642 g_test_add_func("/aio/bh/cancel", test_bh_cancel);
643 g_test_add_func("/aio/bh/delete", test_bh_delete);
644 g_test_add_func("/aio/bh/callback-delete/one", test_bh_delete_from_cb);
645 g_test_add_func("/aio/bh/callback-delete/many", test_bh_delete_from_cb_many);
646 g_test_add_func("/aio/bh/flush", test_bh_flush);
647 g_test_add_func("/aio/event/add-remove", test_set_event_notifier);
648 g_test_add_func("/aio/event/wait", test_wait_event_notifier);
649 g_test_add_func("/aio/event/wait/no-flush-cb", test_wait_event_notifier_noflush);
650 g_test_add_func("/aio/event/flush", test_flush_event_notifier);
652 g_test_add_func("/aio-gsource/notify", test_source_notify);
653 g_test_add_func("/aio-gsource/flush", test_source_flush);
654 g_test_add_func("/aio-gsource/bh/schedule", test_source_bh_schedule);
655 g_test_add_func("/aio-gsource/bh/schedule10", test_source_bh_schedule10);
656 g_test_add_func("/aio-gsource/bh/cancel", test_source_bh_cancel);
657 g_test_add_func("/aio-gsource/bh/delete", test_source_bh_delete);
658 g_test_add_func("/aio-gsource/bh/callback-delete/one", test_source_bh_delete_from_cb);
659 g_test_add_func("/aio-gsource/bh/callback-delete/many", test_source_bh_delete_from_cb_many);
660 g_test_add_func("/aio-gsource/bh/flush", test_source_bh_flush);
661 g_test_add_func("/aio-gsource/event/add-remove", test_source_set_event_notifier);
662 g_test_add_func("/aio-gsource/event/wait", test_source_wait_event_notifier);
663 g_test_add_func("/aio-gsource/event/wait/no-flush-cb", test_source_wait_event_notifier_noflush);
664 g_test_add_func("/aio-gsource/event/flush", test_source_flush_event_notifier);
665 return g_test_run();