Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "test.h"
00023
00024 #include "testutil.h"
00025 #include "warnless.h"
00026 #include "memdebug.h"
00027
00028 #define TEST_HANG_TIMEOUT 60 * 1000
00029
00030
00031
00032
00033
00034
00035
00036
00037 int test(char *URL)
00038 {
00039 CURL *c = NULL;
00040 int res = 0;
00041 CURLM *m = NULL;
00042 fd_set rd, wr, exc;
00043 int running;
00044
00045 start_test_timing();
00046
00047 global_init(CURL_GLOBAL_ALL);
00048
00049 easy_init(c);
00050
00051
00052
00053 if(libtest_arg2)
00054 easy_setopt(c, CURLOPT_PROXY, libtest_arg2);
00055 easy_setopt(c, CURLOPT_URL, URL);
00056 easy_setopt(c, CURLOPT_VERBOSE, 1L);
00057
00058 multi_init(m);
00059
00060 multi_add_handle(m, c);
00061
00062 for(;;) {
00063 struct timeval interval;
00064 int maxfd = -99;
00065
00066 interval.tv_sec = 1;
00067 interval.tv_usec = 0;
00068
00069 fprintf(stderr, "curl_multi_perform()\n");
00070
00071 multi_perform(m, &running);
00072
00073 abort_on_test_timeout();
00074
00075 if(!running) {
00076
00077 int numleft;
00078 CURLMsg *msg = curl_multi_info_read(m, &numleft);
00079 fprintf(stderr, "Expected: not running\n");
00080 if(msg && !numleft)
00081 res = TEST_ERR_SUCCESS;
00082 else
00083 res = TEST_ERR_FAILURE;
00084 break;
00085 }
00086 fprintf(stderr, "running == %d\n", running);
00087
00088 FD_ZERO(&rd);
00089 FD_ZERO(&wr);
00090 FD_ZERO(&exc);
00091
00092 fprintf(stderr, "curl_multi_fdset()\n");
00093
00094 multi_fdset(m, &rd, &wr, &exc, &maxfd);
00095
00096
00097
00098 select_test(maxfd+1, &rd, &wr, &exc, &interval);
00099
00100 abort_on_test_timeout();
00101 }
00102
00103 test_cleanup:
00104
00105
00106
00107 curl_multi_remove_handle(m, c);
00108 curl_multi_cleanup(m);
00109 curl_easy_cleanup(c);
00110 curl_global_cleanup();
00111
00112 return res;
00113 }
00114