Skip to content

Commit

Permalink
test1531: Add timeout
Browse files Browse the repository at this point in the history
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 curl#2853
  • Loading branch information
rikardfalkeborn authored and xquery committed Sep 3, 2018
1 parent 6810179 commit 8e1443c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/libtest/lib1531.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 */
Expand Down Expand Up @@ -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 */
Expand All @@ -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;
}

0 comments on commit 8e1443c

Please sign in to comment.