diff options
-rw-r--r-- | tests/libtest/lib504.c | 15 | ||||
-rw-r--r-- | tests/libtest/lib507.c | 29 | ||||
-rw-r--r-- | tests/libtest/lib509.c | 30 | ||||
-rw-r--r-- | tests/libtest/lib525.c | 15 | ||||
-rw-r--r-- | tests/libtest/lib526.c | 15 | ||||
-rw-r--r-- | tests/libtest/lib530.c | 15 | ||||
-rw-r--r-- | tests/libtest/lib533.c | 15 | ||||
-rw-r--r-- | tests/libtest/lib536.c | 8 |
8 files changed, 110 insertions, 32 deletions
diff --git a/tests/libtest/lib504.c b/tests/libtest/lib504.c index 843e9ebd0..fed91232c 100644 --- a/tests/libtest/lib504.c +++ b/tests/libtest/lib504.c @@ -20,7 +20,8 @@ int test(char *URL) int running; int max_fd; int rc; - int loop=10; + int loop1 = 10; + int loop2 = 20; curl_global_init(CURL_GLOBAL_ALL); c = curl_easy_init(); @@ -42,12 +43,15 @@ int test(char *URL) interval.tv_sec = 1; interval.tv_usec = 0; + int loop2 = 20; fprintf(stderr, "curl_multi_perform()\n"); do { res = curl_multi_perform(m, &running); - } while (res == CURLM_CALL_MULTI_PERFORM); + } while ((--loop2>0) && (res == CURLM_CALL_MULTI_PERFORM)); + if (loop2 <= 0) + break; if(!running) { /* This is where this code is expected to reach */ int numleft; @@ -82,7 +86,12 @@ int test(char *URL) /* we only allow a certain number of loops to avoid hanging here forever */ - } while(--loop>0); + } while(--loop1>0); + if ((loop1 <= 0) || (loop2 <= 0)) { + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + ret = 77; + } } curl_multi_remove_handle(m, c); diff --git a/tests/libtest/lib507.c b/tests/libtest/lib507.c index 8fc4ca3ce..e4b1e35a8 100644 --- a/tests/libtest/lib507.c +++ b/tests/libtest/lib507.c @@ -7,6 +7,8 @@ int test(char *URL) int still_running; int i = -1; CURLMsg *msg; + int loop1 = 20; + int loop2 = 40; multi = curl_multi_init(); @@ -14,8 +16,10 @@ int test(char *URL) curl_easy_setopt(curls, CURLOPT_URL, URL); curl_multi_add_handle(multi, curls); - while ( CURLM_CALL_MULTI_PERFORM == curl_multi_perform(multi, &still_running) ); - while(still_running) { + while ((--loop1>0) && (CURLM_CALL_MULTI_PERFORM == + curl_multi_perform(multi, &still_running))); + + while ((loop1>0) && (--loop2>0) && (still_running)) { struct timeval timeout; int rc; fd_set fdread; @@ -34,15 +38,24 @@ int test(char *URL) break; case 0: default: - while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform(multi, &still_running)); + loop1 = 20; + while ((--loop1>0) && (CURLM_CALL_MULTI_PERFORM == + curl_multi_perform(multi, &still_running))); break; } } - msg = curl_multi_info_read(multi, &still_running); - if(msg) - /* this should now contain a result code from the easy handle, - get it */ - i = msg->data.result; + if ((loop1 <= 0) || (loop2 <= 0)) { + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + i = 77; + } + else { + msg = curl_multi_info_read(multi, &still_running); + if(msg) + /* this should now contain a result code from the easy handle, + get it */ + i = msg->data.result; + } curl_multi_cleanup(multi); curl_easy_cleanup(curls); diff --git a/tests/libtest/lib509.c b/tests/libtest/lib509.c index 415208ac7..9327d728f 100644 --- a/tests/libtest/lib509.c +++ b/tests/libtest/lib509.c @@ -175,6 +175,9 @@ int test(char *URL) int i = 0; CURLMsg *msg; + int loop1 = 40; + int loop2 = 20; + if(arg2) { portnum = atoi(arg2); } @@ -205,15 +208,16 @@ int test(char *URL) res = curl_multi_add_handle(multi, p.curl); - while(!done) { + while ((--loop1>0) && (loop2>0) && (!done)) { fd_set rd, wr, exc; int max_fd; struct timeval interval; interval.tv_sec = 1; interval.tv_usec = 0; + loop2 = 20; - while (res == CURLM_CALL_MULTI_PERFORM) { + while ((--loop2>0) && (res == CURLM_CALL_MULTI_PERFORM)) { res = curl_multi_perform(multi, &running); fprintf(stderr, "running=%d res=%d\n",running,res); if (running <= 0) { @@ -221,7 +225,7 @@ int test(char *URL) break; } } - if(done) + if ((loop2 <= 0) || (done)) break; if (res != CURLM_OK) { @@ -249,13 +253,23 @@ int test(char *URL) res = CURLM_CALL_MULTI_PERFORM; } - msg = curl_multi_info_read(multi, &running); - /* this should now contain a result code from the easy handle, get it */ - if(msg) - i = msg->data.result; + + if ((loop1 <= 0) || (loop2 <= 0)) { + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + i = 77; + } + else { + msg = curl_multi_info_read(multi, &running); + /* this should now contain a result code from the easy handle, get it */ + if(msg) + i = msg->data.result; + } } - fprintf(stderr, "all done\n"); + if ((loop1>0) && (loop2>0)) { + fprintf(stderr, "all done\n"); + } curl_multi_remove_handle(multi, p.curl); curl_easy_cleanup(p.curl); diff --git a/tests/libtest/lib525.c b/tests/libtest/lib525.c index 9dcddaecf..b5b522de1 100644 --- a/tests/libtest/lib525.c +++ b/tests/libtest/lib525.c @@ -24,6 +24,8 @@ int test(char *URL) int running; char done=FALSE; CURLM *m; + int loop1 = 40; + int loop2 = 20; if (!arg2) { fprintf(stderr, "Usage: lib525 [url] [uploadfile]\n"); @@ -82,22 +84,23 @@ int test(char *URL) res = (int)curl_multi_add_handle(m, curl); - while(!done) { + while ((--loop1>0) && (loop2>0) && (!done)) { fd_set rd, wr, exc; int max_fd; struct timeval interval; interval.tv_sec = 1; interval.tv_usec = 0; + loop2 = 20; - while (res == CURLM_CALL_MULTI_PERFORM) { + while ((--loop2>0) && (res == CURLM_CALL_MULTI_PERFORM)) { res = (int)curl_multi_perform(m, &running); if (running <= 0) { done = TRUE; break; } } - if(done) + if ((loop2 <= 0) || (done)) break; if (res != CURLM_OK) { @@ -125,6 +128,12 @@ int test(char *URL) res = CURLM_CALL_MULTI_PERFORM; } + if ((loop1 <= 0) || (loop2 <= 0)) { + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + res = 77; + } + #ifdef LIB529 /* test 529 */ curl_multi_remove_handle(m, curl); diff --git a/tests/libtest/lib526.c b/tests/libtest/lib526.c index dce6a9f1b..e521b6021 100644 --- a/tests/libtest/lib526.c +++ b/tests/libtest/lib526.c @@ -44,6 +44,8 @@ int test(char *URL) CURLM *m; int current=0; int i; + int loop1 = 40; + int loop2 = 20; /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); @@ -67,15 +69,16 @@ int test(char *URL) fprintf(stderr, "Start at URL 0\n"); - while(!done) { + while ((--loop1>0) && (loop2>0) && (!done)) { fd_set rd, wr, exc; int max_fd; struct timeval interval; interval.tv_sec = 1; interval.tv_usec = 0; + loop2 = 20; - while (res == CURLM_CALL_MULTI_PERFORM) { + while ((--loop2>0) && (res == CURLM_CALL_MULTI_PERFORM)) { res = (int)curl_multi_perform(m, &running); if (running <= 0) { #ifdef LIB527 @@ -112,7 +115,7 @@ int test(char *URL) break; } } - if(done) + if ((loop2 <= 0) || (done)) break; if (res != CURLM_OK) { @@ -140,6 +143,12 @@ int test(char *URL) res = CURLM_CALL_MULTI_PERFORM; } + if ((loop1 <= 0) || (loop2 <= 0)) { + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + res = 77; + } + #ifndef LIB527 /* get NUM_HANDLES easy handles */ for(i=0; i < NUM_HANDLES; i++) { diff --git a/tests/libtest/lib530.c b/tests/libtest/lib530.c index d062886f4..6ee346d94 100644 --- a/tests/libtest/lib530.c +++ b/tests/libtest/lib530.c @@ -23,6 +23,8 @@ int test(char *URL) char done=FALSE; CURLM *m; int i; + int loop1 = 40; + int loop2 = 20; /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); @@ -51,22 +53,23 @@ int test(char *URL) fprintf(stderr, "Start at URL 0\n"); - while(!done) { + while ((--loop1>0) && (loop2>0) && (!done)) { fd_set rd, wr, exc; int max_fd; struct timeval interval; interval.tv_sec = 1; interval.tv_usec = 0; + loop2 = 20; - while (res == CURLM_CALL_MULTI_PERFORM) { + while ((--loop2>0) && (res == CURLM_CALL_MULTI_PERFORM)) { res = (int)curl_multi_perform(m, &running); if (running <= 0) { done = TRUE; /* bail out */ break; } } - if(done) + if ((loop2 <= 0) || (done)) break; if (res != CURLM_OK) { @@ -94,6 +97,12 @@ int test(char *URL) res = CURLM_CALL_MULTI_PERFORM; } + if ((loop1 <= 0) || (loop2 <= 0)) { + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + res = 77; + } + /* get NUM_HANDLES easy handles */ for(i=0; i < NUM_HANDLES; i++) { curl_multi_remove_handle(m, curl[i]); diff --git a/tests/libtest/lib533.c b/tests/libtest/lib533.c index 74499c232..4403f75ff 100644 --- a/tests/libtest/lib533.c +++ b/tests/libtest/lib533.c @@ -24,6 +24,8 @@ int test(char *URL) char done=FALSE; CURLM *m; int current=0; + int loop1 = 40; + int loop2 = 20; /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); @@ -44,15 +46,16 @@ int test(char *URL) fprintf(stderr, "Start at URL 0\n"); - while(!done) { + while ((--loop1>0) && (loop2>0) && (!done)) { fd_set rd, wr, exc; int max_fd; struct timeval interval; interval.tv_sec = 1; interval.tv_usec = 0; + loop2 = 20; - while (res == CURLM_CALL_MULTI_PERFORM) { + while ((--loop2>0) && (res == CURLM_CALL_MULTI_PERFORM)) { res = (int)curl_multi_perform(m, &running); if (running <= 0) { if(!current++) { @@ -80,7 +83,7 @@ int test(char *URL) break; } } - if(done) + if ((loop2 <= 0) || (done)) break; if (res != CURLM_OK) { @@ -108,6 +111,12 @@ int test(char *URL) res = CURLM_CALL_MULTI_PERFORM; } + if ((loop1 <= 0) || (loop2 <= 0)) { + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + res = 77; + } + curl_easy_cleanup(curl); curl_multi_cleanup(m); diff --git a/tests/libtest/lib536.c b/tests/libtest/lib536.c index 40b45e47d..53439c797 100644 --- a/tests/libtest/lib536.c +++ b/tests/libtest/lib536.c @@ -21,8 +21,9 @@ static CURLMcode perform(CURLM * multi) int handles, maxfd; CURLMcode code; fd_set fdread, fdwrite, fdexcep; + int loop; - for (;;) { + for (loop=40;loop>0;loop--) { code = curl_multi_perform(multi, &handles); if (handles <= 0) return CURLM_OK; @@ -45,6 +46,11 @@ static CURLMcode perform(CURLM * multi) if (select(maxfd + 1, &fdread, &fdwrite, &fdexcep, 0) == -1) return (CURLMcode) ~CURLM_OK; } + if (loop <= 0) { + fprintf(stderr, "ABORTING TEST, since it seems " + "that it would have run forever.\n"); + return (CURLMcode) ~CURLM_OK; + } } int test(char *URL) |