aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest
diff options
context:
space:
mode:
authorRikard Falkeborn <rikard.falkeborn@gmail.com>2018-08-08 00:10:10 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-08-09 12:40:47 +0200
commit96d6d3801eb0c6415c05e729f2f2729f3d24c966 (patch)
tree38e69b9d83fcdf500beda07c48c01cd2c4a66b88 /tests/libtest
parent8ea0baed3ccf96a8082803d5080805e81a81c666 (diff)
test1531: Add timeout
Previously, the macro TEST_HANG_TIMEOUT was unused, but since there is looping going on, we might as well add timing instead of removing it. Closes #2853
Diffstat (limited to 'tests/libtest')
-rw-r--r--tests/libtest/lib1531.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/libtest/lib1531.c b/tests/libtest/lib1531.c
index 5ee617e52..953f062d8 100644
--- a/tests/libtest/lib1531.c
+++ b/tests/libtest/lib1531.c
@@ -39,6 +39,8 @@ int test(char *URL)
int msgs_left; /* how many messages are left */
int res = CURLE_OK;
+ start_test_timing();
+
global_init(CURL_GLOBAL_ALL);
/* Allocate one CURL handle per transfer */
@@ -59,6 +61,8 @@ int test(char *URL)
/* we start some action by calling perform right away */
curl_multi_perform(multi_handle, &still_running);
+ abort_on_test_timeout();
+
do {
struct timeval timeout;
int rc; /* select() return code */
@@ -127,6 +131,8 @@ int test(char *URL)
curl_multi_perform(multi_handle, &still_running);
break;
}
+
+ abort_on_test_timeout();
} while(still_running);
/* See how the transfers went */
@@ -136,14 +142,17 @@ int test(char *URL)
printf("HTTP transfer completed with status %d\n", msg->data.result);
break;
}
+
+ abort_on_test_timeout();
} while(msg);
+test_cleanup:
curl_multi_cleanup(multi_handle);
/* Free the CURL handles */
curl_easy_cleanup(easy);
curl_global_cleanup();
- return 0;
+ return res;
}