From a7401bf72db3a6eb62b1628f9dd141f7118e3510 Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Mon, 24 Jun 2013 13:18:17 +0200 Subject: dyndns timeout test: catch SIGCHLD handler events https://fedorahosted.org/sssd/ticket/1992 dyndns test will crash with this patch --- src/tests/cmocka/test_dyndns.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/tests/cmocka') diff --git a/src/tests/cmocka/test_dyndns.c b/src/tests/cmocka/test_dyndns.c index f804d7926..f819dc9a1 100644 --- a/src/tests/cmocka/test_dyndns.c +++ b/src/tests/cmocka/test_dyndns.c @@ -279,6 +279,18 @@ void dyndns_test_timeout(void **state) /* Wait until the test finishes with EIO (child error) */ ret = test_ev_loop(dyndns_test_ctx->tctx); + + /* The event queue may not be empty. We need to make sure that all events + * are processed. Unfortunately, tevent_loop_wait() contains a bug that + * prevents exiting the loop even if there are no remaining events, thus + * we have to use tevent_loop_once(). + * + * FIXME: use tevent_loop_wait() when the bug is fixed + * https://bugzilla.samba.org/show_bug.cgi?id=10012 + */ + tevent_loop_once(dyndns_test_ctx->tctx->ev); /* SIGCHLD handler */ + tevent_loop_once(dyndns_test_ctx->tctx->ev); /* nsupdate_child_handler */ + DEBUG(SSSDBG_TRACE_LIBS, ("Child request returned [%d]: %s\n", ret, strerror(ret))); assert_int_equal(ret, ERR_DYNDNS_TIMEOUT); -- cgit