tests: make a few lib15?? tests pass the OOM torture tests
This commit is contained in:
parent
d735d3e803
commit
9873fd5317
@ -32,13 +32,13 @@
|
||||
int test(char *URL)
|
||||
{
|
||||
int res = 0;
|
||||
CURL *curl[NUM_HANDLES];
|
||||
CURL *curl[NUM_HANDLES] = {0};
|
||||
int running;
|
||||
CURLM *m = NULL;
|
||||
int i;
|
||||
char target_url[256];
|
||||
char dnsentry[256];
|
||||
struct curl_slist *slist = NULL;
|
||||
struct curl_slist *slist = NULL, *slist2;
|
||||
char *port = libtest_arg3;
|
||||
char *address = libtest_arg2;
|
||||
|
||||
@ -48,12 +48,14 @@ int test(char *URL)
|
||||
for(i=0; i < NUM_HANDLES; i++) {
|
||||
sprintf(dnsentry, "server%d.example.com:%s:%s", i + 1, port, address);
|
||||
printf("%s\n", dnsentry);
|
||||
slist = curl_slist_append(slist, dnsentry);
|
||||
slist2 = curl_slist_append(slist, dnsentry);
|
||||
if(!slist2) {
|
||||
fprintf(stderr, "curl_slist_append() failed\n");
|
||||
goto test_cleanup;
|
||||
}
|
||||
slist = slist2;
|
||||
}
|
||||
|
||||
for(i=0; i < NUM_HANDLES; i++)
|
||||
curl[i] = NULL;
|
||||
|
||||
start_test_timing();
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
@ -63,21 +63,18 @@ static long tvdiff(struct timeval newer, struct timeval older)
|
||||
|
||||
int test(char *URL)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLM *mcurl;
|
||||
int res = 0;
|
||||
CURL *curl = NULL;
|
||||
CURLM *mcurl = NULL;
|
||||
int still_running = 1;
|
||||
struct timeval mp_start;
|
||||
struct curl_slist* rcpt_list = NULL;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl)
|
||||
return 1;
|
||||
easy_init(curl);
|
||||
|
||||
mcurl = curl_multi_init();
|
||||
if(!mcurl)
|
||||
return 2;
|
||||
multi_init(mcurl);
|
||||
|
||||
rcpt_list = curl_slist_append(rcpt_list, RECIPIENT);
|
||||
/* more addresses can be added here
|
||||
@ -94,7 +91,7 @@ int test(char *URL)
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, MAILFROM);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list);
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
|
||||
curl_multi_add_handle(mcurl, curl);
|
||||
multi_add_handle(mcurl, curl);
|
||||
|
||||
mp_start = tvnow();
|
||||
|
||||
@ -157,12 +154,15 @@ int test(char *URL)
|
||||
}
|
||||
}
|
||||
|
||||
test_cleanup:
|
||||
|
||||
curl_slist_free_all(rcpt_list);
|
||||
curl_multi_remove_handle(mcurl, curl);
|
||||
curl_multi_cleanup(mcurl);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
return 0;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ int test(char *URL)
|
||||
int i;
|
||||
char target_url[256];
|
||||
char dnsentry[256];
|
||||
struct curl_slist *slist = NULL;
|
||||
struct curl_slist *slist = NULL, *slist2;
|
||||
char *port = libtest_arg3;
|
||||
char *address = libtest_arg2;
|
||||
|
||||
@ -46,7 +46,12 @@ int test(char *URL)
|
||||
for(i=0; i < NUM_URLS; i++) {
|
||||
sprintf(dnsentry, "server%d.example.com:%s:%s", i + 1, port, address);
|
||||
printf("%s\n", dnsentry);
|
||||
slist = curl_slist_append(slist, dnsentry);
|
||||
slist2 = curl_slist_append(slist, dnsentry);
|
||||
if(!slist2) {
|
||||
fprintf(stderr, "curl_slist_append() failed\n");
|
||||
goto test_cleanup;
|
||||
}
|
||||
slist = slist2;
|
||||
}
|
||||
|
||||
start_test_timing();
|
||||
|
Loading…
x
Reference in New Issue
Block a user