[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 41/254: tests: fixed OOM handling of unit tests to
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 41/254: tests: fixed OOM handling of unit tests to abort test |
Date: |
Sat, 17 Jun 2017 16:51:13 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to annotated tag gnurl-7.54.1
in repository gnurl.
commit 8089dcfc5d4b34b15cee1f1cc9b3124c0279d41b
Author: Dan Fandrich <address@hidden>
AuthorDate: Sun Apr 30 10:54:26 2017 +0200
tests: fixed OOM handling of unit tests to abort test
It's dangerous to continue to run the test when a memory alloc fails.
---
tests/unit/unit1600.c | 2 +-
tests/unit/unit1604.c | 4 ++--
tests/unit/unit1605.c | 3 ++-
tests/unit/unit1606.c | 1 +
4 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/tests/unit/unit1600.c b/tests/unit/unit1600.c
index f0f9cc1f4..af0ad8435 100644
--- a/tests/unit/unit1600.c
+++ b/tests/unit/unit1600.c
@@ -29,7 +29,7 @@ CURL *easy;
static CURLcode unit_setup(void)
{
easy = curl_easy_init();
- return CURLE_OK;
+ return easy ? CURLE_OK : CURLE_OUT_OF_MEMORY;
}
static void unit_stop(void)
diff --git a/tests/unit/unit1604.c b/tests/unit/unit1604.c
index 5f1ea9518..a7c2a2543 100644
--- a/tests/unit/unit1604.c
+++ b/tests/unit/unit1604.c
@@ -45,7 +45,7 @@ static void unit_stop(void)
static char *getflagstr(int flags)
{
char *buf = malloc(256);
- fail_unless(buf, "out of memory");
+ abort_unless(buf, "out of memory");
snprintf(buf, 256, "%s,%s,%s,%s",
((flags & SANITIZE_ALLOW_COLONS) ? "SANITIZE_ALLOW_COLONS" : ""),
((flags & SANITIZE_ALLOW_PATH) ? "SANITIZE_ALLOW_PATH" : ""),
@@ -57,7 +57,7 @@ static char *getflagstr(int flags)
static char *getcurlcodestr(int cc)
{
char *buf = malloc(256);
- fail_unless(buf, "out of memory");
+ abort_unless(buf, "out of memory");
snprintf(buf, 256, "%s (%d)",
(cc == SANITIZE_ERR_OK ? "SANITIZE_ERR_OK" :
cc == SANITIZE_ERR_BAD_ARGUMENT ? "SANITIZE_ERR_BAD_ARGUMENT" :
diff --git a/tests/unit/unit1605.c b/tests/unit/unit1605.c
index c807cb3f2..2fe3a5aca 100644
--- a/tests/unit/unit1605.c
+++ b/tests/unit/unit1605.c
@@ -34,9 +34,10 @@ static void unit_stop(void)
}
UNITTEST_START
- CURL *easy = curl_easy_init();
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");
diff --git a/tests/unit/unit1606.c b/tests/unit/unit1606.c
index fdc0ec381..7acba0325 100644
--- a/tests/unit/unit1606.c
+++ b/tests/unit/unit1606.c
@@ -69,6 +69,7 @@ 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");
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 108/254: test537: use correct variable type, (continued)
- [GNUnet-SVN] [gnurl] 108/254: test537: use correct variable type, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 103/254: buildconf: fix hang on IRIX, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 30/254: lib: remove unused code, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 102/254: opts: fix bad example formatting \n => \\n, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 86/254: curl: fix warning "comma at end of enumerator list", gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 61/254: failf: use private buffer, don't clobber receive buffer, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 92/254: runtests: use -R for random order, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 71/254: url: let CURLOPT_BUFFERSIZE realloc to smaller sizes too, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 42/254: unit1604: fixed compilation under Windows, broken in the previous commit, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 38/254: tests: added --remote-time tests for remaining protocols that support it, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 41/254: tests: fixed OOM handling of unit tests to abort test,
gnunet <=
- [GNUnet-SVN] [gnurl] 55/254: CURLOPT_BUFFERSIZE: 1024 bytes is now the minimum size, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 57/254: buffer_size: make sure it always has the correct size, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 105/254: asyn-thread: fix unused macro warnings, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 73/254: gtls: fixed a lingering BUFSIZE reference, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 70/254: BUFSIZE: rename to READBUFFER_*, make separate MASTERBUF_SIZE, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 149/254: cmdline-opts/write-out.d: s/-L/--location, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 99/254: runtests.pl: simplify the datacheck read section, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 44/254: http2: declare TU-local variables static, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 54/254: ftp: use private buffer for temp storage, not receive buffer, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 81/254: lib: fix compiler warnings, gnunet, 2017/06/17