aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-03-07 15:39:43 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-04-11 22:22:39 +0200
commitf73de32d469919478fba65b5f4fda6212dc730cd (patch)
tree81ca14e84a83ba488d01bf9bed08a559f1c17785 /tests/unit
parentebc055011045510bee71043fb6a3a0dac6dca42d (diff)
CURLOPT_DNS_USE_GLOBAL_CACHE: remove
Remove the code too. The functionality has been disabled in code since 7.62.0. Setting this option will from now on simply be ignored and have no function. Closes #3654
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/unit1607.c34
-rw-r--r--tests/unit/unit1609.c39
2 files changed, 29 insertions, 44 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) {
diff --git a/tests/unit/unit1609.c b/tests/unit/unit1609.c
index 865c9e459..8d9bc6526 100644
--- a/tests/unit/unit1609.c
+++ b/tests/unit/unit1609.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;
}
@@ -117,17 +101,15 @@ static const struct testcase tests[] = {
};
UNITTEST_START
+{
int i;
int testnum = sizeof(tests) / sizeof(struct testcase);
/* important: we setup cache outside of the loop
and also clean cache after the loop. In contrast,for example,
test 1607 sets up and cleans cache on each iteration. */
- Curl_hostcache_clean(easy, hostcache);
- easy->dns.hostcache = hostcache;
- easy->dns.hostcachetype = HCACHE_GLOBAL;
- 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;
@@ -135,6 +117,16 @@ 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;
+ }
+ /* 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)
@@ -205,6 +197,9 @@ UNITTEST_START
addr = addr->ai_next;
}
+ curl_easy_cleanup(easy);
+ Curl_hash_destroy(&multi->hostcache);
+ curl_multi_cleanup(multi);
curl_slist_free_all(list);
if(problem) {
@@ -212,7 +207,5 @@ UNITTEST_START
continue;
}
}
-
- Curl_hostcache_clean(easy, easy->dns.hostcache);
-
+}
UNITTEST_STOP