aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-10-24 20:58:34 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-10-24 20:58:34 +0000
commitda0b380655ad10865c8e56b15641373b656f0807 (patch)
treebc3b52f01aec133e4c1b7d5efc50d75364bd91bf /tests
parented7ac3c932b08bb72172623041f7660a601f5f87 (diff)
don't select() forever, set a timeout so at least the test fails nice
Diffstat (limited to 'tests')
-rw-r--r--tests/libtest/lib503.c3
-rw-r--r--tests/libtest/lib504.c25
2 files changed, 16 insertions, 12 deletions
diff --git a/tests/libtest/lib503.c b/tests/libtest/lib503.c
index c77e084bc..126e257a6 100644
--- a/tests/libtest/lib503.c
+++ b/tests/libtest/lib503.c
@@ -40,6 +40,7 @@ CURLcode test(char *URL)
while(!done) {
fd_set rd, wr, exc;
int max_fd;
+ struct timeval interval={1,0};
while (res == CURLM_CALL_MULTI_PERFORM) {
res = curl_multi_perform(m, &running);
@@ -66,7 +67,7 @@ CURLcode test(char *URL)
return 89;
}
- if (select(max_fd+1, &rd, &wr, &exc, NULL) == -1) {
+ if (select(max_fd+1, &rd, &wr, &exc, &interval) == -1) {
fprintf(stderr, "bad select??\n");
return 95;
}
diff --git a/tests/libtest/lib504.c b/tests/libtest/lib504.c
index 9acd71bdf..9eba0b764 100644
--- a/tests/libtest/lib504.c
+++ b/tests/libtest/lib504.c
@@ -22,6 +22,7 @@ CURLcode test(char *URL)
CURLMcode res;
int running;
int max_fd;
+ int rc;
curl_global_init(CURL_GLOBAL_ALL);
c = curl_easy_init();
@@ -36,26 +37,29 @@ CURLcode test(char *URL)
res = curl_multi_add_handle(m, c);
if(res && (res != CURLM_CALL_MULTI_PERFORM))
- return 1; /* major failure */
+ return 1; /* major failure */
do {
+ struct timeval interval={1,0};
+
+ fprintf(stderr, "curl_multi_perform()\n");
+
do {
res = curl_multi_perform(m, &running);
- } while (res == CURLM_CALL_MULTI_PERFORM);
+ } while (res == CURLM_CALL_MULTI_PERFORM);
if(!running) {
/* This is where this code is expected to reach */
int numleft;
CURLMsg *msg = curl_multi_info_read(m, &numleft);
- fprintf(stderr, "Not running\n");
+ fprintf(stderr, "Expected: not running\n");
if(msg && !numleft)
ret = 100; /* this is where we should be */
else
ret = 99; /* not correct */
break;
}
- fprintf(stderr, "running %d res %d\n", running, res);
+ fprintf(stderr, "running == %d, res == %d\n", running, res);
if (res != CURLM_OK) {
- fprintf(stderr, "not okay???\n");
ret = 2;
break;
}
@@ -65,17 +69,16 @@ CURLcode test(char *URL)
FD_ZERO(&exc);
max_fd = 0;
- fprintf(stderr, "_fdset()\n");
+ fprintf(stderr, "curl_multi_fdset()\n");
if (curl_multi_fdset(m, &rd, &wr, &exc, &max_fd) != CURLM_OK) {
fprintf(stderr, "unexpected failured of fdset.\n");
ret = 3;
break;
}
- fprintf(stderr, "select\n");
- select(max_fd+1, &rd, &wr, &exc, NULL);
-
- fprintf(stderr, "loop!\n");
- } while(1);
+ rc = select(max_fd+1, &rd, &wr, &exc, &interval);
+ fprintf(stderr, "select returned %d\n", rc);
+
+ } while(rc);
curl_multi_remove_handle(m, c);
curl_easy_cleanup(c);