diff options
Diffstat (limited to 'tests/unit/unit1607.c')
-rw-r--r-- | tests/unit/unit1607.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/tests/unit/unit1607.c b/tests/unit/unit1607.c index 22c2e8482..6e40be707 100644 --- a/tests/unit/unit1607.c +++ b/tests/unit/unit1607.c @@ -31,12 +31,8 @@ bool getaddressinfo(struct sockaddr *sa, char *addr, long *port); #include "memdebug.h" /* LAST include file */ -static struct Curl_easy *easy; -static struct curl_hash *hostcache; - static void unit_stop(void) { - curl_easy_cleanup(easy); curl_global_cleanup(); } @@ -46,18 +42,6 @@ static CURLcode unit_setup(void) global_init(CURL_GLOBAL_ALL); - easy = curl_easy_init(); - if(!easy) { - curl_global_cleanup(); - return CURLE_OUT_OF_MEMORY; - } - - hostcache = Curl_global_host_cache_init(); - if(!hostcache) { - unit_stop(); - return CURLE_OUT_OF_MEMORY; - } - return res; } @@ -122,7 +106,7 @@ UNITTEST_START int i; int testnum = sizeof(tests) / sizeof(struct testcase); - for(i = 0; i < testnum; ++i, curl_easy_reset(easy)) { + for(i = 0; i < testnum; ++i) { int j; int addressnum = sizeof(tests[i].address) / sizeof(*tests[i].address); struct Curl_addrinfo *addr; @@ -130,10 +114,17 @@ UNITTEST_START struct curl_slist *list; void *entry_id; bool problem = false; + struct Curl_multi *multi; + struct Curl_easy *easy = curl_easy_init(); + if(!easy) { + curl_global_cleanup(); + return CURLE_OUT_OF_MEMORY; + } - Curl_hostcache_clean(easy, hostcache); - easy->dns.hostcache = hostcache; - easy->dns.hostcachetype = HCACHE_GLOBAL; + /* create a multi handle and add the easy handle to it so that the + hostcache is setup */ + multi = curl_multi_init(); + curl_multi_add_handle(multi, easy); list = curl_slist_append(NULL, tests[i].optval); if(!list) @@ -214,7 +205,8 @@ UNITTEST_START addr = addr->ai_next; } - Curl_hostcache_clean(easy, easy->dns.hostcache); + curl_easy_cleanup(easy); + curl_multi_cleanup(multi); curl_slist_free_all(list); if(problem) { |