From ead6ab2ef765ec8c917ba8f5424d72a6624b0b20 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 19 Oct 2006 17:29:25 +0000 Subject: 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. --- tests/libtest/lib536.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests/libtest/lib536.c') 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) -- cgit v1.2.3