aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-06-26 23:12:08 +0200
committerDaniel Stenberg <daniel@haxx.se>2011-06-27 16:01:41 +0200
commitfb48e2050b558c908c7740d1c4f20fd17fdf7fe6 (patch)
tree9425a7c6a674d87bc58792f1a25169260968a0d6 /tests/libtest
parent78480892cdbbc67f419d0acfdf1865043bc31f62 (diff)
libtests: stop checking for CURLM_CALL_MULTI_PERFORM
CURLM_CALL_MULTI_PERFORM stopped being a valid return code from curl_multi_perform back in 7.20.0. All the libcurl tests are ajusted to this and no longer check for this return code. Makes them simpler.
Diffstat (limited to 'tests/libtest')
-rw-r--r--tests/libtest/lib503.c22
-rw-r--r--tests/libtest/lib504.c14
-rw-r--r--tests/libtest/lib507.c30
-rw-r--r--tests/libtest/lib525.c20
-rw-r--r--tests/libtest/lib526.c65
-rw-r--r--tests/libtest/lib530.c20
-rw-r--r--tests/libtest/lib533.c59
-rw-r--r--tests/libtest/lib536.c2
-rw-r--r--tests/libtest/lib540.c4
-rw-r--r--tests/libtest/lib560.c8
-rw-r--r--tests/libtest/lib564.c22
-rw-r--r--tests/libtest/lib575.c6
-rw-r--r--tests/libtest/lib582.c9
13 files changed, 117 insertions, 164 deletions
diff --git a/tests/libtest/lib503.c b/tests/libtest/lib503.c
index 25a641548..53f8f807b 100644
--- a/tests/libtest/lib503.c
+++ b/tests/libtest/lib503.c
@@ -103,18 +103,17 @@ int test(char *URL)
mp_timedout = FALSE;
mp_start = tutil_tvnow();
- while (res == CURLM_CALL_MULTI_PERFORM) {
- res = (int)curl_multi_perform(m, &running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- if (running <= 0) {
- done = TRUE;
- break;
- }
+ res = (int)curl_multi_perform(m, &running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT) {
+ mp_timedout = TRUE;
+ break;
+ }
+ if (running <= 0) {
+ done = TRUE;
+ break;
}
+
if (mp_timedout || done)
break;
@@ -140,7 +139,6 @@ int test(char *URL)
break;
}
- res = CURLM_CALL_MULTI_PERFORM;
}
if (ml_timedout || mp_timedout) {
diff --git a/tests/libtest/lib504.c b/tests/libtest/lib504.c
index f45ac256b..e83c66167 100644
--- a/tests/libtest/lib504.c
+++ b/tests/libtest/lib504.c
@@ -106,15 +106,11 @@ int test(char *URL)
fprintf(stderr, "curl_multi_perform()\n");
- ret = CURLM_CALL_MULTI_PERFORM;
-
- while (ret == CURLM_CALL_MULTI_PERFORM) {
- ret = curl_multi_perform(m, &running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
+ ret = curl_multi_perform(m, &running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT) {
+ mp_timedout = TRUE;
+ break;
}
if (mp_timedout)
break;
diff --git a/tests/libtest/lib507.c b/tests/libtest/lib507.c
index c5a009d8c..e4a1b241b 100644
--- a/tests/libtest/lib507.c
+++ b/tests/libtest/lib507.c
@@ -75,14 +75,10 @@ int test(char *URL)
mp_timedout = FALSE;
mp_start = tutil_tvnow();
- do {
- ret = curl_multi_perform(multi, &still_running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- } while (ret == CURLM_CALL_MULTI_PERFORM);
+ ret = curl_multi_perform(multi, &still_running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT)
+ mp_timedout = TRUE;
ml_timedout = FALSE;
ml_start = tutil_tvnow();
@@ -116,20 +112,18 @@ int test(char *URL)
default:
mp_timedout = FALSE;
mp_start = tutil_tvnow();
- do {
- ret = curl_multi_perform(multi, &still_running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- } while (ret == CURLM_CALL_MULTI_PERFORM);
+ ret = curl_multi_perform(multi, &still_running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT)
+ mp_timedout = TRUE;
break;
}
}
if (ml_timedout || mp_timedout) {
- if (ml_timedout) fprintf(stderr, "ml_timedout\n");
- if (mp_timedout) fprintf(stderr, "mp_timedout\n");
+ if (ml_timedout)
+ fprintf(stderr, "ml_timedout\n");
+ if (mp_timedout)
+ fprintf(stderr, "mp_timedout\n");
fprintf(stderr, "ABORTING TEST, since it seems "
"that it would have run forever.\n");
i = TEST_ERR_RUNS_FOREVER;
diff --git a/tests/libtest/lib525.c b/tests/libtest/lib525.c
index f034050eb..4a79cecc2 100644
--- a/tests/libtest/lib525.c
+++ b/tests/libtest/lib525.c
@@ -151,20 +151,16 @@ int test(char *URL)
mp_timedout = FALSE;
mp_start = tutil_tvnow();
- while (res == CURLM_CALL_MULTI_PERFORM) {
- res = (int)curl_multi_perform(m, &running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- if (running <= 0) {
- done = TRUE;
- break;
- }
+ res = (int)curl_multi_perform(m, &running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT) {
+ mp_timedout = TRUE;
+ break;
}
- if (mp_timedout || done)
+ if (running <= 0) {
+ done = TRUE;
break;
+ }
if (res != CURLM_OK) {
fprintf(stderr, "not okay???\n");
diff --git a/tests/libtest/lib526.c b/tests/libtest/lib526.c
index a0085ec3c..e73eab029 100644
--- a/tests/libtest/lib526.c
+++ b/tests/libtest/lib526.c
@@ -149,50 +149,47 @@ int test(char *URL)
mp_timedout = FALSE;
mp_start = tutil_tvnow();
- while (res == CURLM_CALL_MULTI_PERFORM) {
- res = (int)curl_multi_perform(m, &running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- if (running <= 0) {
+ res = (int)curl_multi_perform(m, &running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT) {
+ mp_timedout = TRUE;
+ break;
+ }
+ if (running <= 0) {
#ifdef LIB527
- /* NOTE: this code does not remove the handle from the multi handle
- here, which would be the nice, sane and documented way of working.
- This however tests that the API survives this abuse gracefully. */
- curl_easy_cleanup(curl[current]);
+ /* NOTE: this code does not remove the handle from the multi handle
+ here, which would be the nice, sane and documented way of working.
+ This however tests that the API survives this abuse gracefully. */
+ curl_easy_cleanup(curl[current]);
#endif
- if(++current < NUM_HANDLES) {
- fprintf(stderr, "Advancing to URL %d\n", current);
+ if(++current < NUM_HANDLES) {
+ fprintf(stderr, "Advancing to URL %d\n", current);
#ifdef LIB532
- /* first remove the only handle we use */
- curl_multi_remove_handle(m, curl[0]);
+ /* first remove the only handle we use */
+ curl_multi_remove_handle(m, curl[0]);
- /* make us re-use the same handle all the time, and try resetting
- the handle first too */
- curl_easy_reset(curl[0]);
- test_setopt(curl[0], CURLOPT_URL, URL);
- test_setopt(curl[0], CURLOPT_VERBOSE, 1L);
+ /* make us re-use the same handle all the time, and try resetting
+ the handle first too */
+ curl_easy_reset(curl[0]);
+ test_setopt(curl[0], CURLOPT_URL, URL);
+ test_setopt(curl[0], CURLOPT_VERBOSE, 1L);
- /* re-add it */
- res = (int)curl_multi_add_handle(m, curl[0]);
+ /* re-add it */
+ res = (int)curl_multi_add_handle(m, curl[0]);
#else
- res = (int)curl_multi_add_handle(m, curl[current]);
+ res = (int)curl_multi_add_handle(m, curl[current]);
#endif
- if(res) {
- fprintf(stderr, "add handle failed: %d.\n", res);
- res = 243;
- break;
- }
+ if(res) {
+ fprintf(stderr, "add handle failed: %d.\n", res);
+ res = 243;
+ break;
}
- else
- done = TRUE; /* bail out */
+ }
+ else {
+ done = TRUE; /* bail out */
break;
}
}
- if (mp_timedout || done)
- break;
if (res != CURLM_OK) {
fprintf(stderr, "not okay???\n");
@@ -215,8 +212,6 @@ int test(char *URL)
res = 195;
break;
}
-
- res = CURLM_CALL_MULTI_PERFORM;
}
if (ml_timedout || mp_timedout) {
diff --git a/tests/libtest/lib530.c b/tests/libtest/lib530.c
index add64ea31..6ad946f2d 100644
--- a/tests/libtest/lib530.c
+++ b/tests/libtest/lib530.c
@@ -161,20 +161,16 @@ int test(char *URL)
mp_timedout = FALSE;
mp_start = tutil_tvnow();
- while (res == CURLM_CALL_MULTI_PERFORM) {
- res = (int)curl_multi_perform(m, &running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- if (running <= 0) {
- done = TRUE; /* bail out */
- break;
- }
+ res = (int)curl_multi_perform(m, &running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT) {
+ mp_timedout = TRUE;
+ break;
}
- if (mp_timedout || done)
+ if (running <= 0) {
+ done = TRUE; /* bail out */
break;
+ }
if (res != CURLM_OK) {
fprintf(stderr, "not okay???\n");
diff --git a/tests/libtest/lib533.c b/tests/libtest/lib533.c
index 606eba75c..5b6d8bf73 100644
--- a/tests/libtest/lib533.c
+++ b/tests/libtest/lib533.c
@@ -99,41 +99,38 @@ int test(char *URL)
mp_timedout = FALSE;
mp_start = tutil_tvnow();
- while (res == CURLM_CALL_MULTI_PERFORM) {
- res = (int)curl_multi_perform(m, &running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- if (running <= 0) {
- if(!current++) {
- fprintf(stderr, "Advancing to URL 1\n");
- /* remove the handle we use */
- curl_multi_remove_handle(m, curl);
-
- /* make us re-use the same handle all the time, and try resetting
- the handle first too */
- curl_easy_reset(curl);
- test_setopt(curl, CURLOPT_URL, libtest_arg2);
- test_setopt(curl, CURLOPT_VERBOSE, 1);
- test_setopt(curl, CURLOPT_FAILONERROR, 1);
-
- /* re-add it */
- res = (int)curl_multi_add_handle(m, curl);
- if(res) {
- fprintf(stderr, "add handle failed: %d.\n", res);
- res = 243;
- break;
- }
+ res = (int)curl_multi_perform(m, &running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT) {
+ mp_timedout = TRUE;
+ break;
+ }
+ if (running <= 0) {
+ if(!current++) {
+ fprintf(stderr, "Advancing to URL 1\n");
+ /* remove the handle we use */
+ curl_multi_remove_handle(m, curl);
+
+ /* make us re-use the same handle all the time, and try resetting
+ the handle first too */
+ curl_easy_reset(curl);
+ test_setopt(curl, CURLOPT_URL, libtest_arg2);
+ test_setopt(curl, CURLOPT_VERBOSE, 1);
+ test_setopt(curl, CURLOPT_FAILONERROR, 1);
+
+ /* re-add it */
+ res = (int)curl_multi_add_handle(m, curl);
+ if(res) {
+ fprintf(stderr, "add handle failed: %d.\n", res);
+ res = 243;
+ break;
}
- else
- done = TRUE; /* bail out */
+ }
+ else {
+ done = TRUE; /* bail out */
break;
}
}
- if (mp_timedout || done)
- break;
if (res != CURLM_OK) {
fprintf(stderr, "not okay???\n");
diff --git a/tests/libtest/lib536.c b/tests/libtest/lib536.c
index dca880cea..7e81351c9 100644
--- a/tests/libtest/lib536.c
+++ b/tests/libtest/lib536.c
@@ -59,8 +59,6 @@ static CURLMcode perform(CURLM * multi)
switch (code) {
case CURLM_OK:
break;
- case CURLM_CALL_MULTI_PERFORM:
- continue;
default:
return code;
}
diff --git a/tests/libtest/lib540.c b/tests/libtest/lib540.c
index 55457dd46..6647ab399 100644
--- a/tests/libtest/lib540.c
+++ b/tests/libtest/lib540.c
@@ -87,9 +87,7 @@ static int loop(CURLM *cm, const char* url, const char* userpwd,
while (U) {
- do {
- code = curl_multi_perform(cm, &U);
- } while (code == CURLM_CALL_MULTI_PERFORM);
+ code = curl_multi_perform(cm, &U);
if (U) {
FD_ZERO(&R);
diff --git a/tests/libtest/lib560.c b/tests/libtest/lib560.c
index e375be535..851d5d193 100644
--- a/tests/libtest/lib560.c
+++ b/tests/libtest/lib560.c
@@ -63,9 +63,7 @@ int test(char *URL)
curl_multi_add_handle(multi_handle, http_handle);
/* we start some action by calling perform right away */
- do {
- code = curl_multi_perform(multi_handle, &still_running);
- } while(code == CURLM_CALL_MULTI_PERFORM);
+ code = curl_multi_perform(multi_handle, &still_running);
while(still_running) {
struct timeval timeout;
@@ -100,9 +98,7 @@ int test(char *URL)
case 0:
default:
/* timeout or readable/writable sockets */
- do {
- code = curl_multi_perform(multi_handle, &still_running);
- } while(code == CURLM_CALL_MULTI_PERFORM);
+ code = curl_multi_perform(multi_handle, &still_running);
break;
}
}
diff --git a/tests/libtest/lib564.c b/tests/libtest/lib564.c
index d831d21e1..96504bd3d 100644
--- a/tests/libtest/lib564.c
+++ b/tests/libtest/lib564.c
@@ -98,20 +98,16 @@ int test(char *URL)
mp_timedout = FALSE;
mp_start = tutil_tvnow();
- while (res == CURLM_CALL_MULTI_PERFORM) {
- res = (int)curl_multi_perform(m, &running);
- if (tutil_tvdiff(tutil_tvnow(), mp_start) >
- MULTI_PERFORM_HANG_TIMEOUT) {
- mp_timedout = TRUE;
- break;
- }
- if (running <= 0) {
- done = TRUE; /* bail out */
- break;
- }
+ res = (int)curl_multi_perform(m, &running);
+ if (tutil_tvdiff(tutil_tvnow(), mp_start) >
+ MULTI_PERFORM_HANG_TIMEOUT) {
+ mp_timedout = TRUE;
+ break;
}
- if (mp_timedout || done)
+ if (running <= 0) {
+ done = TRUE; /* bail out */
break;
+ }
if (res != CURLM_OK) {
fprintf(stderr, "not okay???\n");
@@ -134,8 +130,6 @@ int test(char *URL)
res = 195;
break;
}
-
- res = CURLM_CALL_MULTI_PERFORM;
}
if (ml_timedout || mp_timedout) {
diff --git a/tests/libtest/lib575.c b/tests/libtest/lib575.c
index 4d0b16576..bb84b1a1c 100644
--- a/tests/libtest/lib575.c
+++ b/tests/libtest/lib575.c
@@ -81,8 +81,7 @@ int test(char *URL)
curl_multi_add_handle(mhandle, handle);
- while(CURLM_CALL_MULTI_PERFORM ==
- curl_multi_perform(mhandle, &still_running));
+ curl_multi_perform(mhandle, &still_running);
while(still_running) {
static struct timeval timeout = /* 100 ms */ { 0, 100000L };
@@ -108,8 +107,7 @@ int test(char *URL)
goto test_cleanup;
}
else {
- while(CURLM_CALL_MULTI_PERFORM ==
- curl_multi_perform(mhandle, &still_running));
+ curl_multi_perform(mhandle, &still_running);
}
}
diff --git a/tests/libtest/lib582.c b/tests/libtest/lib582.c
index 3b7f1afee..2f8fcd992 100644
--- a/tests/libtest/lib582.c
+++ b/tests/libtest/lib582.c
@@ -182,8 +182,7 @@ static void notifyCurl(CURL* curl, curl_socket_t s, int evBitmask,
{
int numhandles = 0;
CURLMcode result = curl_multi_socket_action(curl, s, evBitmask, &numhandles);
- if (result != CURLM_OK && result != CURLM_CALL_MULTI_PERFORM)
- {
+ if (result != CURLM_OK) {
fprintf(stderr, "Curl error on %s: %i (%s)\n",
info, result, curl_multi_strerror(result));
}
@@ -196,10 +195,8 @@ static void checkFdSet(CURL* curl, struct Sockets* sockets, fd_set* fdset,
int evBitmask, const char* name)
{
int i;
- for (i = 0; i < sockets->count; ++i)
- {
- if (FD_ISSET(sockets->sockets[i], fdset))
- {
+ for (i = 0; i < sockets->count; ++i) {
+ if (FD_ISSET(sockets->sockets[i], fdset)) {
notifyCurl(curl, sockets->sockets[i], evBitmask, name);
}
}