[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 43/116: tests: Fixed torture tests on tests 556 and
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 43/116: tests: Fixed torture tests on tests 556 and 650 |
Date: |
Tue, 05 Dec 2017 14:51:13 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 591f5d18cf5cb56a14439c3a7af77a418a462984
Author: Dan Fandrich <address@hidden>
AuthorDate: Wed Nov 1 14:34:15 2017 +0100
tests: Fixed torture tests on tests 556 and 650
Test cleanup after OOM wasn't being consistently performed.
---
tests/libtest/lib556.c | 4 ++--
tests/libtest/lib650.c | 57 ++++++++++++++++++++++++++++++++++----------------
2 files changed, 41 insertions(+), 20 deletions(-)
diff --git a/tests/libtest/lib556.c b/tests/libtest/lib556.c
index f06c5299c..acb0f63d1 100644
--- a/tests/libtest/lib556.c
+++ b/tests/libtest/lib556.c
@@ -95,8 +95,8 @@ int test(char *URL)
} while((res == CURLE_OK && iolen != 0) || (res == CURLE_AGAIN));
}
- if(res != CURLE_OK || iolen != 0)
- return TEST_ERR_FAILURE;
+ if(iolen != 0)
+ res = TEST_ERR_FAILURE;
}
test_cleanup:
diff --git a/tests/libtest/lib650.c b/tests/libtest/lib650.c
index 60a2e9f1d..da1fd5672 100644
--- a/tests/libtest/lib650.c
+++ b/tests/libtest/lib650.c
@@ -33,7 +33,7 @@ static char data[] =
"this is what we post to the silly web server";
#endif
-static char name[] = "fieldname";
+static const char name[] = "fieldname";
/* This test attempts to use all form API features that are not
@@ -53,10 +53,10 @@ static size_t count_chars(void *userp, const char *buf,
size_t len)
int test(char *URL)
{
- CURL *curl;
- CURLcode res = CURLE_OK;
+ CURL *curl = NULL;
+ CURLcode res = TEST_ERR_MAJOR_BAD;
CURLFORMcode formrc;
- struct curl_slist *headers = NULL;
+ struct curl_slist *headers, *headers2 = NULL;
struct curl_httppost *formpost = NULL;
struct curl_httppost *lastptr = NULL;
struct curl_forms formarray[3];
@@ -69,17 +69,30 @@ int test(char *URL)
}
/* Check proper name and data copying, as well as headers. */
- headers = curl_slist_append(headers, "X-customheader-1: Header 1 data");
- headers = curl_slist_append(headers, "X-customheader-2: Header 2 data");
- headers = curl_slist_append(headers, "Content-Type: text/plain");
+ headers = curl_slist_append(NULL, "X-customheader-1: Header 1 data");
+ if(!headers) {
+ goto test_cleanup;
+ }
+ headers2 = curl_slist_append(headers, "X-customheader-2: Header 2 data");
+ if(!headers2) {
+ goto test_cleanup;
+ }
+ headers = headers2;
+ headers2 = curl_slist_append(headers, "Content-Type: text/plain");
+ if(!headers2) {
+ goto test_cleanup;
+ }
+ headers = headers2;
formrc = curl_formadd(&formpost, &lastptr,
CURLFORM_COPYNAME, &name,
CURLFORM_COPYCONTENTS, &data,
CURLFORM_CONTENTHEADER, headers,
CURLFORM_END);
- if(formrc)
+ if(formrc) {
printf("curl_formadd(1) = %d\n", (int) formrc);
+ goto test_cleanup;
+ }
/* Use a form array for the non-copy test. */
formarray[0].option = CURLFORM_PTRCONTENTS;
@@ -96,8 +109,10 @@ int test(char *URL)
CURLFORM_FILENAME, "remotefile.txt",
CURLFORM_END);
- if(formrc)
+ if(formrc) {
printf("curl_formadd(2) = %d\n", (int) formrc);
+ goto test_cleanup;
+ }
/* Now change in-memory data to affect CURLOPT_PTRCONTENTS value.
Copied values (first field) must not be affected.
@@ -114,8 +129,10 @@ int test(char *URL)
CURLFORM_FILE, libtest_arg2,
CURLFORM_END);
- if(formrc)
+ if(formrc) {
printf("curl_formadd(3) = %d\n", (int) formrc);
+ goto test_cleanup;
+ }
/* Check data from file content. */
formrc = curl_formadd(&formpost,
@@ -124,8 +141,10 @@ int test(char *URL)
CURLFORM_FILECONTENT, libtest_arg2,
CURLFORM_END);
- if(formrc)
+ if(formrc) {
printf("curl_formadd(4) = %d\n", (int) formrc);
+ goto test_cleanup;
+ }
/* Measure the current form length.
* This is done before including stdin data because we want to reuse it
@@ -140,6 +159,10 @@ int test(char *URL)
CURLFORM_COPYNAME, "formlength",
CURLFORM_COPYCONTENTS, &flbuf,
CURLFORM_END);
+ if(formrc) {
+ printf("curl_formadd(5) = %d\n", (int) formrc);
+ goto test_cleanup;
+ }
/* Check stdin (may be problematic on some platforms). */
formrc = curl_formadd(&formpost,
@@ -147,17 +170,15 @@ int test(char *URL)
CURLFORM_COPYNAME, "standardinput",
CURLFORM_FILE, "-",
CURLFORM_END);
-
- if(formrc)
- printf("curl_formadd(5) = %d\n", (int) formrc);
+ if(formrc) {
+ printf("curl_formadd(6) = %d\n", (int) formrc);
+ goto test_cleanup;
+ }
curl = curl_easy_init();
if(!curl) {
fprintf(stderr, "curl_easy_init() failed\n");
- curl_slist_free_all(headers);
- curl_formfree(formpost);
- curl_global_cleanup();
- return TEST_ERR_MAJOR_BAD;
+ goto test_cleanup;
}
/* First set the URL that is about to receive our POST. */
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 36/116: runtests.pl: Fixed typo in message, (continued)
- [GNUnet-SVN] [gnurl] 36/116: runtests.pl: Fixed typo in message, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 37/116: mkhelp.pl: support reproducible build, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 55/116: travis: add a job with brotli enabled, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 63/116: connect: store IPv6 connection status after valid connection, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 32/116: timeval: use mach time on MacOS, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 47/116: curl: pass through [] in URLs instead of calling globbing error, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 72/116: curl_share_setopt: va_end was not called if conncache errors, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 14/116: transfer: Fix chunked-encoding upload bug, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 49/116: RELEASE-NOTES: synced with ee8016b3d, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 48/116: curl: speed up handling of many URLs, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 43/116: tests: Fixed torture tests on tests 556 and 650,
gnunet <=
- [GNUnet-SVN] [gnurl] 75/116: README.md: fixed layout, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 77/116: SMB: fix uninitialized local variable, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 27/116: RELEASE-NOTES: synced with f20cbac97, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 68/116: curl_share_setopt.3: document CURL_LOCK_DATA_CONNECT, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 52/116: HTTP: support multiple Content-Encodings, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 69/116: --interface: add support for Linux VRF, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 106/116: ssh: remove check for a NULL pointer (!), gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 92/116: http2: fix "Value stored to 'hdbuf' is never read" scan-build error, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 66/116: test1554: verify connection cache sharing, gnunet, 2017/12/05
- [GNUnet-SVN] [gnurl] 67/116: examples: add shared-connection-cache, gnunet, 2017/12/05