Lines Matching refs:test_ctx
131 struct test_krb5_wait_queue *test_ctx;
133 test_ctx = talloc_zero(global_talloc_context,
135 assert_non_null(test_ctx);
137 test_ctx->tctx = create_ev_test_ctx(test_ctx);
138 assert_non_null(test_ctx);
140 test_ctx->be_ctx = mock_be_ctx(test_ctx, test_ctx->tctx);
141 assert_non_null(test_ctx->be_ctx);
143 test_ctx->pd = talloc_zero(test_ctx, struct pam_data);
144 assert_non_null(test_ctx->pd);
146 test_ctx->krb5_ctx = talloc_zero(test_ctx, struct krb5_ctx);
147 assert_non_null(test_ctx->krb5_ctx);
149 *state = test_ctx;
155 struct test_krb5_wait_queue *test_ctx =
158 talloc_free(test_ctx);
162 static void test_krb5_wait_mock(struct test_krb5_wait_queue *test_ctx,
169 test_ctx->pd->user = discard_const(username);
178 static void test_krb5_wait_mock_success(struct test_krb5_wait_queue *test_ctx,
181 return test_krb5_wait_mock(test_ctx, username, 200, 0, 0, 0);
190 struct test_krb5_wait_queue *test_ctx =
193 test_krb5_wait_mock_success(test_ctx, "krb5_user");
195 req = krb5_auth_queue_send(test_ctx,
196 test_ctx->tctx->ev,
197 test_ctx->be_ctx,
198 test_ctx->pd,
199 test_ctx->krb5_ctx);
201 tevent_req_set_callback(req, test_krb5_wait_queue_single_done, test_ctx);
203 ret = test_ev_loop(test_ctx->tctx);
209 struct test_krb5_wait_queue *test_ctx = \
219 test_ev_done(test_ctx->tctx, EOK);
229 struct test_krb5_wait_queue *test_ctx =
232 test_ctx->num_auths = 1000;
234 for (i=0; i < test_ctx->num_auths; i++) {
235 test_krb5_wait_mock_success(test_ctx, "krb5_user");
237 req = krb5_auth_queue_send(test_ctx,
238 test_ctx->tctx->ev,
239 test_ctx->be_ctx,
240 test_ctx->pd,
241 test_ctx->krb5_ctx);
243 tevent_req_set_callback(req, test_krb5_wait_queue_multi_done, test_ctx);
246 ret = test_ev_loop(test_ctx->tctx);
252 struct test_krb5_wait_queue *test_ctx = \
262 test_ctx->num_finished_auths++;
264 if (test_ctx->num_finished_auths == test_ctx->num_auths) {
265 test_ev_done(test_ctx->tctx, EOK);
276 struct test_krb5_wait_queue *test_ctx =
279 test_ctx->num_auths = 10;
281 for (i=0; i < test_ctx->num_auths; i++) {
282 test_krb5_wait_mock(test_ctx, "krb5_user", 0, i+1 % 2, PAM_SUCCESS, 0);
284 req = krb5_auth_queue_send(test_ctx,
285 test_ctx->tctx->ev,
286 test_ctx->be_ctx,
287 test_ctx->pd,
288 test_ctx->krb5_ctx);
290 tevent_req_set_callback(req, test_krb5_wait_queue_fail_odd_done, test_ctx);
293 ret = test_ev_loop(test_ctx->tctx);
299 struct test_krb5_wait_queue *test_ctx = \
307 assert_int_equal(ret, test_ctx->num_finished_auths+1 % 2);
309 test_ctx->num_finished_auths++;
311 if (test_ctx->num_finished_auths == test_ctx->num_auths) {
312 test_ev_done(test_ctx->tctx, EOK);