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/lib536.c | |
parent | 5c3dc49f44727c33cc683a09b8a90779683fae1a (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/lib536.c')
-rw-r--r-- | tests/libtest/lib536.c | 8 |
1 files changed, 7 insertions, 1 deletions
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) |