mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
tests: Make sure libtests & unittests call curl_global_cleanup()
These were missed in commit c468c27b
.
This commit is contained in:
parent
09fc61e436
commit
d7d0c9d953
@ -148,6 +148,7 @@ int test(char *URL)
|
|||||||
test_cleanup:
|
test_cleanup:
|
||||||
|
|
||||||
curl_multi_cleanup(multi);
|
curl_multi_cleanup(multi);
|
||||||
|
curl_global_cleanup();
|
||||||
|
|
||||||
return (int) res;
|
return (int) res;
|
||||||
}
|
}
|
||||||
|
@ -157,6 +157,7 @@ int test(char *URL)
|
|||||||
struct curl_tlssessioninfo *tlssession;
|
struct curl_tlssessioninfo *tlssession;
|
||||||
CURLcode res = CURLE_OK;
|
CURLcode res = CURLE_OK;
|
||||||
(void)URL; /* not used */
|
(void)URL; /* not used */
|
||||||
|
global_init(CURL_GLOBAL_ALL);
|
||||||
easy_init(dep);
|
easy_init(dep);
|
||||||
easy_init(curl);
|
easy_init(curl);
|
||||||
share = curl_share_init();
|
share = curl_share_init();
|
||||||
@ -296,6 +297,7 @@ test_cleanup:
|
|||||||
curl_easy_cleanup(curl);
|
curl_easy_cleanup(curl);
|
||||||
curl_easy_cleanup(dep);
|
curl_easy_cleanup(dep);
|
||||||
curl_share_cleanup(share);
|
curl_share_cleanup(share);
|
||||||
|
curl_global_cleanup();
|
||||||
|
|
||||||
return (int)res;
|
return (int)res;
|
||||||
}
|
}
|
||||||
|
@ -30,15 +30,19 @@ static struct Curl_easy *data;
|
|||||||
|
|
||||||
static CURLcode unit_setup(void)
|
static CURLcode unit_setup(void)
|
||||||
{
|
{
|
||||||
|
int res = CURLE_OK;
|
||||||
|
|
||||||
|
global_init(CURL_GLOBAL_ALL);
|
||||||
data = curl_easy_init();
|
data = curl_easy_init();
|
||||||
if(!data)
|
if(!data)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
return CURLE_OK;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unit_stop(void)
|
static void unit_stop(void)
|
||||||
{
|
{
|
||||||
curl_easy_cleanup(data);
|
curl_easy_cleanup(data);
|
||||||
|
curl_global_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITTEST_START
|
UNITTEST_START
|
||||||
|
@ -29,15 +29,19 @@ static struct Curl_easy *data;
|
|||||||
|
|
||||||
static CURLcode unit_setup(void)
|
static CURLcode unit_setup(void)
|
||||||
{
|
{
|
||||||
|
int res = CURLE_OK;
|
||||||
|
|
||||||
|
global_init(CURL_GLOBAL_ALL);
|
||||||
data = curl_easy_init();
|
data = curl_easy_init();
|
||||||
if(!data)
|
if(!data)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
return CURLE_OK;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unit_stop(void)
|
static void unit_stop(void)
|
||||||
{
|
{
|
||||||
curl_easy_cleanup(data);
|
curl_easy_cleanup(data);
|
||||||
|
curl_global_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BASE is just a define to make us fool around with decently large number so
|
/* BASE is just a define to make us fool around with decently large number so
|
||||||
|
@ -25,13 +25,17 @@ static CURL *hnd;
|
|||||||
|
|
||||||
static CURLcode unit_setup(void)
|
static CURLcode unit_setup(void)
|
||||||
{
|
{
|
||||||
return CURLE_OK;
|
int res = CURLE_OK;
|
||||||
|
|
||||||
|
global_init(CURL_GLOBAL_ALL);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unit_stop(void)
|
static void unit_stop(void)
|
||||||
{
|
{
|
||||||
if(hnd)
|
if(hnd)
|
||||||
curl_easy_cleanup(hnd);
|
curl_easy_cleanup(hnd);
|
||||||
|
curl_global_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct test {
|
struct test {
|
||||||
|
@ -28,13 +28,19 @@ static CURL *easy;
|
|||||||
|
|
||||||
static CURLcode unit_setup(void)
|
static CURLcode unit_setup(void)
|
||||||
{
|
{
|
||||||
|
int res = CURLE_OK;
|
||||||
|
|
||||||
|
global_init(CURL_GLOBAL_ALL);
|
||||||
easy = curl_easy_init();
|
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)
|
static void unit_stop(void)
|
||||||
{
|
{
|
||||||
curl_easy_cleanup(easy);
|
curl_easy_cleanup(easy);
|
||||||
|
curl_global_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITTEST_START
|
UNITTEST_START
|
||||||
|
@ -23,21 +23,28 @@
|
|||||||
|
|
||||||
#include "llist.h"
|
#include "llist.h"
|
||||||
|
|
||||||
|
static CURL *easy;
|
||||||
|
|
||||||
static CURLcode unit_setup(void)
|
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)
|
static void unit_stop(void)
|
||||||
{
|
{
|
||||||
|
curl_easy_cleanup(easy);
|
||||||
|
curl_global_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
UNITTEST_START
|
UNITTEST_START
|
||||||
int len;
|
int len;
|
||||||
char *esc;
|
char *esc;
|
||||||
CURL *easy = curl_easy_init();
|
|
||||||
abort_unless(easy, "out of memory");
|
|
||||||
|
|
||||||
esc = curl_easy_escape(easy, "", -1);
|
esc = curl_easy_escape(easy, "", -1);
|
||||||
fail_unless(esc == NULL, "negative string length can't work");
|
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);
|
esc = curl_easy_unescape(easy, "%41%41%41%41", -1, &len);
|
||||||
fail_unless(esc == NULL, "negative string length can't work");
|
fail_unless(esc == NULL, "negative string length can't work");
|
||||||
|
|
||||||
curl_easy_cleanup(easy);
|
|
||||||
|
|
||||||
UNITTEST_STOP
|
UNITTEST_STOP
|
||||||
|
@ -24,14 +24,23 @@
|
|||||||
#include "speedcheck.h"
|
#include "speedcheck.h"
|
||||||
#include "urldata.h"
|
#include "urldata.h"
|
||||||
|
|
||||||
|
static CURL *easy;
|
||||||
|
|
||||||
static CURLcode unit_setup(void)
|
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)
|
static void unit_stop(void)
|
||||||
{
|
{
|
||||||
|
curl_easy_cleanup(easy);
|
||||||
|
curl_global_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int runawhile(struct Curl_easy *easy,
|
static int runawhile(struct Curl_easy *easy,
|
||||||
@ -66,10 +75,6 @@ static int runawhile(struct Curl_easy *easy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
UNITTEST_START
|
UNITTEST_START
|
||||||
{
|
|
||||||
struct Curl_easy *easy = curl_easy_init();
|
|
||||||
abort_unless(easy, "out of memory");
|
|
||||||
|
|
||||||
fail_unless(runawhile(easy, 41, 41, 40, 0) == 41,
|
fail_unless(runawhile(easy, 41, 41, 40, 0) == 41,
|
||||||
"wrong low speed timeout");
|
"wrong low speed timeout");
|
||||||
fail_unless(runawhile(easy, 21, 21, 20, 0) == 21,
|
fail_unless(runawhile(easy, 21, 21, 20, 0) == 21,
|
||||||
@ -82,9 +87,4 @@ UNITTEST_START
|
|||||||
"should not time out");
|
"should not time out");
|
||||||
fail_unless(runawhile(easy, 10, 50, 100, 2) == 36,
|
fail_unless(runawhile(easy, 10, 50, 100, 2) == 36,
|
||||||
"bad timeout");
|
"bad timeout");
|
||||||
|
|
||||||
curl_easy_cleanup(easy);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
UNITTEST_STOP
|
UNITTEST_STOP
|
||||||
|
Loading…
Reference in New Issue
Block a user