int main(int argc, char* argv[]) { #ifdef __RUN_TESTS return run_test_server(argc,argv); #else // Call your server code here return 0; #endif }
/* Helper function, runs the client and server context loops and validates that no errors were encountered, and all messages were sent and received. */ apr_status_t test_helper_run_requests_no_check(CuTest *tc, test_baton_t *tb, int num_requests, handler_baton_t handler_ctx[], apr_pool_t *pool) { apr_pool_t *iter_pool; int i, done = 0; apr_status_t status; apr_pool_create(&iter_pool, pool); while (!done) { apr_pool_clear(iter_pool); /* run server event loop */ status = run_test_server(tb->serv_ctx, 0, iter_pool); if (!APR_STATUS_IS_TIMEUP(status) && SERF_BUCKET_READ_ERROR(status)) return status; /* run proxy event loop */ if (tb->proxy_ctx) { status = run_test_server(tb->proxy_ctx, 0, iter_pool); if (!APR_STATUS_IS_TIMEUP(status) && SERF_BUCKET_READ_ERROR(status)) return status; } /* run client event loop */ status = serf_context_run(tb->context, 0, iter_pool); if (!APR_STATUS_IS_TIMEUP(status) && SERF_BUCKET_READ_ERROR(status)) return status; done = 1; for (i = 0; i < num_requests; i++) done &= handler_ctx[i].done; } apr_pool_destroy(iter_pool); return APR_SUCCESS; }