diff options
author | Yang Tse <yangsita@gmail.com> | 2006-10-19 17:29:25 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2006-10-19 17:29:25 +0000 |
commit | ead6ab2ef765ec8c917ba8f5424d72a6624b0b20 (patch) | |
tree | 76673eab3e7f25a3986b051b28af40c61668ee92 /tests/libtest/lib530.c | |
parent | 5c3dc49f44727c33cc683a09b8a90779683fae1a (diff) | |
download | curl-ead6ab2ef765ec8c917ba8f5424d72a6624b0b20.tar.gz |
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/lib530.c')
-rw-r--r-- | tests/libtest/lib530.c | 15 |
1 files changed, 12 insertions, 3 deletions
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]); |