aio / timers: Convert mainloop to use timeout
[qemu/cris-port.git] / tests / test-aio.c
blobe1f394b75cf6f9b77b6993bb0e70d11565546ce8
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"
15 #include "qemu/timer.h"
17 AioContext *ctx;
19 typedef struct {
20 EventNotifier e;
21 int n;
22 int active;
23 bool auto_set;
24 } EventNotifierTestData;
26 /* Wait until there are no more BHs or AIO requests */
27 static void wait_for_aio(void)
29 while (aio_poll(ctx, true)) {
30 /* Do nothing */
34 /* Wait until event notifier becomes inactive */
35 static void wait_until_inactive(EventNotifierTestData *data)
37 while (data->active > 0) {
38 aio_poll(ctx, true);
42 /* Simple callbacks for testing. */
44 typedef struct {
45 QEMUBH *bh;
46 int n;
47 int max;
48 } BHTestData;
50 static void bh_test_cb(void *opaque)
52 BHTestData *data = opaque;
53 if (++data->n < data->max) {
54 qemu_bh_schedule(data->bh);
58 static void bh_delete_cb(void *opaque)
60 BHTestData *data = opaque;
61 if (++data->n < data->max) {
62 qemu_bh_schedule(data->bh);
63 } else {
64 qemu_bh_delete(data->bh);
65 data->bh = NULL;
69 static void event_ready_cb(EventNotifier *e)
71 EventNotifierTestData *data = container_of(e, EventNotifierTestData, e);
72 g_assert(event_notifier_test_and_clear(e));
73 data->n++;
74 if (data->active > 0) {
75 data->active--;
77 if (data->auto_set && data->active) {
78 event_notifier_set(e);
82 /* Tests using aio_*. */
84 static void test_notify(void)
86 g_assert(!aio_poll(ctx, false));
87 aio_notify(ctx);
88 g_assert(!aio_poll(ctx, true));
89 g_assert(!aio_poll(ctx, false));
92 static void test_bh_schedule(void)
94 BHTestData data = { .n = 0 };
95 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
97 qemu_bh_schedule(data.bh);
98 g_assert_cmpint(data.n, ==, 0);
100 g_assert(aio_poll(ctx, true));
101 g_assert_cmpint(data.n, ==, 1);
103 g_assert(!aio_poll(ctx, false));
104 g_assert_cmpint(data.n, ==, 1);
105 qemu_bh_delete(data.bh);
108 static void test_bh_schedule10(void)
110 BHTestData data = { .n = 0, .max = 10 };
111 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
113 qemu_bh_schedule(data.bh);
114 g_assert_cmpint(data.n, ==, 0);
116 g_assert(aio_poll(ctx, false));
117 g_assert_cmpint(data.n, ==, 1);
119 g_assert(aio_poll(ctx, true));
120 g_assert_cmpint(data.n, ==, 2);
122 wait_for_aio();
123 g_assert_cmpint(data.n, ==, 10);
125 g_assert(!aio_poll(ctx, false));
126 g_assert_cmpint(data.n, ==, 10);
127 qemu_bh_delete(data.bh);
130 static void test_bh_cancel(void)
132 BHTestData data = { .n = 0 };
133 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
135 qemu_bh_schedule(data.bh);
136 g_assert_cmpint(data.n, ==, 0);
138 qemu_bh_cancel(data.bh);
139 g_assert_cmpint(data.n, ==, 0);
141 g_assert(!aio_poll(ctx, false));
142 g_assert_cmpint(data.n, ==, 0);
143 qemu_bh_delete(data.bh);
146 static void test_bh_delete(void)
148 BHTestData data = { .n = 0 };
149 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
151 qemu_bh_schedule(data.bh);
152 g_assert_cmpint(data.n, ==, 0);
154 qemu_bh_delete(data.bh);
155 g_assert_cmpint(data.n, ==, 0);
157 g_assert(!aio_poll(ctx, false));
158 g_assert_cmpint(data.n, ==, 0);
161 static void test_bh_delete_from_cb(void)
163 BHTestData data1 = { .n = 0, .max = 1 };
165 data1.bh = aio_bh_new(ctx, bh_delete_cb, &data1);
167 qemu_bh_schedule(data1.bh);
168 g_assert_cmpint(data1.n, ==, 0);
170 wait_for_aio();
171 g_assert_cmpint(data1.n, ==, data1.max);
172 g_assert(data1.bh == NULL);
174 g_assert(!aio_poll(ctx, false));
175 g_assert(!aio_poll(ctx, true));
178 static void test_bh_delete_from_cb_many(void)
180 BHTestData data1 = { .n = 0, .max = 1 };
181 BHTestData data2 = { .n = 0, .max = 3 };
182 BHTestData data3 = { .n = 0, .max = 2 };
183 BHTestData data4 = { .n = 0, .max = 4 };
185 data1.bh = aio_bh_new(ctx, bh_delete_cb, &data1);
186 data2.bh = aio_bh_new(ctx, bh_delete_cb, &data2);
187 data3.bh = aio_bh_new(ctx, bh_delete_cb, &data3);
188 data4.bh = aio_bh_new(ctx, bh_delete_cb, &data4);
190 qemu_bh_schedule(data1.bh);
191 qemu_bh_schedule(data2.bh);
192 qemu_bh_schedule(data3.bh);
193 qemu_bh_schedule(data4.bh);
194 g_assert_cmpint(data1.n, ==, 0);
195 g_assert_cmpint(data2.n, ==, 0);
196 g_assert_cmpint(data3.n, ==, 0);
197 g_assert_cmpint(data4.n, ==, 0);
199 g_assert(aio_poll(ctx, false));
200 g_assert_cmpint(data1.n, ==, 1);
201 g_assert_cmpint(data2.n, ==, 1);
202 g_assert_cmpint(data3.n, ==, 1);
203 g_assert_cmpint(data4.n, ==, 1);
204 g_assert(data1.bh == NULL);
206 wait_for_aio();
207 g_assert_cmpint(data1.n, ==, data1.max);
208 g_assert_cmpint(data2.n, ==, data2.max);
209 g_assert_cmpint(data3.n, ==, data3.max);
210 g_assert_cmpint(data4.n, ==, data4.max);
211 g_assert(data1.bh == NULL);
212 g_assert(data2.bh == NULL);
213 g_assert(data3.bh == NULL);
214 g_assert(data4.bh == NULL);
217 static void test_bh_flush(void)
219 BHTestData data = { .n = 0 };
220 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
222 qemu_bh_schedule(data.bh);
223 g_assert_cmpint(data.n, ==, 0);
225 wait_for_aio();
226 g_assert_cmpint(data.n, ==, 1);
228 g_assert(!aio_poll(ctx, false));
229 g_assert_cmpint(data.n, ==, 1);
230 qemu_bh_delete(data.bh);
233 static void test_set_event_notifier(void)
235 EventNotifierTestData data = { .n = 0, .active = 0 };
236 event_notifier_init(&data.e, false);
237 aio_set_event_notifier(ctx, &data.e, event_ready_cb);
238 g_assert(!aio_poll(ctx, false));
239 g_assert_cmpint(data.n, ==, 0);
241 aio_set_event_notifier(ctx, &data.e, NULL);
242 g_assert(!aio_poll(ctx, false));
243 g_assert_cmpint(data.n, ==, 0);
244 event_notifier_cleanup(&data.e);
247 static void test_wait_event_notifier(void)
249 EventNotifierTestData data = { .n = 0, .active = 1 };
250 event_notifier_init(&data.e, false);
251 aio_set_event_notifier(ctx, &data.e, event_ready_cb);
252 g_assert(!aio_poll(ctx, false));
253 g_assert_cmpint(data.n, ==, 0);
254 g_assert_cmpint(data.active, ==, 1);
256 event_notifier_set(&data.e);
257 g_assert(aio_poll(ctx, false));
258 g_assert_cmpint(data.n, ==, 1);
259 g_assert_cmpint(data.active, ==, 0);
261 g_assert(!aio_poll(ctx, false));
262 g_assert_cmpint(data.n, ==, 1);
263 g_assert_cmpint(data.active, ==, 0);
265 aio_set_event_notifier(ctx, &data.e, NULL);
266 g_assert(!aio_poll(ctx, false));
267 g_assert_cmpint(data.n, ==, 1);
269 event_notifier_cleanup(&data.e);
272 static void test_flush_event_notifier(void)
274 EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true };
275 event_notifier_init(&data.e, false);
276 aio_set_event_notifier(ctx, &data.e, event_ready_cb);
277 g_assert(!aio_poll(ctx, false));
278 g_assert_cmpint(data.n, ==, 0);
279 g_assert_cmpint(data.active, ==, 10);
281 event_notifier_set(&data.e);
282 g_assert(aio_poll(ctx, false));
283 g_assert_cmpint(data.n, ==, 1);
284 g_assert_cmpint(data.active, ==, 9);
285 g_assert(aio_poll(ctx, false));
287 wait_until_inactive(&data);
288 g_assert_cmpint(data.n, ==, 10);
289 g_assert_cmpint(data.active, ==, 0);
290 g_assert(!aio_poll(ctx, false));
292 aio_set_event_notifier(ctx, &data.e, NULL);
293 g_assert(!aio_poll(ctx, false));
294 event_notifier_cleanup(&data.e);
297 static void test_wait_event_notifier_noflush(void)
299 EventNotifierTestData data = { .n = 0 };
300 EventNotifierTestData dummy = { .n = 0, .active = 1 };
302 event_notifier_init(&data.e, false);
303 aio_set_event_notifier(ctx, &data.e, event_ready_cb);
305 g_assert(!aio_poll(ctx, false));
306 g_assert_cmpint(data.n, ==, 0);
308 /* Until there is an active descriptor, aio_poll may or may not call
309 * event_ready_cb. Still, it must not block. */
310 event_notifier_set(&data.e);
311 g_assert(aio_poll(ctx, true));
312 data.n = 0;
314 /* An active event notifier forces aio_poll to look at EventNotifiers. */
315 event_notifier_init(&dummy.e, false);
316 aio_set_event_notifier(ctx, &dummy.e, event_ready_cb);
318 event_notifier_set(&data.e);
319 g_assert(aio_poll(ctx, false));
320 g_assert_cmpint(data.n, ==, 1);
321 g_assert(!aio_poll(ctx, false));
322 g_assert_cmpint(data.n, ==, 1);
324 event_notifier_set(&data.e);
325 g_assert(aio_poll(ctx, false));
326 g_assert_cmpint(data.n, ==, 2);
327 g_assert(!aio_poll(ctx, false));
328 g_assert_cmpint(data.n, ==, 2);
330 event_notifier_set(&dummy.e);
331 wait_until_inactive(&dummy);
332 g_assert_cmpint(data.n, ==, 2);
333 g_assert_cmpint(dummy.n, ==, 1);
334 g_assert_cmpint(dummy.active, ==, 0);
336 aio_set_event_notifier(ctx, &dummy.e, NULL);
337 event_notifier_cleanup(&dummy.e);
339 aio_set_event_notifier(ctx, &data.e, NULL);
340 g_assert(!aio_poll(ctx, false));
341 g_assert_cmpint(data.n, ==, 2);
343 event_notifier_cleanup(&data.e);
346 /* Now the same tests, using the context as a GSource. They are
347 * very similar to the ones above, with g_main_context_iteration
348 * replacing aio_poll. However:
349 * - sometimes both the AioContext and the glib main loop wake
350 * themselves up. Hence, some "g_assert(!aio_poll(ctx, false));"
351 * are replaced by "while (g_main_context_iteration(NULL, false));".
352 * - there is no exact replacement for a blocking wait.
353 * "while (g_main_context_iteration(NULL, true)" seems to work,
354 * but it is not documented _why_ it works. For these tests a
355 * non-blocking loop like "while (g_main_context_iteration(NULL, false)"
356 * works well, and that's what I am using.
359 static void test_source_notify(void)
361 while (g_main_context_iteration(NULL, false));
362 aio_notify(ctx);
363 g_assert(g_main_context_iteration(NULL, true));
364 g_assert(!g_main_context_iteration(NULL, false));
367 static void test_source_flush(void)
369 g_assert(!g_main_context_iteration(NULL, false));
370 aio_notify(ctx);
371 while (g_main_context_iteration(NULL, false));
372 g_assert(!g_main_context_iteration(NULL, false));
375 static void test_source_bh_schedule(void)
377 BHTestData data = { .n = 0 };
378 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
380 qemu_bh_schedule(data.bh);
381 g_assert_cmpint(data.n, ==, 0);
383 g_assert(g_main_context_iteration(NULL, true));
384 g_assert_cmpint(data.n, ==, 1);
386 g_assert(!g_main_context_iteration(NULL, false));
387 g_assert_cmpint(data.n, ==, 1);
388 qemu_bh_delete(data.bh);
391 static void test_source_bh_schedule10(void)
393 BHTestData data = { .n = 0, .max = 10 };
394 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
396 qemu_bh_schedule(data.bh);
397 g_assert_cmpint(data.n, ==, 0);
399 g_assert(g_main_context_iteration(NULL, false));
400 g_assert_cmpint(data.n, ==, 1);
402 g_assert(g_main_context_iteration(NULL, true));
403 g_assert_cmpint(data.n, ==, 2);
405 while (g_main_context_iteration(NULL, false));
406 g_assert_cmpint(data.n, ==, 10);
408 g_assert(!g_main_context_iteration(NULL, false));
409 g_assert_cmpint(data.n, ==, 10);
410 qemu_bh_delete(data.bh);
413 static void test_source_bh_cancel(void)
415 BHTestData data = { .n = 0 };
416 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
418 qemu_bh_schedule(data.bh);
419 g_assert_cmpint(data.n, ==, 0);
421 qemu_bh_cancel(data.bh);
422 g_assert_cmpint(data.n, ==, 0);
424 while (g_main_context_iteration(NULL, false));
425 g_assert_cmpint(data.n, ==, 0);
426 qemu_bh_delete(data.bh);
429 static void test_source_bh_delete(void)
431 BHTestData data = { .n = 0 };
432 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
434 qemu_bh_schedule(data.bh);
435 g_assert_cmpint(data.n, ==, 0);
437 qemu_bh_delete(data.bh);
438 g_assert_cmpint(data.n, ==, 0);
440 while (g_main_context_iteration(NULL, false));
441 g_assert_cmpint(data.n, ==, 0);
444 static void test_source_bh_delete_from_cb(void)
446 BHTestData data1 = { .n = 0, .max = 1 };
448 data1.bh = aio_bh_new(ctx, bh_delete_cb, &data1);
450 qemu_bh_schedule(data1.bh);
451 g_assert_cmpint(data1.n, ==, 0);
453 g_main_context_iteration(NULL, true);
454 g_assert_cmpint(data1.n, ==, data1.max);
455 g_assert(data1.bh == NULL);
457 g_assert(!g_main_context_iteration(NULL, false));
460 static void test_source_bh_delete_from_cb_many(void)
462 BHTestData data1 = { .n = 0, .max = 1 };
463 BHTestData data2 = { .n = 0, .max = 3 };
464 BHTestData data3 = { .n = 0, .max = 2 };
465 BHTestData data4 = { .n = 0, .max = 4 };
467 data1.bh = aio_bh_new(ctx, bh_delete_cb, &data1);
468 data2.bh = aio_bh_new(ctx, bh_delete_cb, &data2);
469 data3.bh = aio_bh_new(ctx, bh_delete_cb, &data3);
470 data4.bh = aio_bh_new(ctx, bh_delete_cb, &data4);
472 qemu_bh_schedule(data1.bh);
473 qemu_bh_schedule(data2.bh);
474 qemu_bh_schedule(data3.bh);
475 qemu_bh_schedule(data4.bh);
476 g_assert_cmpint(data1.n, ==, 0);
477 g_assert_cmpint(data2.n, ==, 0);
478 g_assert_cmpint(data3.n, ==, 0);
479 g_assert_cmpint(data4.n, ==, 0);
481 g_assert(g_main_context_iteration(NULL, false));
482 g_assert_cmpint(data1.n, ==, 1);
483 g_assert_cmpint(data2.n, ==, 1);
484 g_assert_cmpint(data3.n, ==, 1);
485 g_assert_cmpint(data4.n, ==, 1);
486 g_assert(data1.bh == NULL);
488 while (g_main_context_iteration(NULL, false));
489 g_assert_cmpint(data1.n, ==, data1.max);
490 g_assert_cmpint(data2.n, ==, data2.max);
491 g_assert_cmpint(data3.n, ==, data3.max);
492 g_assert_cmpint(data4.n, ==, data4.max);
493 g_assert(data1.bh == NULL);
494 g_assert(data2.bh == NULL);
495 g_assert(data3.bh == NULL);
496 g_assert(data4.bh == NULL);
499 static void test_source_bh_flush(void)
501 BHTestData data = { .n = 0 };
502 data.bh = aio_bh_new(ctx, bh_test_cb, &data);
504 qemu_bh_schedule(data.bh);
505 g_assert_cmpint(data.n, ==, 0);
507 g_assert(g_main_context_iteration(NULL, true));
508 g_assert_cmpint(data.n, ==, 1);
510 g_assert(!g_main_context_iteration(NULL, false));
511 g_assert_cmpint(data.n, ==, 1);
512 qemu_bh_delete(data.bh);
515 static void test_source_set_event_notifier(void)
517 EventNotifierTestData data = { .n = 0, .active = 0 };
518 event_notifier_init(&data.e, false);
519 aio_set_event_notifier(ctx, &data.e, event_ready_cb);
520 while (g_main_context_iteration(NULL, false));
521 g_assert_cmpint(data.n, ==, 0);
523 aio_set_event_notifier(ctx, &data.e, NULL);
524 while (g_main_context_iteration(NULL, false));
525 g_assert_cmpint(data.n, ==, 0);
526 event_notifier_cleanup(&data.e);
529 static void test_source_wait_event_notifier(void)
531 EventNotifierTestData data = { .n = 0, .active = 1 };
532 event_notifier_init(&data.e, false);
533 aio_set_event_notifier(ctx, &data.e, event_ready_cb);
534 g_assert(g_main_context_iteration(NULL, false));
535 g_assert_cmpint(data.n, ==, 0);
536 g_assert_cmpint(data.active, ==, 1);
538 event_notifier_set(&data.e);
539 g_assert(g_main_context_iteration(NULL, false));
540 g_assert_cmpint(data.n, ==, 1);
541 g_assert_cmpint(data.active, ==, 0);
543 while (g_main_context_iteration(NULL, false));
544 g_assert_cmpint(data.n, ==, 1);
545 g_assert_cmpint(data.active, ==, 0);
547 aio_set_event_notifier(ctx, &data.e, NULL);
548 while (g_main_context_iteration(NULL, false));
549 g_assert_cmpint(data.n, ==, 1);
551 event_notifier_cleanup(&data.e);
554 static void test_source_flush_event_notifier(void)
556 EventNotifierTestData data = { .n = 0, .active = 10, .auto_set = true };
557 event_notifier_init(&data.e, false);
558 aio_set_event_notifier(ctx, &data.e, event_ready_cb);
559 g_assert(g_main_context_iteration(NULL, false));
560 g_assert_cmpint(data.n, ==, 0);
561 g_assert_cmpint(data.active, ==, 10);
563 event_notifier_set(&data.e);
564 g_assert(g_main_context_iteration(NULL, false));
565 g_assert_cmpint(data.n, ==, 1);
566 g_assert_cmpint(data.active, ==, 9);
567 g_assert(g_main_context_iteration(NULL, false));
569 while (g_main_context_iteration(NULL, false));
570 g_assert_cmpint(data.n, ==, 10);
571 g_assert_cmpint(data.active, ==, 0);
572 g_assert(!g_main_context_iteration(NULL, false));
574 aio_set_event_notifier(ctx, &data.e, NULL);
575 while (g_main_context_iteration(NULL, false));
576 event_notifier_cleanup(&data.e);
579 static void test_source_wait_event_notifier_noflush(void)
581 EventNotifierTestData data = { .n = 0 };
582 EventNotifierTestData dummy = { .n = 0, .active = 1 };
584 event_notifier_init(&data.e, false);
585 aio_set_event_notifier(ctx, &data.e, event_ready_cb);
587 while (g_main_context_iteration(NULL, false));
588 g_assert_cmpint(data.n, ==, 0);
590 /* Until there is an active descriptor, glib may or may not call
591 * event_ready_cb. Still, it must not block. */
592 event_notifier_set(&data.e);
593 g_main_context_iteration(NULL, true);
594 data.n = 0;
596 /* An active event notifier forces aio_poll to look at EventNotifiers. */
597 event_notifier_init(&dummy.e, false);
598 aio_set_event_notifier(ctx, &dummy.e, event_ready_cb);
600 event_notifier_set(&data.e);
601 g_assert(g_main_context_iteration(NULL, false));
602 g_assert_cmpint(data.n, ==, 1);
603 g_assert(!g_main_context_iteration(NULL, false));
604 g_assert_cmpint(data.n, ==, 1);
606 event_notifier_set(&data.e);
607 g_assert(g_main_context_iteration(NULL, false));
608 g_assert_cmpint(data.n, ==, 2);
609 g_assert(!g_main_context_iteration(NULL, false));
610 g_assert_cmpint(data.n, ==, 2);
612 event_notifier_set(&dummy.e);
613 while (g_main_context_iteration(NULL, false));
614 g_assert_cmpint(data.n, ==, 2);
615 g_assert_cmpint(dummy.n, ==, 1);
616 g_assert_cmpint(dummy.active, ==, 0);
618 aio_set_event_notifier(ctx, &dummy.e, NULL);
619 event_notifier_cleanup(&dummy.e);
621 aio_set_event_notifier(ctx, &data.e, NULL);
622 while (g_main_context_iteration(NULL, false));
623 g_assert_cmpint(data.n, ==, 2);
625 event_notifier_cleanup(&data.e);
628 /* End of tests. */
630 int main(int argc, char **argv)
632 GSource *src;
634 init_clocks();
636 ctx = aio_context_new();
637 src = aio_get_g_source(ctx);
638 g_source_attach(src, NULL);
639 g_source_unref(src);
641 while (g_main_context_iteration(NULL, false));
643 g_test_init(&argc, &argv, NULL);
644 g_test_add_func("/aio/notify", test_notify);
645 g_test_add_func("/aio/bh/schedule", test_bh_schedule);
646 g_test_add_func("/aio/bh/schedule10", test_bh_schedule10);
647 g_test_add_func("/aio/bh/cancel", test_bh_cancel);
648 g_test_add_func("/aio/bh/delete", test_bh_delete);
649 g_test_add_func("/aio/bh/callback-delete/one", test_bh_delete_from_cb);
650 g_test_add_func("/aio/bh/callback-delete/many", test_bh_delete_from_cb_many);
651 g_test_add_func("/aio/bh/flush", test_bh_flush);
652 g_test_add_func("/aio/event/add-remove", test_set_event_notifier);
653 g_test_add_func("/aio/event/wait", test_wait_event_notifier);
654 g_test_add_func("/aio/event/wait/no-flush-cb", test_wait_event_notifier_noflush);
655 g_test_add_func("/aio/event/flush", test_flush_event_notifier);
657 g_test_add_func("/aio-gsource/notify", test_source_notify);
658 g_test_add_func("/aio-gsource/flush", test_source_flush);
659 g_test_add_func("/aio-gsource/bh/schedule", test_source_bh_schedule);
660 g_test_add_func("/aio-gsource/bh/schedule10", test_source_bh_schedule10);
661 g_test_add_func("/aio-gsource/bh/cancel", test_source_bh_cancel);
662 g_test_add_func("/aio-gsource/bh/delete", test_source_bh_delete);
663 g_test_add_func("/aio-gsource/bh/callback-delete/one", test_source_bh_delete_from_cb);
664 g_test_add_func("/aio-gsource/bh/callback-delete/many", test_source_bh_delete_from_cb_many);
665 g_test_add_func("/aio-gsource/bh/flush", test_source_bh_flush);
666 g_test_add_func("/aio-gsource/event/add-remove", test_source_set_event_notifier);
667 g_test_add_func("/aio-gsource/event/wait", test_source_wait_event_notifier);
668 g_test_add_func("/aio-gsource/event/wait/no-flush-cb", test_source_wait_event_notifier_noflush);
669 g_test_add_func("/aio-gsource/event/flush", test_source_flush_event_notifier);
670 return g_test_run();