[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 38/256: tests: Make sure libtests call curl_global_
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 38/256: tests: Make sure libtests call curl_global_cleanup() |
Date: |
Fri, 06 Oct 2017 19:42:09 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit c468c27b5a8abb8134b3f89439aaac45f37d22d7
Author: Dan Fandrich <address@hidden>
AuthorDate: Sat Aug 19 21:27:38 2017 +0200
tests: Make sure libtests call curl_global_cleanup()
This ensures that global data allocations are freed so Valgrind stays
happy. This was a problem with at least PolarSSL and mbedTLS.
---
tests/libtest/lib1531.c | 4 ++++
tests/libtest/lib1550.c | 13 ++++++++++---
tests/libtest/lib1551.c | 2 ++
tests/libtest/lib543.c | 12 ++++++++----
tests/libtest/lib552.c | 10 +++-------
tests/libtest/lib597.c | 5 +----
6 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/tests/libtest/lib1531.c b/tests/libtest/lib1531.c
index 287acd6c6..e203baba1 100644
--- a/tests/libtest/lib1531.c
+++ b/tests/libtest/lib1531.c
@@ -37,6 +37,9 @@ int test(char *URL)
int still_running; /* keep number of running handles */
CURLMsg *msg; /* for picking up messages with the transfer status */
int msgs_left; /* how many messages are left */
+ int res = CURLE_OK;
+
+ global_init(CURL_GLOBAL_ALL);
/* Allocate one CURL handle per transfer */
easy = curl_easy_init();
@@ -139,6 +142,7 @@ int test(char *URL)
/* Free the CURL handles */
curl_easy_cleanup(easy);
+ curl_global_cleanup();
return 0;
}
diff --git a/tests/libtest/lib1550.c b/tests/libtest/lib1550.c
index 94ee576ca..d3e17e4fe 100644
--- a/tests/libtest/lib1550.c
+++ b/tests/libtest/lib1550.c
@@ -27,13 +27,20 @@
int test(char *URL)
{
- CURLM *handle = curl_multi_init();
- const char *bl_servers[] = {"Microsoft-IIS/6.0", "nginx/0.8.54", NULL};
- const char *bl_sites[] = {"curl.haxx.se:443", "example.com:80", NULL};
+ CURLM *handle;
+ int res = CURLE_OK;
+ static const char * const bl_servers[] =
+ {"Microsoft-IIS/6.0", "nginx/0.8.54", NULL};
+ static const char * const bl_sites[] =
+ {"curl.haxx.se:443", "example.com:80", NULL};
+
+ global_init(CURL_GLOBAL_ALL);
+ handle = curl_multi_init();
(void)URL; /* unused */
curl_multi_setopt(handle, CURLMOPT_PIPELINING_SERVER_BL, bl_servers);
curl_multi_setopt(handle, CURLMOPT_PIPELINING_SITE_BL, bl_sites);
curl_multi_cleanup(handle);
+ curl_global_cleanup();
return 0;
}
diff --git a/tests/libtest/lib1551.c b/tests/libtest/lib1551.c
index 16e27275a..36ba75715 100644
--- a/tests/libtest/lib1551.c
+++ b/tests/libtest/lib1551.c
@@ -30,6 +30,7 @@ int test(char *URL)
CURL *curl;
CURLcode res = CURLE_OK;
+ global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, URL);
@@ -41,5 +42,6 @@ int test(char *URL)
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
+ curl_global_cleanup();
return (int)res;
}
diff --git a/tests/libtest/lib543.c b/tests/libtest/lib543.c
index 6d2532d12..957839f7a 100644
--- a/tests/libtest/lib543.c
+++ b/tests/libtest/lib543.c
@@ -27,15 +27,18 @@
int test(char *URL)
{
- unsigned char a[] = {0x9c, 0x26, 0x4b, 0x3d, 0x49, 0x4, 0xa1, 0x1,
- 0xe0, 0xd8, 0x7c, 0x20, 0xb7, 0xef, 0x53, 0x29, 0xfa,
- 0x1d, 0x57, 0xe1};
+ static const unsigned char a[] = {
+ 0x9c, 0x26, 0x4b, 0x3d, 0x49, 0x4, 0xa1, 0x1,
+ 0xe0, 0xd8, 0x7c, 0x20, 0xb7, 0xef, 0x53, 0x29, 0xfa,
+ 0x1d, 0x57, 0xe1};
CURL *easy;
int asize;
char *s;
+ CURLcode res = CURLE_OK;
(void)URL;
+ global_init(CURL_GLOBAL_ALL);
easy = curl_easy_init();
if(!easy) {
fprintf(stderr, "curl_easy_init() failed\n");
@@ -44,7 +47,7 @@ int test(char *URL)
asize = (int)sizeof(a);
- s = curl_easy_escape(easy, (char *)a, asize);
+ s = curl_easy_escape(easy, (const char *)a, asize);
if(s)
printf("%s\n", s);
@@ -53,6 +56,7 @@ int test(char *URL)
curl_free(s);
curl_easy_cleanup(easy);
+ curl_global_cleanup();
return 0;
}
diff --git a/tests/libtest/lib552.c b/tests/libtest/lib552.c
index 3a93dafaf..9cae45993 100644
--- a/tests/libtest/lib552.c
+++ b/tests/libtest/lib552.c
@@ -166,19 +166,15 @@ static curlioerr ioctl_callback(CURL *handle, int cmd,
void *clientp)
int test(char *URL)
{
CURL *curl;
- CURLcode res = CURLE_OUT_OF_MEMORY;
+ CURLcode res = CURLE_OK;
struct data config;
size_t i;
static const char fill[] = "test data";
config.trace_ascii = 1; /* enable ascii tracing */
- curl = curl_easy_init();
- if(!curl) {
- fprintf(stderr, "curl_easy_init() failed\n");
- curl_global_cleanup();
- return TEST_ERR_MAJOR_BAD;
- }
+ global_init(CURL_GLOBAL_ALL);
+ easy_init(curl);
test_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace);
test_setopt(curl, CURLOPT_DEBUGDATA, &config);
diff --git a/tests/libtest/lib597.c b/tests/libtest/lib597.c
index 813af7541..bace92cbe 100644
--- a/tests/libtest/lib597.c
+++ b/tests/libtest/lib597.c
@@ -60,10 +60,7 @@ int test(char *URL)
start_test_timing();
- res_global_init(CURL_GLOBAL_ALL);
- if(res) {
- return res;
- }
+ global_init(CURL_GLOBAL_ALL);
easy_init(easy);
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 15/256: coverage: Use two coveralls commands to get lib/vtls results, (continued)
- [GNUnet-SVN] [gnurl] 15/256: coverage: Use two coveralls commands to get lib/vtls results, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 31/256: http: Don't wait on CONNECT when there is no proxy, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 24/256: ftp: fix CWD when doing multicwd then nocwd on same connection, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 26/256: cmake: sizeof curl_off_t, remove unused detections, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 28/256: lib557: no longer use CURL_SIZEOF_* defines, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 51/256: imap: support PREAUTH, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 32/256: curl/system.h: check for __ppc__ as well, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 34/256: http2_recv: return error better on fatal h2 errors, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 39/256: runtests: fixed case insensitive matching of keywords, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 41/256: curl/system.h: fix build for hppa, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 38/256: tests: Make sure libtests call curl_global_cleanup(),
gnunet <=
- [GNUnet-SVN] [gnurl] 53/256: imap: use defined names for response codes, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 33/256: KNOWN_BUGS: HTTP test server 'connection-monitor' problems, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 58/256: system.h: include sys/poll.h for AIX, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 48/256: config-dos: add missing defines, SIZEOF_* and two others, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 55/256: fuzz/Makefile.am: remove curlbuild.h leftovers, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 82/256: curl_ntlm_core: don't complain but #include OpenSSL header if needed, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 63/256: vtls: make sure all _data_pending() functions return bool, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 62/256: vtls: make sure all _cleanup() functions return void, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 91/256: version: if built with more than one SSL backend, report all of them, gnunet, 2017/10/06
- [GNUnet-SVN] [gnurl] 88/256: docs/examples: demonstrate how to select SSL backends, gnunet, 2017/10/06