]> granicus.if.org Git - curl/commitdiff
tests: Make sure libtests & unittests call curl_global_cleanup()
authorDan Fandrich <dan@coneharvesters.com>
Sat, 26 Aug 2017 20:01:42 +0000 (22:01 +0200)
committerDan Fandrich <dan@coneharvesters.com>
Sat, 26 Aug 2017 20:01:42 +0000 (22:01 +0200)
These were missed in commit c468c27b.

tests/libtest/lib1515.c
tests/libtest/mk-lib1521.pl
tests/unit/unit1302.c
tests/unit/unit1303.c
tests/unit/unit1396.c
tests/unit/unit1600.c
tests/unit/unit1605.c
tests/unit/unit1606.c

index c1499381aeed13e298b25825fcd94fcc813eed3b..4b41dc2e478501713ca626ea38363241a1fc6153 100644 (file)
@@ -148,6 +148,7 @@ int test(char *URL)
 test_cleanup:
 
   curl_multi_cleanup(multi);
+  curl_global_cleanup();
 
   return (int) res;
 }
index e60bce5cc878cf09087ad7442243c4ddda540204..f5c68eb100c5a73b51a7e6cecce21058789b93da 100644 (file)
@@ -157,6 +157,7 @@ int test(char *URL)
   struct curl_tlssessioninfo *tlssession;
   CURLcode res = CURLE_OK;
   (void)URL; /* not used */
+  global_init(CURL_GLOBAL_ALL);
   easy_init(dep);
   easy_init(curl);
   share = curl_share_init();
@@ -296,6 +297,7 @@ test_cleanup:
   curl_easy_cleanup(curl);
   curl_easy_cleanup(dep);
   curl_share_cleanup(share);
+  curl_global_cleanup();
 
   return (int)res;
 }
index 8dae5aad1150f93e80781cfced543c1c81cb805e..e6f94b24e071233a1087c37c8019469f350efbc9 100644 (file)
@@ -30,15 +30,19 @@ static struct Curl_easy *data;
 
 static CURLcode unit_setup(void)
 {
+  int res = CURLE_OK;
+
+  global_init(CURL_GLOBAL_ALL);
   data = curl_easy_init();
   if(!data)
     return CURLE_OUT_OF_MEMORY;
-  return CURLE_OK;
+  return res;
 }
 
 static void unit_stop(void)
 {
   curl_easy_cleanup(data);
+  curl_global_cleanup();
 }
 
 UNITTEST_START
index 143ccd034ed7d36d17d7009d5d5d22847eaae0e4..13fb0e05ce3e22fbcedd2e02890867276eb82eb1 100644 (file)
@@ -29,15 +29,19 @@ static struct Curl_easy *data;
 
 static CURLcode unit_setup(void)
 {
+  int res = CURLE_OK;
+
+  global_init(CURL_GLOBAL_ALL);
   data = curl_easy_init();
   if(!data)
     return CURLE_OUT_OF_MEMORY;
-  return CURLE_OK;
+  return res;
 }
 
 static void unit_stop(void)
 {
   curl_easy_cleanup(data);
+  curl_global_cleanup();
 }
 
 /* BASE is just a define to make us fool around with decently large number so
index f3275fdb6926ea5a031a7a57362d6db69577eaa2..9fba1f634dad51097887b4aca26c3e94f3b90f87 100644 (file)
@@ -25,13 +25,17 @@ static CURL *hnd;
 
 static CURLcode unit_setup(void)
 {
-  return CURLE_OK;
+  int res = CURLE_OK;
+
+  global_init(CURL_GLOBAL_ALL);
+  return res;
 }
 
 static void unit_stop(void)
 {
   if(hnd)
     curl_easy_cleanup(hnd);
+  curl_global_cleanup();
 }
 
 struct test {
index 11d718d3543df24b728249ffebc1750b41edd41f..190cf0f0a59c07b1a07e5f976296105874bd2a59 100644 (file)
@@ -28,13 +28,19 @@ static CURL *easy;
 
 static CURLcode unit_setup(void)
 {
+  int res = CURLE_OK;
+
+  global_init(CURL_GLOBAL_ALL);
   easy = curl_easy_init();
-  return easy ? CURLE_OK : CURLE_OUT_OF_MEMORY;
+  if(!easy)
+    return CURLE_OUT_OF_MEMORY;
+  return res;
 }
 
 static void unit_stop(void)
 {
   curl_easy_cleanup(easy);
+  curl_global_cleanup();
 }
 
 UNITTEST_START
index 2fe3a5acab657cb0da9372da275decb9391c867f..57a9199c5e987a4ed3a11c1b2620d625d2007294 100644 (file)
 
 #include "llist.h"
 
+static CURL *easy;
+
 static CURLcode unit_setup(void)
 {
-  return CURLE_OK;
+  int res = CURLE_OK;
+
+  global_init(CURL_GLOBAL_ALL);
+  easy = curl_easy_init();
+  if(!easy)
+    return CURLE_OUT_OF_MEMORY;
+  return res;
 }
 
 static void unit_stop(void)
 {
-
+  curl_easy_cleanup(easy);
+  curl_global_cleanup();
 }
 
 UNITTEST_START
   int len;
   char *esc;
-  CURL *easy = curl_easy_init();
-  abort_unless(easy, "out of memory");
 
   esc = curl_easy_escape(easy, "", -1);
   fail_unless(esc == NULL, "negative string length can't work");
@@ -45,6 +52,4 @@ UNITTEST_START
   esc = curl_easy_unescape(easy, "%41%41%41%41", -1, &len);
   fail_unless(esc == NULL, "negative string length can't work");
 
-  curl_easy_cleanup(easy);
-
 UNITTEST_STOP
index eca8f3c382558470c311c28e42a4fcdd62a3dbba..df9c89ced39baf20a5d40bedbe81843cdf3f02d3 100644 (file)
 #include "speedcheck.h"
 #include "urldata.h"
 
+static CURL *easy;
+
 static CURLcode unit_setup(void)
 {
-  return CURLE_OK;
+  int res = CURLE_OK;
+
+  global_init(CURL_GLOBAL_ALL);
+  easy = curl_easy_init();
+  if(!easy)
+    return CURLE_OUT_OF_MEMORY;
+  return res;
 }
 
 static void unit_stop(void)
 {
-
+  curl_easy_cleanup(easy);
+  curl_global_cleanup();
 }
 
 static int runawhile(struct Curl_easy *easy,
@@ -66,10 +75,6 @@ static int runawhile(struct Curl_easy *easy,
 }
 
 UNITTEST_START
-{
-  struct Curl_easy *easy = curl_easy_init();
-  abort_unless(easy, "out of memory");
-
   fail_unless(runawhile(easy, 41, 41, 40, 0) == 41,
               "wrong low speed timeout");
   fail_unless(runawhile(easy, 21, 21, 20, 0) == 21,
@@ -82,9 +87,4 @@ UNITTEST_START
               "should not time out");
   fail_unless(runawhile(easy, 10, 50, 100, 2) == 36,
               "bad timeout");
-
-  curl_easy_cleanup(easy);
-
-  return 0;
-}
 UNITTEST_STOP