summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBrian Aker <brian@tangent.org>2013-10-11 05:19:52 -0700
committerBrian Aker <brian@tangent.org>2013-10-11 05:19:52 -0700
commitacac711318a06661a8866f7e970a199fa21d4d83 (patch)
tree3817b4b10fbee6edb76bd228d40a7135020b2544 /tests
parentcb732fbfe29edb687a5380f8336ef69227469b08 (diff)
parent95bb4cd1ce48756ca12e5cc1bb6bd6ff8f457908 (diff)
downloadlibmemcached-acac711318a06661a8866f7e970a199fa21d4d83.tar.gz
Merge of 1.0
Diffstat (limited to 'tests')
-rw-r--r--tests/cli.am9
-rw-r--r--tests/libmemcached-1.0/all_tests.h6
-rw-r--r--tests/libmemcached-1.0/mem_functions.cc136
-rw-r--r--tests/libmemcached-1.0/mem_functions.h2
-rw-r--r--tests/libmemcached-1.0/plus.cpp7
-rw-r--r--tests/libmemcached_world.h2
-rw-r--r--tests/libmemcached_world_socket.h3
-rw-r--r--tests/memcat.cc12
-rw-r--r--tests/memcp.cc4
-rw-r--r--tests/memdump.cc21
-rw-r--r--tests/memexist.cc16
-rw-r--r--tests/memping.cc4
-rw-r--r--tests/memrm.cc4
-rw-r--r--tests/memtouch.cc14
14 files changed, 153 insertions, 87 deletions
diff --git a/tests/cli.am b/tests/cli.am
index df206e5c..1bb9a6a9 100644
--- a/tests/cli.am
+++ b/tests/cli.am
@@ -122,3 +122,12 @@ valgrind-memerror: tests/memerror
valgrind-memtouch: tests/memtouch
@$(VALGRIND_COMMAND) tests/memtouch
+
+test-memdump: tests/memdump
+ tests/memdump
+
+gdb-memdump: tests/memdump
+ @$(GDB_COMMAND) tests/memdump
+
+valgrind-memdump: tests/memdump
+ @$(VALGRIND_COMMAND) tests/memdump
diff --git a/tests/libmemcached-1.0/all_tests.h b/tests/libmemcached-1.0/all_tests.h
index 2012d477..d748d39e 100644
--- a/tests/libmemcached-1.0/all_tests.h
+++ b/tests/libmemcached-1.0/all_tests.h
@@ -70,9 +70,11 @@ test_st tests[] ={
{"partial mget", false, (test_callback_fn*)get_test5 },
{"stats_servername", false, (test_callback_fn*)stats_servername_test },
{"increment", false, (test_callback_fn*)increment_test },
- {"increment_with_initial", true, (test_callback_fn*)increment_with_initial_test },
+ {"memcached_increment_with_initial(0)", true, (test_callback_fn*)increment_with_initial_test },
+ {"memcached_increment_with_initial(999)", true, (test_callback_fn*)increment_with_initial_999_test },
{"decrement", false, (test_callback_fn*)decrement_test },
- {"decrement_with_initial", true, (test_callback_fn*)decrement_with_initial_test },
+ {"memcached_decrement_with_initial(3)", true, (test_callback_fn*)decrement_with_initial_test },
+ {"memcached_decrement_with_initial(999)", true, (test_callback_fn*)decrement_with_initial_999_test },
{"increment_by_key", false, (test_callback_fn*)increment_by_key_test },
{"increment_with_initial_by_key", true, (test_callback_fn*)increment_with_initial_by_key_test },
{"decrement_by_key", false, (test_callback_fn*)decrement_by_key_test },
diff --git a/tests/libmemcached-1.0/mem_functions.cc b/tests/libmemcached-1.0/mem_functions.cc
index 03b85024..56d482d2 100644
--- a/tests/libmemcached-1.0/mem_functions.cc
+++ b/tests/libmemcached-1.0/mem_functions.cc
@@ -994,6 +994,7 @@ test_return_t bad_key_test(memcached_st *memc)
test_compare(MEMCACHED_SUCCESS,
memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, true));
test_compare(query_id, memcached_query_id(memc_clone)); // We should not increase the query_id for memcached_behavior_set()
+ ASSERT_TRUE(memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY));
/* All keys are valid in the binary protocol (except for length) */
if (memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == false)
@@ -1295,26 +1296,41 @@ test_return_t increment_test(memcached_st *memc)
return TEST_SUCCESS;
}
-test_return_t increment_with_initial_test(memcached_st *memc)
+static test_return_t __increment_with_initial_test(memcached_st *memc, uint64_t initial)
{
- test_skip(true, memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL));
-
uint64_t new_number;
- uint64_t initial= 0;
test_compare(MEMCACHED_SUCCESS, memcached_flush_buffers(memc));
- test_compare(MEMCACHED_SUCCESS,
- memcached_increment_with_initial(memc, test_literal_param("number"), 1, initial, 0, &new_number));
- test_compare(new_number, initial);
+ if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL))
+ {
+ test_compare(MEMCACHED_SUCCESS,
+ memcached_increment_with_initial(memc, test_literal_param("number"), 1, initial, 0, &new_number));
+ test_compare(new_number, initial);
- test_compare(MEMCACHED_SUCCESS,
- memcached_increment_with_initial(memc, test_literal_param("number"), 1, initial, 0, &new_number));
- test_compare(new_number, (initial +1));
+ test_compare(MEMCACHED_SUCCESS,
+ memcached_increment_with_initial(memc, test_literal_param("number"), 1, initial, 0, &new_number));
+ test_compare(new_number, (initial +1));
+ }
+ else
+ {
+ test_compare(MEMCACHED_INVALID_ARGUMENTS,
+ memcached_increment_with_initial(memc, test_literal_param("number"), 1, initial, 0, &new_number));
+ }
return TEST_SUCCESS;
}
+test_return_t increment_with_initial_test(memcached_st *memc)
+{
+ return __increment_with_initial_test(memc, 0);
+}
+
+test_return_t increment_with_initial_999_test(memcached_st *memc)
+{
+ return __increment_with_initial_test(memc, 999);
+}
+
test_return_t decrement_test(memcached_st *memc)
{
test_compare(return_value_based_on_buffering(memc),
@@ -1342,12 +1358,10 @@ test_return_t decrement_test(memcached_st *memc)
return TEST_SUCCESS;
}
-test_return_t decrement_with_initial_test(memcached_st *memc)
+static test_return_t __decrement_with_initial_test(memcached_st *memc, uint64_t initial)
{
test_skip(true, memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL));
- uint64_t initial= 3;
-
test_compare(MEMCACHED_SUCCESS, memcached_flush_buffers(memc));
uint64_t new_number;
@@ -1368,6 +1382,16 @@ test_return_t decrement_with_initial_test(memcached_st *memc)
return TEST_SUCCESS;
}
+test_return_t decrement_with_initial_test(memcached_st *memc)
+{
+ return __decrement_with_initial_test(memc, 3);
+}
+
+test_return_t decrement_with_initial_999_test(memcached_st *memc)
+{
+ return __decrement_with_initial_test(memc, 999);
+}
+
test_return_t increment_by_key_test(memcached_st *memc)
{
const char *master_key= "foo";
@@ -1399,24 +1423,32 @@ test_return_t increment_by_key_test(memcached_st *memc)
test_return_t increment_with_initial_by_key_test(memcached_st *memc)
{
- test_skip(true, memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL));
-
uint64_t new_number;
const char *master_key= "foo";
const char *key= "number";
uint64_t initial= 0;
- test_compare(MEMCACHED_SUCCESS,
- memcached_increment_with_initial_by_key(memc, master_key, strlen(master_key),
- key, strlen(key),
- 1, initial, 0, &new_number));
- test_compare(new_number, initial);
+ if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL))
+ {
+ test_compare(MEMCACHED_SUCCESS,
+ memcached_increment_with_initial_by_key(memc, master_key, strlen(master_key),
+ key, strlen(key),
+ 1, initial, 0, &new_number));
+ test_compare(new_number, initial);
- test_compare(MEMCACHED_SUCCESS,
- memcached_increment_with_initial_by_key(memc, master_key, strlen(master_key),
- key, strlen(key),
- 1, initial, 0, &new_number));
- test_compare(new_number, (initial +1));
+ test_compare(MEMCACHED_SUCCESS,
+ memcached_increment_with_initial_by_key(memc, master_key, strlen(master_key),
+ key, strlen(key),
+ 1, initial, 0, &new_number));
+ test_compare(new_number, (initial +1));
+ }
+ else
+ {
+ test_compare(MEMCACHED_INVALID_ARGUMENTS,
+ memcached_increment_with_initial_by_key(memc, master_key, strlen(master_key),
+ key, strlen(key),
+ 1, initial, 0, &new_number));
+ }
return TEST_SUCCESS;
}
@@ -1457,19 +1489,30 @@ test_return_t decrement_with_initial_by_key_test(memcached_st *memc)
uint64_t new_number;
uint64_t initial= 3;
- test_compare(MEMCACHED_SUCCESS,
- memcached_decrement_with_initial_by_key(memc,
- test_literal_param("foo"),
- test_literal_param("number"),
- 1, initial, 0, &new_number));
- test_compare(new_number, initial);
+ if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL))
+ {
+ test_compare(MEMCACHED_SUCCESS,
+ memcached_decrement_with_initial_by_key(memc,
+ test_literal_param("foo"),
+ test_literal_param("number"),
+ 1, initial, 0, &new_number));
+ test_compare(new_number, initial);
- test_compare(MEMCACHED_SUCCESS,
- memcached_decrement_with_initial_by_key(memc,
- test_literal_param("foo"),
- test_literal_param("number"),
- 1, initial, 0, &new_number));
- test_compare(new_number, (initial - 1));
+ test_compare(MEMCACHED_SUCCESS,
+ memcached_decrement_with_initial_by_key(memc,
+ test_literal_param("foo"),
+ test_literal_param("number"),
+ 1, initial, 0, &new_number));
+ test_compare(new_number, (initial - 1));
+ }
+ else
+ {
+ test_compare(MEMCACHED_INVALID_ARGUMENTS,
+ memcached_decrement_with_initial_by_key(memc,
+ test_literal_param("foo"),
+ test_literal_param("number"),
+ 1, initial, 0, &new_number));
+ }
return TEST_SUCCESS;
}
@@ -3040,7 +3083,7 @@ test_return_t selection_of_namespace_tests(memcached_st *memc)
const char *key= "mine";
char *value;
- /* Make sure be default none exists */
+ /* Make sure by default none exists */
value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
test_null(value);
test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));
@@ -3051,7 +3094,7 @@ test_return_t selection_of_namespace_tests(memcached_st *memc)
value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
test_true(value);
- test_memcmp(value, key, 4);
+ test_memcmp(value, key, strlen(key));
test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));
/* Test that we can turn it off */
@@ -3069,7 +3112,7 @@ test_return_t selection_of_namespace_tests(memcached_st *memc)
value= (char *)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
test_true(value);
test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));
- test_memcmp(value, key, 4);
+ test_memcmp(value, key, strlen(key));
/* Set to Zero, and then Set to something too large */
{
@@ -3079,9 +3122,7 @@ test_return_t selection_of_namespace_tests(memcached_st *memc)
test_compare(MEMCACHED_SUCCESS,
memcached_callback_set(memc, MEMCACHED_CALLBACK_NAMESPACE, NULL));
- value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
- test_null(value);
- test_compare(MEMCACHED_SUCCESS, rc);
+ ASSERT_NULL_(memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc), "Setting namespace to NULL did not work");
/* Test a long key for failure */
/* TODO, extend test to determine based on setting, what result should be */
@@ -3109,11 +3150,10 @@ test_return_t set_namespace(memcached_st *memc)
{
memcached_return_t rc;
const char *key= "mine";
- char *value;
// Make sure we default to a null namespace
- value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
- test_null(value);
+ char* value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
+ ASSERT_NULL_(value, "memc had a value for namespace when none should exist");
test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));
/* Test a clean set */
@@ -3121,8 +3161,8 @@ test_return_t set_namespace(memcached_st *memc)
memcached_callback_set(memc, MEMCACHED_CALLBACK_NAMESPACE, (void *)key));
value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
- test_true(value);
- test_memcmp(value, key, 4);
+ ASSERT_TRUE(value);
+ test_memcmp(value, key, strlen(key));
test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));
return TEST_SUCCESS;
diff --git a/tests/libmemcached-1.0/mem_functions.h b/tests/libmemcached-1.0/mem_functions.h
index 9edc820e..75736931 100644
--- a/tests/libmemcached-1.0/mem_functions.h
+++ b/tests/libmemcached-1.0/mem_functions.h
@@ -67,6 +67,7 @@ test_return_t decrement_by_key_test(memcached_st *memc);
test_return_t decrement_test(memcached_st *memc);
test_return_t decrement_with_initial_by_key_test(memcached_st *memc);
test_return_t decrement_with_initial_test(memcached_st *memc);
+test_return_t decrement_with_initial_999_test(memcached_st *memc);
test_return_t delete_test(memcached_st *memc);
test_return_t deprecated_set_memory_alloc(memcached_st *memc);
test_return_t enable_cas(memcached_st *memc);
@@ -88,6 +89,7 @@ test_return_t increment_by_key_test(memcached_st *memc);
test_return_t increment_test(memcached_st *memc);
test_return_t increment_with_initial_by_key_test(memcached_st *memc);
test_return_t increment_with_initial_test(memcached_st *memc);
+test_return_t increment_with_initial_999_test(memcached_st *memc);
test_return_t init_test(memcached_st *not_used);
test_return_t jenkins_run (memcached_st *);
test_return_t key_setup(memcached_st *memc);
diff --git a/tests/libmemcached-1.0/plus.cpp b/tests/libmemcached-1.0/plus.cpp
index 3079b9b3..1017a7c4 100644
--- a/tests/libmemcached-1.0/plus.cpp
+++ b/tests/libmemcached-1.0/plus.cpp
@@ -181,6 +181,13 @@ static test_return_t mget_test(memcached_st *original)
vector<char> return_value;
/* We need to empty the server before we continue the test */
+ bool flush_res= memc.flush();
+ if (flush_res == false)
+ {
+ std::string error_string;
+ ASSERT_TRUE(memc.error(error_string));
+ Error << error_string;
+ }
test_true(memc.flush());
test_true(memc.mget(keys));
diff --git a/tests/libmemcached_world.h b/tests/libmemcached_world.h
index 8cf84c6e..52f1d942 100644
--- a/tests/libmemcached_world.h
+++ b/tests/libmemcached_world.h
@@ -87,12 +87,14 @@ static void *world_create(libtest::server_startup_st& servers, test_return_t& er
static bool world_destroy(void *object)
{
libmemcached_test_container_st *container= (libmemcached_test_container_st *)object;
+#if 0
#if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT
if (LIBMEMCACHED_WITH_SASL_SUPPORT)
{
sasl_done();
}
#endif
+#endif
delete container;
diff --git a/tests/libmemcached_world_socket.h b/tests/libmemcached_world_socket.h
index 64cf55e5..69f0a91b 100644
--- a/tests/libmemcached_world_socket.h
+++ b/tests/libmemcached_world_socket.h
@@ -75,12 +75,15 @@ static void *world_create(libtest::server_startup_st& servers, test_return_t& er
static bool world_destroy(void *object)
{
libmemcached_test_container_st *container= (libmemcached_test_container_st *)object;
+
+#if 0
#if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT
if (LIBMEMCACHED_WITH_SASL_SUPPORT)
{
sasl_done();
}
#endif
+#endif
delete container;
diff --git a/tests/memcat.cc b/tests/memcat.cc
index e019bc9b..388ff414 100644
--- a/tests/memcat.cc
+++ b/tests/memcat.cc
@@ -64,10 +64,10 @@ static test_return_t help_test(void *)
static test_return_t cat_test(void *)
{
char buffer[1024];
- snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
+ int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
const char *args[]= { buffer, "foo", 0 };
- memcached_st *memc= memcached(buffer, strlen(buffer));
+ memcached_st *memc= memcached(buffer, length);
test_true(memc);
test_compare(MEMCACHED_SUCCESS,
@@ -77,6 +77,7 @@ static test_return_t cat_test(void *)
test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));
test_compare(MEMCACHED_SUCCESS, rc);
+ snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));
test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));
@@ -90,11 +91,11 @@ static test_return_t cat_test(void *)
static test_return_t NOT_FOUND_test(void *)
{
char buffer[1024];
- snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
+ int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
const char *args[]= { buffer, "foo", 0 };
- memcached_st *memc= memcached(buffer, strlen(buffer));
- test_true(memc);
+ memcached_st *memc= memcached(buffer, length);
+ ASSERT_TRUE(memc);
test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0));
@@ -102,6 +103,7 @@ static test_return_t NOT_FOUND_test(void *)
test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));
test_compare(MEMCACHED_NOTFOUND, rc);
+ snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true));
test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));
diff --git a/tests/memcp.cc b/tests/memcp.cc
index d49b1775..88389b40 100644
--- a/tests/memcp.cc
+++ b/tests/memcp.cc
@@ -63,6 +63,7 @@ static test_return_t help_test(void *)
return TEST_SUCCESS;
}
+#if 0
static test_return_t server_test(void *)
{
int fd;
@@ -82,10 +83,13 @@ static test_return_t server_test(void *)
return TEST_SUCCESS;
}
+#endif
test_st memcp_tests[] ={
{"--help", true, help_test },
+#if 0
{"--server_test", true, server_test },
+#endif
{0, 0, 0}
};
diff --git a/tests/memdump.cc b/tests/memdump.cc
index e55b2b99..cec73e99 100644
--- a/tests/memdump.cc
+++ b/tests/memdump.cc
@@ -75,10 +75,10 @@ static test_return_t server_test(void *)
static test_return_t FOUND_test(void *)
{
char buffer[1024];
- snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
+ int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
const char *args[]= { buffer, 0 };
- memcached_st *memc= memcached(buffer, strlen(buffer));
+ memcached_st *memc= memcached(buffer, length);
test_true(memc);
test_compare(MEMCACHED_SUCCESS,
@@ -91,6 +91,7 @@ static test_return_t FOUND_test(void *)
test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));
test_compare(MEMCACHED_SUCCESS, rc);
+ length= snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
test_true(exec_cmdline(executable, args, true) <= EXIT_FAILURE);
memcached_free(memc);
@@ -110,19 +111,11 @@ collection_st collection[] ={
{0, 0, 0, 0}
};
-static void *world_create(server_startup_st& servers, test_return_t& error)
+static void *world_create(server_startup_st& servers, test_return_t&)
{
- if (libtest::has_memcached() == false)
- {
- error= TEST_SKIPPED;
- return NULL;
- }
-
- if (server_startup(servers, "memcached", libtest::default_port(), NULL) == false)
- {
- error= TEST_FAILURE;
- return NULL;
- }
+ SKIP_UNLESS(libtest::has_memcached());
+
+ ASSERT_TRUE(server_startup(servers, "memcached", libtest::default_port(), NULL));
return &servers;
}
diff --git a/tests/memexist.cc b/tests/memexist.cc
index 98d224f7..9aa4a027 100644
--- a/tests/memexist.cc
+++ b/tests/memexist.cc
@@ -64,10 +64,10 @@ static test_return_t help_test(void *)
static test_return_t exist_test(void *)
{
char buffer[1024];
- snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
+ int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
const char *args[]= { buffer, "foo", 0 };
- memcached_st *memc= memcached(buffer, strlen(buffer));
+ memcached_st *memc= memcached(buffer, length);
test_true(memc);
test_compare(MEMCACHED_SUCCESS,
@@ -90,11 +90,11 @@ static test_return_t exist_test(void *)
static test_return_t NOT_FOUND_test(void *)
{
char buffer[1024];
- snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
+ int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
const char *args[]= { buffer, "foo", 0 };
- memcached_st *memc= memcached(buffer, strlen(buffer));
- test_true(memc);
+ memcached_st *memc= memcached(buffer, length);
+ ASSERT_TRUE(memc);
test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0));
@@ -115,9 +115,9 @@ static test_return_t NOT_FOUND_test(void *)
static test_return_t check_version(void*)
{
char buffer[1024];
- snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
- memcached_st *memc= memcached(buffer, strlen(buffer));
- test_true(memc);
+ int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
+ memcached_st *memc= memcached(buffer, length);
+ ASSERT_TRUE(memc);
test_return_t result= TEST_SUCCESS;
if (libmemcached_util_version_check(memc, 1, 4, 8) == false)
diff --git a/tests/memping.cc b/tests/memping.cc
index 6161611d..ef18292b 100644
--- a/tests/memping.cc
+++ b/tests/memping.cc
@@ -64,7 +64,7 @@ static test_return_t help_test(void *)
static test_return_t ping_TEST(void *)
{
char buffer[1024];
- snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
+ snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
const char *args[]= { buffer, 0 };
test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));
@@ -75,7 +75,7 @@ static test_return_t ping_TEST(void *)
static test_return_t NOT_FOUND_TEST(void *)
{
char buffer[1024];
- snprintf(buffer, sizeof(buffer), "--server=nonexist.libmemcached.org:%d", int(default_port()));
+ snprintf(buffer, sizeof(buffer), "--servers=nonexist.libmemcached.org:%d", int(default_port()));
const char *args[]= { buffer, 0 };
test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true));
diff --git a/tests/memrm.cc b/tests/memrm.cc
index acd24fc0..cda867c0 100644
--- a/tests/memrm.cc
+++ b/tests/memrm.cc
@@ -84,6 +84,8 @@ static test_return_t rm_test(void *)
test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));
test_compare(MEMCACHED_SUCCESS, rc);
+ char memrm_buffer[1024];
+ snprintf(memrm_buffer, sizeof(memrm_buffer), "--servers=localhost:%d", int(default_port()));
const char *args[]= { buffer, "foo", 0 };
test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));
@@ -121,7 +123,7 @@ static test_return_t NOT_FOUND_TEST(void *)
static test_return_t multiple_NOT_FOUND_TEST(void *)
{
char buffer[1024];
- snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
+ snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
const char *args[]= { buffer, "protocols", "foo", "mine", "bar", "dog", "cat", "foo", "mine",
"eye", "for", "the", "to", "not", "know", "what", "I", "should", "be", "doing", 0 };
diff --git a/tests/memtouch.cc b/tests/memtouch.cc
index 247e1870..07f427b3 100644
--- a/tests/memtouch.cc
+++ b/tests/memtouch.cc
@@ -65,9 +65,9 @@ static test_return_t help_test(void *)
static test_return_t touch_test(void *)
{
char buffer[1024];
- snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
+ int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
- memcached_st *memc= memcached(buffer, strlen(buffer));
+ memcached_st *memc= memcached(buffer, length);
test_true(memc);
test_compare(MEMCACHED_SUCCESS,
@@ -89,15 +89,15 @@ static test_return_t touch_test(void *)
static test_return_t NOT_FOUND_test(void *)
{
char buffer[1024];
- snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
- memcached_st *memc= memcached(buffer, strlen(buffer));
+ int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
+ memcached_st *memc= memcached(buffer, length);
test_true(memc);
test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0));
test_compare(MEMCACHED_NOTFOUND, memcached_exist(memc, test_literal_param("foo")));
- snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
+ length= snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
const char *args[]= { "--expire=30", buffer, "foo", 0 };
test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true));
@@ -111,8 +111,8 @@ static test_return_t NOT_FOUND_test(void *)
static test_return_t check_version(void*)
{
char buffer[1024];
- snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
- memcached_st *memc= memcached(buffer, strlen(buffer));
+ int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
+ memcached_st *memc= memcached(buffer, length);
test_true(memc);
test_return_t result= TEST_SUCCESS;