~ubuntu-branches/ubuntu/trusty/serf/trusty-security

« back to all changes in this revision

Viewing changes to test/test_context.c

  • Committer: Bazaar Package Importer
  • Author(s): Peter Samuelson
  • Date: 2011-06-27 18:09:28 UTC
  • mfrom: (1.2.5 upstream)
  • mto: (3.3.1 sid)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20110627180928-ybwzd3hmx82nu3ir
Tags: 1.0.0~0+svn1514-1
* New upstream snapshot.
  - patches/abi-0.x: Remove as obsolete.
  - patches/kqueue: Forward-port.
  - Bump ABI: libserf0.7{,-dbg} -> libserf1{,-dbg}
  - patches/ip6-localhost: New patch: temporary (I hope) workaround for
    IPv4 / IPv6 confusion in testsuite.
* Implement Multi-Arch: same.
* libserf-dev Conflicts: libserf-0-0-dev, not Breaks.  Thanks, lintian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include "serf.h"
24
24
 
25
25
#include "test_serf.h"
 
26
#include "server/test_server.h"
26
27
 
27
28
typedef struct {
28
29
    serf_response_acceptor_t acceptor;
39
40
    const char *path;
40
41
    int done;
41
42
 
42
 
    const char *server_root;
43
 
    int use_proxy;
44
 
 
45
43
    test_baton_t *tb;
46
44
} handler_baton_t;
47
45
 
146
144
    apr_array_header_t *accepted_requests, *handled_requests, *sent_requests;
147
145
    int i;
148
146
    test_server_message_t message_list[] = {
149
 
        {"GET / HTTP/1.1" CRLF
150
 
         "Transfer-Encoding: chunked" CRLF
151
 
         CRLF
152
 
         "1" CRLF
153
 
         "1" CRLF
154
 
         "0" CRLF
155
 
         CRLF},
156
 
        {"GET / HTTP/1.1" CRLF
157
 
         "Transfer-Encoding: chunked" CRLF
158
 
         "" CRLF
159
 
         "1" CRLF
160
 
         "2" CRLF
161
 
         "0" CRLF
162
 
         CRLF}
 
147
        {CHUNKED_REQUEST(1, "1")},
 
148
        {CHUNKED_REQUEST(1, "2")},
163
149
    };
164
150
 
165
151
    test_server_action_t action_list[] = {
166
 
        {SERVER_RESPOND,
167
 
         "HTTP/1.1 200 OK" CRLF
168
 
         "Transfer-Encoding: chunked" CRLF
169
 
         CRLF
170
 
         "0" CRLF
171
 
         CRLF},
172
 
        {SERVER_RESPOND,
173
 
         "HTTP/1.1 200 OK" CRLF
174
 
         "Transfer-Encoding: chunked" CRLF
175
 
         CRLF
176
 
         "0" CRLF
177
 
         CRLF}
 
152
        {SERVER_RESPOND, CHUNKED_EMPTY_RESPONSE},
 
153
        {SERVER_RESPOND, CHUNKED_EMPTY_RESPONSE},
178
154
    };
 
155
    apr_pool_t *test_pool = test_setup();
179
156
 
180
157
    accepted_requests = apr_array_make(test_pool, 2, sizeof(int));
181
158
    sent_requests = apr_array_make(test_pool, 2, sizeof(int));
182
159
    handled_requests = apr_array_make(test_pool, 2, sizeof(int));
183
160
 
184
161
    /* Set up a test context with a server */
185
 
    status = test_server_create(&tb,
186
 
                                message_list, 2,
187
 
                                action_list, 2, 0, NULL, NULL, NULL,
188
 
                                test_pool);
 
162
    status = test_server_setup(&tb,
 
163
                               message_list, 2,
 
164
                               action_list, 2, 0, NULL,
 
165
                               test_pool);
189
166
    CuAssertIntEquals(tc, APR_SUCCESS, status);
190
167
 
191
168
    handler_ctx.method = "GET";
199
176
    handler_ctx.accepted_requests = accepted_requests;
200
177
    handler_ctx.sent_requests = sent_requests;
201
178
    handler_ctx.handled_requests = handled_requests;
202
 
    handler_ctx.use_proxy = FALSE;
203
 
    handler_ctx.server_root = NULL;
204
179
 
205
180
    request1 = serf_connection_request_create(tb->connection,
206
181
                                              setup_request,
219
194
    {
220
195
        apr_pool_clear(iter_pool);
221
196
 
222
 
        status = test_server_run(tb, 0, iter_pool);
 
197
        status = test_server_run(tb->serv_ctx, 0, iter_pool);
223
198
        if (APR_STATUS_IS_TIMEUP(status))
224
199
            status = APR_SUCCESS;
225
200
        CuAssertIntEquals(tc, APR_SUCCESS, status);
228
203
        if (APR_STATUS_IS_TIMEUP(status))
229
204
            status = APR_SUCCESS;
230
205
        CuAssertIntEquals(tc, APR_SUCCESS, status);
231
 
 
232
 
        /* Debugging purposes only! */
233
 
        serf_debug__closed_conn(tb->bkt_alloc);
234
206
    }
235
207
    apr_pool_destroy(iter_pool);
236
208
 
251
223
        CuAssertIntEquals(tc, i + 1, req_nr);
252
224
    }
253
225
 
254
 
    test_server_destroy(tb, test_pool);
 
226
    test_server_teardown(tb, test_pool);
 
227
    test_teardown(test_pool);
255
228
}
256
229
 
257
230
/* Validate that priority requests are sent and completed before normal
267
240
    int i;
268
241
 
269
242
    test_server_message_t message_list[] = {
270
 
        {CHUNCKED_REQUEST(1, "1")},
271
 
        {CHUNCKED_REQUEST(1, "2")},
272
 
        {CHUNCKED_REQUEST(1, "3")},
 
243
        {CHUNKED_REQUEST(1, "1")},
 
244
        {CHUNKED_REQUEST(1, "2")},
 
245
        {CHUNKED_REQUEST(1, "3")},
273
246
    };
274
247
 
275
248
    test_server_action_t action_list[] = {
278
251
        {SERVER_RESPOND, CHUNKED_EMPTY_RESPONSE},
279
252
    };
280
253
 
 
254
    apr_pool_t *test_pool = test_setup();
 
255
 
281
256
    accepted_requests = apr_array_make(test_pool, 3, sizeof(int));
282
257
    sent_requests = apr_array_make(test_pool, 3, sizeof(int));
283
258
    handled_requests = apr_array_make(test_pool, 3, sizeof(int));
284
259
 
285
260
    /* Set up a test context with a server */
286
 
    status = test_server_create(&tb,
287
 
                                message_list, 3,
288
 
                                action_list, 3, 0, NULL, NULL, NULL,
289
 
                                test_pool);
 
261
    status = test_server_setup(&tb,
 
262
                               message_list, 3,
 
263
                               action_list, 3, 0, NULL,
 
264
                               test_pool);
290
265
    CuAssertIntEquals(tc, APR_SUCCESS, status);
291
266
 
292
267
    handler_ctx.method = "GET";
300
275
    handler_ctx.accepted_requests = accepted_requests;
301
276
    handler_ctx.sent_requests = sent_requests;
302
277
    handler_ctx.handled_requests = handled_requests;
303
 
    handler_ctx.use_proxy = FALSE;
304
 
    handler_ctx.server_root = NULL;
305
278
 
306
279
    request1 = serf_connection_request_create(tb->connection,
307
280
                                              setup_request,
326
299
    {
327
300
        apr_pool_clear(iter_pool);
328
301
 
329
 
        status = test_server_run(tb, 0, iter_pool);
 
302
        status = test_server_run(tb->serv_ctx, 0, iter_pool);
330
303
        if (APR_STATUS_IS_TIMEUP(status))
331
304
            status = APR_SUCCESS;
332
305
        CuAssertIntEquals(tc, APR_SUCCESS, status);
358
331
        CuAssertIntEquals(tc, i + 1, req_nr);
359
332
    }
360
333
 
361
 
    test_server_destroy(tb, test_pool);
 
334
    test_server_teardown(tb, test_pool);
 
335
    test_teardown(test_pool);
362
336
}
363
337
 
364
338
/* Test that serf correctly handles the 'Connection:close' header when the
373
347
    int done = FALSE, i;
374
348
 
375
349
    test_server_message_t message_list[] = {
376
 
        {CHUNCKED_REQUEST(1, "1")},
377
 
        {CHUNCKED_REQUEST(1, "2")},
378
 
        {CHUNCKED_REQUEST(1, "3")},
379
 
        {CHUNCKED_REQUEST(1, "4")},
380
 
        {CHUNCKED_REQUEST(1, "5")},
381
 
        {CHUNCKED_REQUEST(1, "6")},
382
 
        {CHUNCKED_REQUEST(1, "7")},
383
 
        {CHUNCKED_REQUEST(1, "8")},
384
 
        {CHUNCKED_REQUEST(1, "9")},
385
 
        {CHUNCKED_REQUEST(2, "10")}
 
350
        {CHUNKED_REQUEST(1, "1")},
 
351
        {CHUNKED_REQUEST(1, "2")},
 
352
        {CHUNKED_REQUEST(1, "3")},
 
353
        {CHUNKED_REQUEST(1, "4")},
 
354
        {CHUNKED_REQUEST(1, "5")},
 
355
        {CHUNKED_REQUEST(1, "6")},
 
356
        {CHUNKED_REQUEST(1, "7")},
 
357
        {CHUNKED_REQUEST(1, "8")},
 
358
        {CHUNKED_REQUEST(1, "9")},
 
359
        {CHUNKED_REQUEST(2, "10")}
386
360
        };
387
361
 
388
362
    test_server_action_t action_list[] = {
414
388
        {SERVER_RESPOND, CHUNKED_EMPTY_RESPONSE},
415
389
    };
416
390
 
 
391
    apr_pool_t *test_pool = test_setup();
 
392
 
417
393
    accepted_requests = apr_array_make(test_pool, NUM_REQUESTS, sizeof(int));
418
394
    sent_requests = apr_array_make(test_pool, NUM_REQUESTS, sizeof(int));
419
395
    handled_requests = apr_array_make(test_pool, NUM_REQUESTS, sizeof(int));
420
396
 
421
397
    /* Set up a test context with a server. */
422
 
    status = test_server_create(&tb,
423
 
                                message_list, 10,
424
 
                                action_list, 12,
425
 
                                0,
426
 
                                NULL, NULL, NULL,
427
 
                                test_pool);
 
398
    status = test_server_setup(&tb,
 
399
                               message_list, 10,
 
400
                               action_list, 12,
 
401
                               0,
 
402
                               NULL,
 
403
                               test_pool);
428
404
    CuAssertIntEquals(tc, APR_SUCCESS, status);
429
405
 
430
406
    for (i = 0 ; i < NUM_REQUESTS ; i++) {
441
417
        handler_ctx[i].sent_requests = sent_requests;
442
418
        handler_ctx[i].handled_requests = handled_requests;
443
419
        handler_ctx[i].tb = tb;
444
 
        handler_ctx[i].use_proxy = FALSE;
445
 
        handler_ctx[i].server_root = NULL;
446
420
 
447
421
        serf_connection_request_create(tb->connection,
448
422
                                       setup_request,
450
424
    }
451
425
 
452
426
    while (1) {
453
 
        status = test_server_run(tb, 0, test_pool);
 
427
        status = test_server_run(tb->serv_ctx, 0, test_pool);
454
428
        if (APR_STATUS_IS_TIMEUP(status))
455
429
            status = APR_SUCCESS;
456
430
        CuAssertIntEquals(tc, APR_SUCCESS, status);
479
453
    CuAssertIntEquals(tc, NUM_REQUESTS, handled_requests->nelts);
480
454
 
481
455
    /* Cleanup */
482
 
    test_server_destroy(tb, test_pool);
 
456
    test_server_teardown(tb, test_pool);
 
457
    test_teardown(test_pool);
483
458
}
484
459
#undef NUM_REQUESTS
485
460
 
487
462
   directly. */
488
463
static void test_serf_setup_proxy(CuTest *tc)
489
464
{
490
 
    test_baton_t *tb_server, *tb_proxy;
 
465
    test_baton_t *tb;
491
466
    serf_request_t *request;
492
467
    handler_baton_t handler_ctx;
493
468
    apr_status_t status;
512
487
        {SERVER_RESPOND, CHUNKED_EMPTY_RESPONSE},
513
488
    };
514
489
 
 
490
    apr_pool_t *test_pool = test_setup();
 
491
 
515
492
    accepted_requests = apr_array_make(test_pool, numrequests, sizeof(int));
516
493
    sent_requests = apr_array_make(test_pool, numrequests, sizeof(int));
517
494
    handled_requests = apr_array_make(test_pool, numrequests, sizeof(int));
518
495
 
519
496
    /* Set up a test context with a server, no messages expected. */
520
 
    status = test_server_create(&tb_server,
521
 
                                NULL, 0,
522
 
                                NULL, 0, 0,
523
 
                                "http://localhost:" SERV_PORT_STR, NULL,
524
 
                                NULL, test_pool);
525
 
    CuAssertIntEquals(tc, APR_SUCCESS, status);
526
 
 
527
 
    /* Set up another test context for the proxy server */
528
 
    status = apr_sockaddr_info_get(&proxy_address,
529
 
                                   "localhost", APR_INET, 21212, 0,
530
 
                                   test_pool);
531
 
    CuAssertIntEquals(tc, APR_SUCCESS, status);
532
 
 
533
 
    status = test_server_create(&tb_proxy,
534
 
                                message_list, 1,
535
 
                                action_list_proxy, 1, 0,
536
 
                                NULL, proxy_address, NULL,
537
 
                                test_pool);
538
 
 
 
497
    status = test_server_proxy_setup(&tb,
 
498
                                     /* server messages and actions */
 
499
                                     NULL, 0,
 
500
                                     NULL, 0,
 
501
                                     /* server messages and actions */
 
502
                                     message_list, 1,
 
503
                                     action_list_proxy, 1,
 
504
                                     0,
 
505
                                     NULL, test_pool);
539
506
    CuAssertIntEquals(tc, APR_SUCCESS, status);
540
507
 
541
508
    handler_ctx.method = "GET";
549
516
    handler_ctx.accepted_requests = accepted_requests;
550
517
    handler_ctx.sent_requests = sent_requests;
551
518
    handler_ctx.handled_requests = handled_requests;
552
 
    handler_ctx.use_proxy = TRUE;
553
 
    handler_ctx.server_root = "http://localhost:" SERV_PORT_STR;
554
 
 
555
 
    /* Configure serf to use the proxy server */
556
 
    serf_config_proxy(tb_server->context, proxy_address);
557
 
 
558
 
    request = serf_connection_request_create(tb_server->connection,
 
519
 
 
520
    request = serf_connection_request_create(tb->connection,
559
521
                                             setup_request,
560
522
                                             &handler_ctx);
561
523
 
565
527
    {
566
528
        apr_pool_clear(iter_pool);
567
529
 
568
 
        status = test_server_run(tb_server, 0, iter_pool);
569
 
        if (APR_STATUS_IS_TIMEUP(status))
570
 
            status = APR_SUCCESS;
571
 
        CuAssertIntEquals(tc, APR_SUCCESS, status);
572
 
 
573
 
        status = test_server_run(tb_proxy, 0, iter_pool);
574
 
        if (APR_STATUS_IS_TIMEUP(status))
575
 
            status = APR_SUCCESS;
576
 
        CuAssertIntEquals(tc, APR_SUCCESS, status);
577
 
 
578
 
        status = serf_context_run(tb_server->context, 0, iter_pool);
 
530
        status = test_server_run(tb->serv_ctx, 0, iter_pool);
 
531
        if (APR_STATUS_IS_TIMEUP(status))
 
532
            status = APR_SUCCESS;
 
533
        CuAssertIntEquals(tc, APR_SUCCESS, status);
 
534
 
 
535
        status = test_server_run(tb->proxy_ctx, 0, iter_pool);
 
536
        if (APR_STATUS_IS_TIMEUP(status))
 
537
            status = APR_SUCCESS;
 
538
        CuAssertIntEquals(tc, APR_SUCCESS, status);
 
539
 
 
540
        status = serf_context_run(tb->context, 0, iter_pool);
579
541
        if (APR_STATUS_IS_TIMEUP(status))
580
542
            status = APR_SUCCESS;
581
543
        CuAssertIntEquals(tc, APR_SUCCESS, status);
582
544
 
583
545
        /* Debugging purposes only! */
584
 
        serf_debug__closed_conn(tb_server->bkt_alloc);
 
546
        serf_debug__closed_conn(tb->bkt_alloc);
585
547
    }
586
548
    apr_pool_destroy(iter_pool);
587
549
 
602
564
        CuAssertIntEquals(tc, i + 1, req_nr);
603
565
    }
604
566
 
605
 
    test_server_destroy(tb_server, test_pool);
 
567
    test_server_teardown(tb, test_pool);
 
568
    test_teardown(test_pool);
606
569
}
607
570
 
608
571
/*****************************************************************************
661
624
    int done = FALSE, i;
662
625
 
663
626
    test_server_message_t message_list[] = {
664
 
        {CHUNCKED_REQUEST(1, "1")},
665
 
        {CHUNCKED_REQUEST(1, "1")},
666
 
        {CHUNCKED_REQUEST(1, "1")},
667
 
        {CHUNCKED_REQUEST(1, "2")},
668
 
        {CHUNCKED_REQUEST(1, "3")},
669
 
        {CHUNCKED_REQUEST(1, "4")},
670
 
        {CHUNCKED_REQUEST(1, "5")},
 
627
        {CHUNKED_REQUEST(1, "1")},
 
628
        {CHUNKED_REQUEST(1, "1")},
 
629
        {CHUNKED_REQUEST(1, "1")},
 
630
        {CHUNKED_REQUEST(1, "2")},
 
631
        {CHUNKED_REQUEST(1, "3")},
 
632
        {CHUNKED_REQUEST(1, "4")},
 
633
        {CHUNKED_REQUEST(1, "5")},
671
634
    };
672
635
 
673
636
    test_server_action_t action_list[] = {
680
643
        {SERVER_RESPOND, CHUNKED_EMPTY_RESPONSE},
681
644
    };
682
645
 
 
646
    apr_pool_t *test_pool = test_setup();
 
647
 
683
648
    accepted_requests = apr_array_make(test_pool, RCVD_REQUESTS, sizeof(int));
684
649
    sent_requests = apr_array_make(test_pool, RCVD_REQUESTS, sizeof(int));
685
650
    handled_requests = apr_array_make(test_pool, RCVD_REQUESTS, sizeof(int));
686
651
 
687
652
    /* Set up a test context with a server. */
688
 
    status = test_server_create(&tb,
689
 
                                message_list, 7,
690
 
                                action_list, 7, 0, NULL, NULL, NULL,
691
 
                                test_pool);
 
653
    status = test_server_setup(&tb,
 
654
                               message_list, 7,
 
655
                               action_list, 7, 0, NULL,
 
656
                               test_pool);
692
657
    CuAssertIntEquals(tc, APR_SUCCESS, status);
693
658
 
694
659
    for (i = 0 ; i < SEND_REQUESTS ; i++) {
705
670
        handler_ctx[i].sent_requests = sent_requests;
706
671
        handler_ctx[i].handled_requests = handled_requests;
707
672
        handler_ctx[i].tb = tb;
708
 
        handler_ctx[i].use_proxy = FALSE;
709
 
        handler_ctx[i].server_root = NULL;
710
673
 
711
674
        serf_connection_request_create(tb->connection,
712
675
                                       setup_request,
715
678
    }
716
679
 
717
680
    while (1) {
718
 
        status = test_server_run(tb, 0, test_pool);
 
681
        status = test_server_run(tb->serv_ctx, 0, test_pool);
719
682
        if (APR_STATUS_IS_TIMEUP(status))
720
683
            status = APR_SUCCESS;
721
684
        CuAssertIntEquals(tc, APR_SUCCESS, status);
744
707
    CuAssertIntEquals(tc, RCVD_REQUESTS, handled_requests->nelts);
745
708
 
746
709
    /* Cleanup */
747
 
    test_server_destroy(tb, test_pool);
 
710
    test_server_teardown(tb, test_pool);
 
711
    test_teardown(test_pool);
748
712
}
749
713
#undef SEND_REQUESTS
750
714
#undef RCVD_REQUESTS
814
778
    int done = FALSE, i;
815
779
 
816
780
    test_server_message_t message_list[] = {
817
 
        {CHUNCKED_REQUEST(1, "1")},
818
 
        {CHUNCKED_REQUEST(1, "1")},
819
 
        {CHUNCKED_REQUEST(1, "1")},
820
 
        {CHUNCKED_REQUEST(1, "2")},
821
 
        {CHUNCKED_REQUEST(1, "3")},
822
 
        {CHUNCKED_REQUEST(1, "4")},
823
 
        {CHUNCKED_REQUEST(1, "5")},
 
781
        {CHUNKED_REQUEST(1, "1")},
 
782
        {CHUNKED_REQUEST(1, "1")},
 
783
        {CHUNKED_REQUEST(1, "1")},
 
784
        {CHUNKED_REQUEST(1, "2")},
 
785
        {CHUNKED_REQUEST(1, "3")},
 
786
        {CHUNKED_REQUEST(1, "4")},
 
787
        {CHUNKED_REQUEST(1, "5")},
824
788
    };
825
789
 
826
790
    test_server_action_t action_list[] = {
833
797
        {SERVER_RESPOND, CHUNKED_EMPTY_RESPONSE},
834
798
    };
835
799
 
 
800
    apr_pool_t *test_pool = test_setup();
 
801
 
836
802
    accepted_requests = apr_array_make(test_pool, RCVD_REQUESTS, sizeof(int));
837
803
    sent_requests = apr_array_make(test_pool, RCVD_REQUESTS, sizeof(int));
838
804
    handled_requests = apr_array_make(test_pool, RCVD_REQUESTS, sizeof(int));
839
805
 
840
806
    /* Set up a test context with a server. */
841
 
    status = test_server_create(&tb,
842
 
                                message_list, 7,
843
 
                                action_list, 7, 0, NULL, NULL, NULL, 
844
 
                                test_pool);
 
807
    status = test_server_setup(&tb,
 
808
                               message_list, 7,
 
809
                               action_list, 7, 0, NULL,
 
810
                               test_pool);
845
811
    CuAssertIntEquals(tc, APR_SUCCESS, status);
846
812
 
847
813
    for (i = 0 ; i < SEND_REQUESTS ; i++) {
858
824
        handler_ctx[i].sent_requests = sent_requests;
859
825
        handler_ctx[i].handled_requests = handled_requests;
860
826
        handler_ctx[i].tb = tb;
861
 
        handler_ctx[i].use_proxy = FALSE;
862
 
        handler_ctx[i].server_root = NULL;
863
827
 
864
828
        serf_connection_request_create(tb->connection,
865
829
                                       setup_request,
868
832
    }
869
833
 
870
834
    while (1) {
871
 
        status = test_server_run(tb, 0, test_pool);
 
835
        status = test_server_run(tb->serv_ctx, 0, test_pool);
872
836
        if (APR_STATUS_IS_TIMEUP(status))
873
837
            status = APR_SUCCESS;
874
838
        CuAssertIntEquals(tc, APR_SUCCESS, status);
897
861
    CuAssertIntEquals(tc, RCVD_REQUESTS, handled_requests->nelts);
898
862
 
899
863
    /* Cleanup */
900
 
    test_server_destroy(tb, test_pool);
 
864
    test_server_teardown(tb, test_pool);
 
865
    test_teardown(test_pool);
901
866
}
902
867
#undef SEND_REQUESTS
903
868
#undef RCVD_REQUESTS
939
904
    progress_baton_t *pb;
940
905
 
941
906
    test_server_message_t message_list[] = {
942
 
        {CHUNCKED_REQUEST(1, "1")},
943
 
        {CHUNCKED_REQUEST(1, "2")},
944
 
        {CHUNCKED_REQUEST(1, "3")},
945
 
        {CHUNCKED_REQUEST(1, "4")},
946
 
        {CHUNCKED_REQUEST(1, "5")},
 
907
        {CHUNKED_REQUEST(1, "1")},
 
908
        {CHUNKED_REQUEST(1, "2")},
 
909
        {CHUNKED_REQUEST(1, "3")},
 
910
        {CHUNKED_REQUEST(1, "4")},
 
911
        {CHUNKED_REQUEST(1, "5")},
947
912
    };
948
913
 
949
914
    test_server_action_t action_list[] = {
954
919
        {SERVER_RESPOND, CHUNKED_EMPTY_RESPONSE},
955
920
    };
956
921
 
 
922
    apr_pool_t *test_pool = test_setup();
 
923
 
957
924
    accepted_requests = apr_array_make(test_pool, NUM_REQUESTS, sizeof(int));
958
925
    sent_requests = apr_array_make(test_pool, NUM_REQUESTS, sizeof(int));
959
926
    handled_requests = apr_array_make(test_pool, NUM_REQUESTS, sizeof(int));
960
927
 
961
928
    /* Set up a test context with a server. */
962
 
    status = test_server_create(&tb,
963
 
                                message_list, 5,
964
 
                                action_list, 5, 0, NULL, NULL, 
965
 
                                progress_conn_setup, test_pool);
 
929
    status = test_server_setup(&tb,
 
930
                               message_list, 5,
 
931
                               action_list, 5, 0,
 
932
                               progress_conn_setup, test_pool);
966
933
    CuAssertIntEquals(tc, APR_SUCCESS, status);
967
934
 
968
935
    /* Set up the progress callback. */
984
951
        handler_ctx[i].sent_requests = sent_requests;
985
952
        handler_ctx[i].handled_requests = handled_requests;
986
953
        handler_ctx[i].tb = tb;
987
 
        handler_ctx[i].use_proxy = FALSE;
988
 
        handler_ctx[i].server_root = NULL;
989
954
 
990
955
        serf_connection_request_create(tb->connection,
991
956
                                       setup_request,
993
958
    }
994
959
 
995
960
    while (1) {
996
 
        status = test_server_run(tb, 0, test_pool);
 
961
        status = test_server_run(tb->serv_ctx, 0, test_pool);
997
962
        if (APR_STATUS_IS_TIMEUP(status))
998
963
            status = APR_SUCCESS;
999
964
        CuAssertIntEquals(tc, APR_SUCCESS, status);
1026
991
    CuAssertTrue(tc, pb->read > 0);
1027
992
 
1028
993
    /* Cleanup */
1029
 
    test_server_destroy(tb, test_pool);
 
994
    test_server_teardown(tb, test_pool);
 
995
    test_teardown(test_pool);
1030
996
}
1031
997
#undef NUM_REQUESTS
1032
998