aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest/lib504.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2006-10-19 17:29:25 +0000
committerYang Tse <yangsita@gmail.com>2006-10-19 17:29:25 +0000
commitead6ab2ef765ec8c917ba8f5424d72a6624b0b20 (patch)
tree76673eab3e7f25a3986b051b28af40c61668ee92 /tests/libtest/lib504.c
parent5c3dc49f44727c33cc683a09b8a90779683fae1a (diff)
Abort test if it seems that it would have run forever. This is just to prevent
test hanging and actually is an indication that there's a condition that is not being properly handled at some point in the library. Loop counter limits might need to be further increased on false positives.
Diffstat (limited to 'tests/libtest/lib504.c')
-rw-r--r--tests/libtest/lib504.c15
1 files changed, 12 insertions, 3 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);