Lines Matching refs:test_ctx

63     struct resolv_test_ctx *test_ctx;
66 test_ctx = talloc_zero(global_talloc_context, struct resolv_test_ctx);
67 if (test_ctx == NULL) {
72 test_ctx->ev = tevent_context_init(test_ctx);
73 if (test_ctx->ev == NULL) {
75 talloc_free(test_ctx);
79 ret = resolv_init(test_ctx, test_ctx->ev, timeout, &test_ctx->resolv);
82 talloc_free(test_ctx);
86 *ctx = test_ctx;
267 struct resolv_test_ctx *test_ctx = tevent_req_callback_data(req,
270 test_ctx->done = true;
272 recv_status = resolv_gethostbyname_recv(req, test_ctx,
278 test_ctx->error = recv_status;
283 test_ctx->error = ENOENT;
291 test_ctx->error = EOK;
299 struct resolv_test_ctx *test_ctx;
304 ret = setup_resolv_test(RESOLV_DEFAULT_TIMEOUT, &test_ctx);
310 ck_leaks_push(test_ctx);
311 req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
312 test_ctx->resolv, hostname, IPV4_ONLY,
320 tevent_req_set_callback(req, test_ip_addr, test_ctx);
321 ret = test_loop(test_ctx);
324 ck_leaks_pop(test_ctx);
327 talloc_zfree(test_ctx);
337 struct resolv_test_ctx *test_ctx = tevent_req_callback_data(req,
340 test_ctx->done = true;
342 recv_status = resolv_gethostbyname_recv(req, test_ctx,
348 test_ctx->error = recv_status;
353 test_ctx->error = ENOENT;
361 test_ctx->error = EOK;
369 struct resolv_test_ctx *test_ctx;
374 ret = setup_resolv_test(RESOLV_DEFAULT_TIMEOUT, &test_ctx);
380 ck_leaks_push(test_ctx);
381 req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
382 test_ctx->resolv, hostname, IPV4_FIRST,
390 tevent_req_set_callback(req, test_localhost, test_ctx);
391 ret = test_loop(test_ctx);
394 ck_leaks_pop(test_ctx);
397 talloc_zfree(test_ctx);
406 struct resolv_test_ctx *test_ctx;
408 test_ctx = tevent_req_callback_data(req, struct resolv_test_ctx);
409 test_ctx->done = true;
411 recv_status = resolv_gethostbyname_recv(req, test_ctx,
420 test_ctx->error = status;
430 struct resolv_test_ctx *test_ctx;
432 ret = setup_resolv_test(RESOLV_DEFAULT_TIMEOUT, &test_ctx);
438 ck_leaks_push(test_ctx);
439 req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
440 test_ctx->resolv, hostname, IPV4_FIRST,
448 tevent_req_set_callback(req, test_negative, test_ctx);
449 ret = test_loop(test_ctx);
452 ck_leaks_pop(test_ctx);
455 fail_unless(test_ctx->error == ARES_ENOTFOUND);
456 talloc_zfree(test_ctx);
464 struct resolv_test_ctx *test_ctx;
471 test_ctx = tevent_req_callback_data(req, struct resolv_test_ctx);
473 test_ctx->done = true;
475 tmp_ctx = talloc_new(test_ctx);
478 switch (test_ctx->tested_function) {
482 test_ctx->error = (rhostent->name == NULL) ? ENOENT : EOK;
483 if (test_ctx->error == EOK) {
497 test_ctx->error = (txt_replies == NULL) ? ENOENT : EOK;
505 test_ctx->error = (srv_replies == NULL) ? ENOENT : EOK;
536 struct resolv_test_ctx *test_ctx;
538 ret = setup_resolv_test(RESOLV_DEFAULT_TIMEOUT, &test_ctx);
543 test_ctx->tested_function = TESTING_HOSTNAME;
545 ck_leaks_push(test_ctx);
546 req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
547 test_ctx->resolv, hostname, IPV4_FIRST,
555 tevent_req_set_callback(req, test_internet, test_ctx);
556 ret = test_loop(test_ctx);
560 ck_leaks_pop(test_ctx);
561 talloc_zfree(test_ctx);
569 struct resolv_test_ctx *test_ctx;
571 ret = setup_resolv_test(RESOLV_DEFAULT_TIMEOUT, &test_ctx);
573 test_ctx->tested_function = TESTING_TXT;
575 ck_leaks_push(test_ctx);
577 req = resolv_gettxt_send(test_ctx, test_ctx->ev, test_ctx->resolv, txt_host);
580 tevent_req_set_callback(req, test_internet, test_ctx);
581 ret = test_loop(test_ctx);
584 ck_leaks_pop(test_ctx);
586 talloc_zfree(test_ctx);
594 struct resolv_test_ctx *test_ctx;
596 ret = setup_resolv_test(RESOLV_DEFAULT_TIMEOUT, &test_ctx);
598 test_ctx->tested_function = TESTING_SRV;
600 ck_leaks_push(test_ctx);
602 req = resolv_getsrv_send(test_ctx, test_ctx->ev, test_ctx->resolv, srv_host);
605 tevent_req_set_callback(req, test_internet, test_ctx);
606 ret = test_loop(test_ctx);
609 ck_leaks_pop(test_ctx);
611 talloc_zfree(test_ctx);
641 struct resolv_test_ctx *test_ctx;
645 ret = setup_resolv_test(RESOLV_DEFAULT_TIMEOUT, &test_ctx);
651 req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
652 test_ctx->resolv, hostname, IPV4_FIRST,
666 free_timer = tevent_add_timer(test_ctx->ev, test_ctx, free_tv, resolv_free_context, test_ctx->resolv);
672 terminate_timer = tevent_add_timer(test_ctx->ev, test_ctx, terminate_tv, resolv_free_done, test_ctx);
678 ret = test_loop(test_ctx);
682 talloc_zfree(test_ctx);
701 struct resolv_test_ctx *test_ctx;
705 ret = setup_resolv_test(RESOLV_DEFAULT_TIMEOUT, &test_ctx);
711 ck_leaks_push(test_ctx);
715 r = talloc_zero(test_ctx, struct ares_srv_reply);
750 r = talloc_zero(test_ctx, struct ares_srv_reply);
778 ck_leaks_pop(test_ctx);
779 talloc_zfree(test_ctx);
788 struct resolv_test_ctx *test_ctx;
792 ret = setup_resolv_test(RESOLV_DEFAULT_TIMEOUT, &test_ctx);
798 ck_leaks_push(test_ctx);
802 r = talloc_zero(test_ctx, struct ares_srv_reply);
841 ck_leaks_pop(test_ctx);
842 talloc_zfree(test_ctx);
851 struct resolv_test_ctx *test_ctx;
855 ret = setup_resolv_test(RESOLV_DEFAULT_TIMEOUT, &test_ctx);
861 ck_leaks_push(test_ctx);
862 req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
863 test_ctx->resolv, hostname, IPV4_FIRST,
878 free_timer = tevent_add_timer(test_ctx->ev, test_ctx, free_tv, resolv_free_req, req);
884 terminate_timer = tevent_add_timer(test_ctx->ev, test_ctx, terminate_tv, resolv_free_done, test_ctx);
890 ret = test_loop(test_ctx);
891 ck_leaks_pop(test_ctx);
895 talloc_zfree(test_ctx);
903 struct resolv_test_ctx *test_ctx;
907 test_ctx = tevent_req_callback_data(req, struct resolv_test_ctx);
909 test_ctx->done = true;
911 tmp_ctx = talloc_new(test_ctx);
914 fail_unless(test_ctx->tested_function == TESTING_HOSTNAME);
926 struct resolv_test_ctx *test_ctx;
931 ret = setup_resolv_test(0, &test_ctx);
937 test_ctx->tested_function = TESTING_HOSTNAME;
939 req = resolv_gethostbyname_send(test_ctx, test_ctx->ev,
940 test_ctx->resolv, hostname, IPV4_FIRST,
948 tevent_req_set_callback(req, test_timeout, test_ctx);
949 ret = test_loop(test_ctx);
953 talloc_zfree(test_ctx);