aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/data/Makefile.am2
-rw-r--r--tests/data/test5582
-rw-r--r--tests/data/test55944
-rw-r--r--tests/libtest/Makefile.am6
-rw-r--r--tests/libtest/lib558.c69
5 files changed, 88 insertions, 35 deletions
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 56e2ef6dc..4085a01e2 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -59,7 +59,7 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
test1064 test1065 test1066 test1067 test1068 test1069 test1070 test1071 \
test1072 test1073 test1074 test1075 test1076 test1077 test1078 test1079 \
test1080 test1081 test1082 test1083 test1084 test1085 test633 test634 \
- test635 test636 test637 test558
+ test635 test636 test637 test558 test559
filecheck:
@mkdir test-place; \
diff --git a/tests/data/test558 b/tests/data/test558
index 3844f3923..5b69ea027 100644
--- a/tests/data/test558
+++ b/tests/data/test558
@@ -20,7 +20,7 @@ lib558
</precheck>
<name>
-internal hash testing
+internal hash create/destroy testing
</name>
<command>
nothing
diff --git a/tests/data/test559 b/tests/data/test559
new file mode 100644
index 000000000..ecaf54c7e
--- /dev/null
+++ b/tests/data/test559
@@ -0,0 +1,44 @@
+<testcase>
+#
+# Server-side
+<reply>
+</reply>
+
+# Client-side
+<client>
+<server>
+none
+</server>
+# tool is what to use instead of 'curl'
+<tool>
+lib559
+</tool>
+# precheck is a command line to run before the test,
+# to see if we can execute the test or not
+<precheck>
+./libtest/lib559 check
+</precheck>
+
+<name>
+internal hash create/add/destroy testing
+</name>
+<command>
+nothing
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<stdout mode="text">
+easy handle init OK
+creating hash...
+hash creation OK
+destroying hash...
+hash destruction OK
+destroying easy handle...
+easy handle destruction OK
+</stdout>
+</verify>
+
+</testcase>
diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am
index 0801b4ef9..ce700bd58 100644
--- a/tests/libtest/Makefile.am
+++ b/tests/libtest/Makefile.am
@@ -53,7 +53,7 @@ noinst_PROGRAMS = lib500 lib501 lib502 lib503 lib504 lib505 lib506 \
lib517 lib518 lib519 lib520 lib521 lib523 lib524 lib525 lib526 lib527 \
lib529 lib530 lib532 lib533 lib536 lib537 lib540 lib541 lib542 lib543 \
lib544 lib545 lib547 lib548 lib549 lib552 lib553 lib554 lib555 lib556 \
- lib539 lib557 lib558
+ lib539 lib557 lib558 lib559
# Dependencies (may need to be overriden)
LDADD = $(LIBDIR)/libcurl.la
@@ -164,3 +164,7 @@ lib556_SOURCES = lib556.c $(SUPPORTFILES)
lib557_SOURCES = lib557.c $(SUPPORTFILES)
lib558_SOURCES = lib558.c $(SUPPORTFILES)
+lib526_CFLAGS = -DLIB558
+
+lib559_SOURCES = lib558.c $(SUPPORTFILES)
+lib526_CFLAGS = -DLIB559
diff --git a/tests/libtest/lib558.c b/tests/libtest/lib558.c
index f51243d21..f1095d45e 100644
--- a/tests/libtest/lib558.c
+++ b/tests/libtest/lib558.c
@@ -26,6 +26,7 @@
#include "memory.h"
#include "memdebug.h"
+/* This source file is used for test # 558 and 559 */
/*
* This hacky test bypasses the library external API,
@@ -38,7 +39,7 @@
#if !defined(CURL_HIDDEN_SYMBOLS)
-
+#ifdef LIB559
static Curl_addrinfo *fake_ai(void)
{
Curl_addrinfo *ai;
@@ -72,16 +73,13 @@ static Curl_addrinfo *fake_ai(void)
return ai;
}
+#endif /* LIB559 */
int test(char *URL)
{
CURL *easyh;
struct curl_hash *hp;
- char *data_key;
- struct Curl_dns_entry *data_node;
- struct Curl_dns_entry *nodep;
- size_t key_len;
if(!strcmp(URL, "check")) {
/* test harness script verifying if this test can run */
@@ -104,34 +102,41 @@ int test(char *URL)
fprintf(stdout, "hash creation OK\n");
/**/
-
- data_key = aprintf("%s:%d", "dummy", 0);
- if(!data_key) {
- fprintf(stdout, "data key creation failed\n");
- return TEST_ERR_MAJOR_BAD;
- }
- key_len = strlen(data_key);
-
- data_node = calloc(1, sizeof(struct Curl_dns_entry));
- if(!data_node) {
- fprintf(stdout, "data node creation failed\n");
- return TEST_ERR_MAJOR_BAD;
- }
-
- data_node->addr = fake_ai();
- if(!data_node->addr) {
- fprintf(stdout, "actual data creation failed\n");
- return TEST_ERR_MAJOR_BAD;
+#ifdef LIB559
+ {
+ char *data_key;
+ struct Curl_dns_entry *data_node;
+ struct Curl_dns_entry *nodep;
+ size_t key_len;
+
+ data_key = aprintf("%s:%d", "dummy", 0);
+ if(!data_key) {
+ fprintf(stdout, "data key creation failed\n");
+ return TEST_ERR_MAJOR_BAD;
+ }
+ key_len = strlen(data_key);
+
+ data_node = calloc(1, sizeof(struct Curl_dns_entry));
+ if(!data_node) {
+ fprintf(stdout, "data node creation failed\n");
+ return TEST_ERR_MAJOR_BAD;
+ }
+
+ data_node->addr = fake_ai();
+ if(!data_node->addr) {
+ fprintf(stdout, "actual data creation failed\n");
+ return TEST_ERR_MAJOR_BAD;
+ }
+
+ nodep = Curl_hash_add(hp, data_key, key_len+1, (void *)data_node);
+ if(!nodep) {
+ fprintf(stdout, "insertion into hash failed\n");
+ return TEST_ERR_MAJOR_BAD;
+ }
+
+ free(data_key);
}
-
- nodep = Curl_hash_add(hp, data_key, key_len+1, (void *)data_node);
- if(!nodep) {
- fprintf(stdout, "insertion into hash failed\n");
- return TEST_ERR_MAJOR_BAD;
- }
-
- free(data_key);
-
+#endif /* LIB559 */
/**/
fprintf(stdout, "destroying hash...\n");