#define MEMCACHED_EXPIRATION_NOT_ADD 0xffffffffU
#define MEMCACHED_SERVER_FAILURE_LIMIT 5
#define MEMCACHED_SERVER_FAILURE_RETRY_TIMEOUT 2
+#define MEMCACHED_SERVER_FAILURE_DEAD_TIMEOUT 0
int32_t poll_timeout;
int32_t connect_timeout; // How long we will wait on connect() before we will timeout
int32_t retry_timeout;
+ int32_t dead_timeout;
int send_size;
int recv_size;
void *user_data;
#define MEMCACHED_NI_MAXHOST 1025
#endif
+#ifdef NI_MAXSERV
+#define MEMCACHED_NI_MAXSERV NI_MAXSERV
+#else
+#define MEMCACHED_NI_MAXSERV 32
+#endif
+
enum memcached_server_state_t {
MEMCACHED_SERVER_STATE_NEW, // fd == -1, no address lookup has been done
MEMCACHED_SERVER_STATE_ADDRINFO, // ADDRRESS information has been gathered
MEMCACHED_BEHAVIOR_TCP_KEEPIDLE,
MEMCACHED_BEHAVIOR_LOAD_FROM_FILE,
MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS,
+ MEMCACHED_BEHAVIOR_DEAD_TIMEOUT,
MEMCACHED_BEHAVIOR_MAX
};
const memcached_behavior_t flag,
uint64_t data)
{
- if (not ptr)
+ if (ptr == NULL)
{
return MEMCACHED_INVALID_ARGUMENTS;
}
case MEMCACHED_BEHAVIOR_KETAMA:
{
if (data) // Turn on
+ {
return memcached_behavior_set_distribution(ptr, MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA);
+ }
return memcached_behavior_set_distribution(ptr, MEMCACHED_DISTRIBUTION_MODULA);
}
case MEMCACHED_BEHAVIOR_VERIFY_KEY:
if (ptr->flags.binary_protocol)
+ {
return memcached_set_error(*ptr, MEMCACHED_INVALID_ARGUMENTS, MEMCACHED_AT,
memcached_literal_param("MEMCACHED_BEHAVIOR_VERIFY_KEY if the binary protocol has been enabled."));
+ }
ptr->flags.verify_key= bool(data);
break;
case MEMCACHED_BEHAVIOR_SORT_HOSTS:
{
ptr->flags.use_sort_hosts= bool(data);
- run_distribution(ptr);
-
- break;
+ return run_distribution(ptr);
}
case MEMCACHED_BEHAVIOR_POLL_TIMEOUT:
ptr->retry_timeout= int32_t(data);
break;
+ case MEMCACHED_BEHAVIOR_DEAD_TIMEOUT:
+ ptr->dead_timeout= int32_t(data);
+ break;
+
case MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE:
ptr->send_size= (int32_t)data;
send_quit(ptr);
case MEMCACHED_BEHAVIOR_RETRY_TIMEOUT:
return (uint64_t)ptr->retry_timeout;
+ case MEMCACHED_BEHAVIOR_DEAD_TIMEOUT:
+ return uint64_t(ptr->dead_timeout);
+
case MEMCACHED_BEHAVIOR_SND_TIMEOUT:
return (uint64_t)ptr->snd_timeout;
}
ptr->distribution= type;
- run_distribution(ptr);
-
- return MEMCACHED_SUCCESS;
+ return run_distribution(ptr);
}
return memcached_set_error(*ptr, MEMCACHED_INVALID_ARGUMENTS, MEMCACHED_AT,
case MEMCACHED_BEHAVIOR_VERIFY_KEY: return "MEMCACHED_BEHAVIOR_VERIFY_KEY";
case MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT: return "MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT";
case MEMCACHED_BEHAVIOR_RETRY_TIMEOUT: return "MEMCACHED_BEHAVIOR_RETRY_TIMEOUT";
+ case MEMCACHED_BEHAVIOR_DEAD_TIMEOUT: return "MEMCACHED_BEHAVIOR_DEAD_TIMEOUT";
case MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED: return "MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED";
case MEMCACHED_BEHAVIOR_KETAMA_HASH: return "MEMCACHED_BEHAVIOR_KETAMA_HASH";
case MEMCACHED_BEHAVIOR_BINARY_PROTOCOL: return "MEMCACHED_BEHAVIOR_BINARY_PROTOCOL";
{
memcached_return_t rc;
- if (not self)
+ if (self == NULL)
+ {
return MEMCACHED_INVALID_ARGUMENTS;
+ }
- if (not host_map)
+ if (host_map == NULL)
+ {
return MEMCACHED_INVALID_ARGUMENTS;
+ }
memcached_server_distribution_t old= memcached_behavior_get_distribution(self);
*/
static memcached_return_t backoff_handling(memcached_server_write_instance_st server, bool& in_timeout)
{
+ struct timeval curr_time;
+ bool _gettime_success= (gettimeofday(&curr_time, NULL) == 0);
+
/*
If we hit server_failure_limit then something is completely wrong about the server.
if (_is_auto_eject_host(server->root))
{
set_last_disconnected_host(server);
- run_distribution((memcached_st *)server->root);
+
+ // Retry dead servers if requested
+ if (_gettime_success and server->root->dead_timeout > 0)
+ {
+ server->next_retry= curr_time.tv_sec +server->root->dead_timeout;
+
+ // We only retry dead servers once before assuming failure again
+ server->server_failure_counter= server->root->server_failure_limit -1;
+ }
+
+ memcached_return_t rc;
+ if (memcached_failed(rc= run_distribution((memcached_st *)server->root)))
+ {
+ return memcached_set_error(*server, rc, MEMCACHED_AT, memcached_literal_param("Backoff handling failed during run_distribution"));
+ }
return memcached_set_error(*server, MEMCACHED_SERVER_MARKED_DEAD, MEMCACHED_AT);
}
if (server->state == MEMCACHED_SERVER_STATE_IN_TIMEOUT)
{
- struct timeval curr_time;
- bool _gettime_success= (gettimeofday(&curr_time, NULL) == 0);
-
/*
If next_retry is less then our current time, then we reset and try everything again.
*/
if (is_ketama_weighted)
{
float pct= (float)list[host_index].weight / (float)total_weight;
- pointer_per_server= (uint32_t) ((floor((float) (pct * MEMCACHED_POINTS_PER_SERVER_KETAMA / 4 * (float)live_servers + 0.0000000001))) * 4);
+ pointer_per_server= (uint32_t) ((::floor((float) (pct * MEMCACHED_POINTS_PER_SERVER_KETAMA / 4 * (float)live_servers + 0.0000000001))) * 4);
pointer_per_hash= 4;
if (DEBUG)
{
pointer_index < pointer_per_server / pointer_per_hash;
pointer_index++)
{
- char sort_host[MEMCACHED_MAX_HOST_SORT_LENGTH]= "";
+ char sort_host[1 +MEMCACHED_NI_MAXHOST +1 +MEMCACHED_NI_MAXSERV +1 + MEMCACHED_NI_MAXSERV ]= "";
int sort_host_length;
// Spymemcached ketema key format is: hostname/ip:port-index
// If hostname is not available then: /ip:port-index
- sort_host_length= snprintf(sort_host, MEMCACHED_MAX_HOST_SORT_LENGTH,
+ sort_host_length= snprintf(sort_host, sizeof(sort_host),
"/%s:%u-%u",
list[host_index].hostname,
(uint32_t)list[host_index].port,
pointer_index);
- if (sort_host_length >= MEMCACHED_MAX_HOST_SORT_LENGTH || sort_host_length < 0)
+ if (size_t(sort_host_length) >= sizeof(sort_host) or sort_host_length < 0)
{
return memcached_set_error(*ptr, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT,
- memcached_literal_param("snprintf(MEMCACHED_DEFAULT_COMMAND_SIZE)"));
+ memcached_literal_param("snprintf(sizeof(sort_host))"));
}
if (DEBUG)
pointer_index <= pointer_per_server / pointer_per_hash;
pointer_index++)
{
- char sort_host[MEMCACHED_MAX_HOST_SORT_LENGTH]= "";
+ char sort_host[MEMCACHED_NI_MAXHOST +1 +MEMCACHED_NI_MAXSERV +1 +MEMCACHED_NI_MAXSERV]= "";
int sort_host_length;
if (list[host_index].port == MEMCACHED_DEFAULT_PORT)
{
- sort_host_length= snprintf(sort_host, MEMCACHED_MAX_HOST_SORT_LENGTH,
+ sort_host_length= snprintf(sort_host, sizeof(sort_host),
"%s-%u",
list[host_index].hostname,
pointer_index - 1);
}
else
{
- sort_host_length= snprintf(sort_host, MEMCACHED_MAX_HOST_SORT_LENGTH,
+ sort_host_length= snprintf(sort_host, sizeof(sort_host),
"%s:%u-%u",
list[host_index].hostname,
(uint32_t)list[host_index].port,
pointer_index - 1);
}
- if (sort_host_length >= MEMCACHED_MAX_HOST_SORT_LENGTH || sort_host_length < 0)
+ if (size_t(sort_host_length) >= sizeof(sort_host) or sort_host_length < 0)
{
return memcached_set_error(*ptr, MEMCACHED_MEMORY_ALLOCATION_FAILURE, MEMCACHED_AT,
- memcached_literal_param("snprintf(MEMCACHED_DEFAULT_COMMAND_SIZE)"));
+ memcached_literal_param("snprintf(sizeof(sort_host)))"));
}
if (is_ketama_weighted)
self->poll_timeout= MEMCACHED_DEFAULT_TIMEOUT;
self->connect_timeout= MEMCACHED_DEFAULT_CONNECT_TIMEOUT;
self->retry_timeout= MEMCACHED_SERVER_FAILURE_RETRY_TIMEOUT;
+ self->dead_timeout= MEMCACHED_SERVER_FAILURE_DEAD_TIMEOUT;
self->send_size= -1;
self->recv_size= -1;
memcached_return_t memcached_reset(memcached_st *ptr)
{
WATCHPOINT_ASSERT(ptr);
- if (not ptr)
+ if (ptr == NULL)
{
return MEMCACHED_INVALID_ARGUMENTS;
}
new_clone->poll_timeout= source->poll_timeout;
new_clone->connect_timeout= source->connect_timeout;
new_clone->retry_timeout= source->retry_timeout;
+ new_clone->dead_timeout= source->dead_timeout;
new_clone->distribution= source->distribution;
if (hashkit_clone(&new_clone->hashkit, &source->hashkit) == NULL)
AC_DEFINE([TIME_T_UNSIGNED], 1, [Define to 1 if time_t is unsigned])
])
- AC_CACHE_CHECK([if system defines RUSAGE_THREAD], [ac_cv_rusage_thread],[
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
- [[
-#include <sys/time.h>
-#include <sys/resource.h>
- ]],[[
- int x= RUSAGE_THREAD;
- ]])
- ],[
- ac_cv_rusage_thread=yes
- ],[
- ac_cv_rusage_thread=no
- ])
- ])
- AS_IF([test "$ac_cv_rusage_thread" = "no"],[
- AC_DEFINE([RUSAGE_THREAD], [RUSAGE_SELF],
- [Define if system doesn't define])
- ])
-
AC_CHECK_FUNC(setsockopt, [], [AC_CHECK_LIB(socket, setsockopt)])
AC_CHECK_FUNC(bind, [], [AC_CHECK_LIB(bind, bind)])
+++ /dev/null
-dnl Copyright (C) 2009 Sun Microsystems, Inc.
-dnl This file is free software; Sun Microsystems, Inc.
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl Check for all of the headers and libs that Drizzle needs. We check all
-dnl of these for plugins too, to ensure that all of the appropriate defines
-dnl are set.
-
-AC_DEFUN([PANDORA_CXX_DEMANGLE],[
- AC_LANG_PUSH([C++])
- save_CXXFLAGS="${CXXFLAGS}"
- CXXFLAGS="${CXX_STANDARD} ${CXXFLAGS}"
- AC_CHECK_HEADERS(cxxabi.h)
- AC_CACHE_CHECK([checking for abi::__cxa_demangle], pandora_cv_cxa_demangle,
- [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <cxxabi.h>]], [[
- char *foo= 0; int bar= 0;
- foo= abi::__cxa_demangle(foo, foo, 0, &bar);
- ]])],[pandora_cv_cxa_demangle=yes],[pandora_cv_cxa_demangle=no])])
- CXXFLAGS="${save_CXXFLAGS}"
- AC_LANG_POP()
-
- AS_IF([test "x$pandora_cv_cxa_demangle" = xyes],[
- AC_DEFINE(HAVE_ABI_CXA_DEMANGLE, 1,
- [Define to 1 if you have the `abi::__cxa_demangle' function.])
- ])
-])
+++ /dev/null
-dnl Copyright (C) 2009 Sun Microsystems, Inc.
-dnl This file is free software; Sun Microsystems, Inc.
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-#--------------------------------------------------------------------
-# Check for libdl
-#--------------------------------------------------------------------
-
-
-AC_DEFUN([_PANDORA_SEARCH_LIBDL],[
-
- save_LIBS="$LIBS"
- LIBS=""
- AC_CHECK_LIB(dl,dlopen)
- AC_CHECK_FUNCS(dlopen)
- LIBDL_LIBS="$LIBS"
- LIBS="${save_LIBS}"
- AC_SUBST(LIBDL_LIBS)
-
- AM_CONDITIONAL(HAVE_LIBDL, [test "x${ac_cv_func_dlopen}" = "xyes"])
-])
-
-AC_DEFUN([_PANDORA_HAVE_LIBDL],[
-
- AC_ARG_ENABLE([libdl],
- [AS_HELP_STRING([--disable-libdl],
- [Build with libdl support @<:@default=on@:>@])],
- [ac_enable_libdl="$enableval"],
- [ac_enable_libdl="yes"])
-
- _PANDORA_SEARCH_LIBDL
-])
-
-
-AC_DEFUN([PANDORA_HAVE_LIBDL],[
- AC_REQUIRE([_PANDORA_HAVE_LIBDL])
-])
-
-AC_DEFUN([_PANDORA_REQUIRE_LIBDL],[
- ac_enable_libdl="yes"
- _PANDORA_SEARCH_LIBDL
-
- AS_IF([test "$ac_cv_func_dlopen" != "yes"],[
- AC_MSG_ERROR([libdl/dlopen() is required for ${PACKAGE}. On Debian this can be found in libc6-dev. On RedHat this can be found in glibc-devel.])
- ])
-])
-
-AC_DEFUN([PANDORA_REQUIRE_LIBDL],[
- AC_REQUIRE([_PANDORA_REQUIRE_LIBDL])
-])
+++ /dev/null
-dnl Copyright (C) 2009 Sun Microsystems, Inc.
-dnl This file is free software; Sun Microsystems, Inc.
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([PANDORA_RUN_CPPLINT],[
- m4_syscmd([python config/make-lint.py])
-])
--- /dev/null
+# vim:ft=automake
+# Copyright (C) 2012 Data Differential
+# All rights reserved.
+#
+# Use and distribution licensed under the BSD license. See
+# the COPYING file in the parent directory for full text.
+#
+# included from Top Level Makefile.am
+# All paths should be given relative to the root
+
+
+tests_memcapable_SOURCES= tests/memcapable.cc
+tests_memcapable_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
+tests_memcapable_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memcapable
+tests_memcapable_LDADD= libtest/libtest.la $(TESTS_LDADDS)
+check_PROGRAMS+= tests/memcapable
+noinst_PROGRAMS+= tests/memcapable
+
+tests_memstat_SOURCES= tests/memstat.cc
+tests_memstat_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
+tests_memstat_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memstat
+tests_memstat_LDADD= libtest/libtest.la $(TESTS_LDADDS)
+check_PROGRAMS+= tests/memstat
+noinst_PROGRAMS+= tests/memstat
+
+tests_memcp_SOURCES= tests/memcp.cc
+tests_memcp_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
+tests_memcp_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memcp
+tests_memcp_LDADD= libtest/libtest.la $(TESTS_LDADDS)
+check_PROGRAMS+= tests/memcp
+noinst_PROGRAMS+= tests/memcp
+
+tests_memflush_SOURCES= tests/memflush.cc
+tests_memflush_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
+tests_memflush_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memflush
+tests_memflush_LDADD= libtest/libtest.la $(TESTS_LDADDS)
+check_PROGRAMS+= tests/memflush
+noinst_PROGRAMS+= tests/memflush
+
+tests_memrm_SOURCES= tests/memrm.cc
+tests_memrm_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
+tests_memrm_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memrm
+tests_memrm_LDADD= libtest/libtest.la $(TESTS_LDADDS)
+check_PROGRAMS+= tests/memrm
+noinst_PROGRAMS+= tests/memrm
+
+tests_memexist_SOURCES= tests/memexist.cc
+tests_memexist_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
+tests_memexist_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memexist
+tests_memexist_LDADD= libtest/libtest.la $(TESTS_LDADDS)
+check_PROGRAMS+= tests/memexist
+noinst_PROGRAMS+= tests/memexist
+
+tests_memtouch_SOURCES= tests/memtouch.cc
+tests_memtouch_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
+tests_memtouch_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memtouch
+tests_memtouch_LDADD= libtest/libtest.la $(TESTS_LDADDS)
+check_PROGRAMS+= tests/memtouch
+noinst_PROGRAMS+= tests/memtouch
+
+tests_memcat_SOURCES= tests/memcat.cc
+tests_memcat_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
+tests_memcat_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memcat
+tests_memcat_LDADD= libtest/libtest.la $(TESTS_LDADDS)
+check_PROGRAMS+= tests/memcat
+noinst_PROGRAMS+= tests/memcat
+
+tests_memerror_SOURCES= tests/memerror.cc
+tests_memerror_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
+tests_memerror_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memerror
+tests_memerror_LDADD= libtest/libtest.la $(TESTS_LDADDS)
+check_PROGRAMS+= tests/memerror
+noinst_PROGRAMS+= tests/memerror
+
+tests_memslap_SOURCES= tests/memslap.cc
+tests_memslap_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
+tests_memslap_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memslap
+tests_memslap_LDADD= libtest/libtest.la $(TESTS_LDADDS)
+check_PROGRAMS+= tests/memslap
+noinst_PROGRAMS+= tests/memslap
+
+tests_memdump_SOURCES= tests/memdump.cc
+tests_memdump_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
+tests_memdump_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memdump
+tests_memdump_LDADD= libtest/libtest.la $(TESTS_LDADDS)
+check_PROGRAMS+= tests/memdump
+noinst_PROGRAMS+= tests/memdump
+
+test-memcp: clients/memcp
+ @echo "Testing memcp"
+ @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
+ @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
+ @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
+ @rm tests/Xumemc.pid
+
+valgrind-memcp: clients/memcat clients/memcp
+ @echo "Testing memcp"
+ @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
+ @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
+ @rm tests/Xumemc.pid
+
+test-memflush: clients/memflush
+ @echo "Testing memflush"
+ @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
+ @clients/memflush --servers="localhost:12555"
+ @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
+ @rm tests/Xumemc.pid
+
+valgrind-memflush: clients/memflush
+ @echo "Testing memflush"
+ @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
+ @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
+ @rm tests/Xumemc.pid
+
+test-memdump: clients/memdump clients/memcp
+ @echo "Testing memdump"
+ @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
+ @clients/memcp --servers="localhost:12555" clients/memcat
+ @clients/memdump --servers="localhost:12555" > /dev/null
+ @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
+ @rm tests/Xumemc.pid
+
+valgrind-memdump: clients/memcat clients/memcp
+ @echo "Testing memdump"
+ @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
+ @clients/memcp --servers="localhost:12555" clients/memcat
+ @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
+ @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
+ @rm tests/Xumemc.pid
+
+test-memstat: clients/memstat
+ @echo "Testing memstat"
+ @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
+ @clients/memstat --servers="localhost:12555" > /dev/null
+ @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
+ @rm tests/Xumemc.pid
+
+valgrind-memstat: clients/memstat
+ @echo "Testing memstat"
+ @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
+ @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
+ @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
+ @rm tests/Xumemc.pid
+
check_PROGRAMS+= tests/hash_plus
noinst_PROGRAMS+= tests/hash_plus
-tests_memcapable_SOURCES= tests/memcapable.cc
-tests_memcapable_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
-tests_memcapable_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memcapable
-tests_memcapable_LDADD= libtest/libtest.la $(TESTS_LDADDS)
-check_PROGRAMS+= tests/memcapable
-noinst_PROGRAMS+= tests/memcapable
-
-tests_memstat_SOURCES= tests/memstat.cc
-tests_memstat_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
-tests_memstat_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memstat
-tests_memstat_LDADD= libtest/libtest.la $(TESTS_LDADDS)
-check_PROGRAMS+= tests/memstat
-noinst_PROGRAMS+= tests/memstat
-
-tests_memcp_SOURCES= tests/memcp.cc
-tests_memcp_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
-tests_memcp_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memcp
-tests_memcp_LDADD= libtest/libtest.la $(TESTS_LDADDS)
-check_PROGRAMS+= tests/memcp
-noinst_PROGRAMS+= tests/memcp
-
-tests_memflush_SOURCES= tests/memflush.cc
-tests_memflush_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
-tests_memflush_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memflush
-tests_memflush_LDADD= libtest/libtest.la $(TESTS_LDADDS)
-check_PROGRAMS+= tests/memflush
-noinst_PROGRAMS+= tests/memflush
-
-tests_memrm_SOURCES= tests/memrm.cc
-tests_memrm_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
-tests_memrm_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memrm
-tests_memrm_LDADD= libtest/libtest.la $(TESTS_LDADDS)
-check_PROGRAMS+= tests/memrm
-noinst_PROGRAMS+= tests/memrm
-
-tests_memexist_SOURCES= tests/memexist.cc
-tests_memexist_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
-tests_memexist_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memexist
-tests_memexist_LDADD= libtest/libtest.la $(TESTS_LDADDS)
-check_PROGRAMS+= tests/memexist
-noinst_PROGRAMS+= tests/memexist
-
-tests_memtouch_SOURCES= tests/memtouch.cc
-tests_memtouch_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
-tests_memtouch_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memtouch
-tests_memtouch_LDADD= libtest/libtest.la $(TESTS_LDADDS)
-check_PROGRAMS+= tests/memtouch
-noinst_PROGRAMS+= tests/memtouch
-
-tests_memcat_SOURCES= tests/memcat.cc
-tests_memcat_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
-tests_memcat_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memcat
-tests_memcat_LDADD= libtest/libtest.la $(TESTS_LDADDS)
-check_PROGRAMS+= tests/memcat
-noinst_PROGRAMS+= tests/memcat
-
-tests_memerror_SOURCES= tests/memerror.cc
-tests_memerror_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
-tests_memerror_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memerror
-tests_memerror_LDADD= libtest/libtest.la $(TESTS_LDADDS)
-check_PROGRAMS+= tests/memerror
-noinst_PROGRAMS+= tests/memerror
-
-tests_memslap_SOURCES= tests/memslap.cc
-tests_memslap_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
-tests_memslap_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memslap
-tests_memslap_LDADD= libtest/libtest.la $(TESTS_LDADDS)
-check_PROGRAMS+= tests/memslap
-noinst_PROGRAMS+= tests/memslap
-
-tests_memdump_SOURCES= tests/memdump.cc
-tests_memdump_CXXFLAGS= $(AM_CXXFLAGS) $(NO_EFF_CXX)
-tests_memdump_DEPENDENCIES= libtest/libtest.la $(TESTS_LDADDS) clients/memdump
-tests_memdump_LDADD= libtest/libtest.la $(TESTS_LDADDS)
-check_PROGRAMS+= tests/memdump
-noinst_PROGRAMS+= tests/memdump
+include tests/cli.am
test: check
test-x: test-plus test-memcp test-memdump test-memflush test-memstat
@echo "Tests completed"
-test-memcp: clients/memcp
- @echo "Testing memcp"
- @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
- @clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
- @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
- @rm tests/Xumemc.pid
-
-valgrind-memcp: clients/memcat clients/memcp
- @echo "Testing memcp"
- @@MEMC_BINARY@ -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
- @$(VALGRIND_COMMAND) clients/memcp --servers="localhost:12555" clients/memcp clients/memcat clients/memstat
- @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
- @rm tests/Xumemc.pid
-
-test-memflush: clients/memflush
- @echo "Testing memflush"
- @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
- @clients/memflush --servers="localhost:12555"
- @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
- @rm tests/Xumemc.pid
-
-valgrind-memflush: clients/memflush
- @echo "Testing memflush"
- @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
- @$(VALGRIND_COMMAND) clients/memflush --servers="localhost:12555"
- @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
- @rm tests/Xumemc.pid
-
-test-memdump: clients/memdump clients/memcp
- @echo "Testing memdump"
- @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
- @clients/memcp --servers="localhost:12555" clients/memcat
- @clients/memdump --servers="localhost:12555" > /dev/null
- @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
- @rm tests/Xumemc.pid
-
-valgrind-memdump: clients/memcat clients/memcp
- @echo "Testing memdump"
- @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
- @clients/memcp --servers="localhost:12555" clients/memcat
- @$(VALGRIND_COMMAND) clients/memdump --servers="localhost:12555" > /dev/null
- @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
- @rm tests/Xumemc.pid
-
-test-memstat: clients/memstat
- @echo "Testing memstat"
- @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
- @clients/memstat --servers="localhost:12555" > /dev/null
- @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
- @rm tests/Xumemc.pid
-
-valgrind-memstat: clients/memstat
- @echo "Testing memstat"
- @$(MEMC_BINARY) -d -u root -P `pwd`/tests/Xumemc.pid -p 12555
- @$(VALGRIND_COMMAND) clients/memstat --servers="localhost:12555" > /dev/null
- @cat tests/Xumemc.pid | xargs kill || echo "Failed to kill memcached server"
- @rm tests/Xumemc.pid
-
test-mem: tests/var tests/libmemcached-1.0/testapp
@tests/libmemcached-1.0/testapp
{
test_true(libmemcached_string_behavior(memcached_behavior_t(x)));
}
- test_compare(36, int(MEMCACHED_BEHAVIOR_MAX));
+ test_compare(37, int(MEMCACHED_BEHAVIOR_MAX));
return TEST_SUCCESS;
}
{
if (HAVE_MEMCACHED_BINARY == 0)
{
- error= TEST_FATAL;
+ error= TEST_SKIPPED;
return NULL;
}
memcached_set(memc,
test_literal_param(__func__),
test_literal_param("1"),
- (time_t)0, (uint32_t)0));
+ time_t(0), uint32_t(0)));
Expected expected_ids;
get_udp_request_ids(memc, expected_ids);
{
if (HAVE_MEMCACHED_BINARY == 0)
{
- error= TEST_FATAL;
+ error= TEST_SKIPPED;
return NULL;
}
{
if (HAVE_MEMCACHED_BINARY == 0)
{
- error= TEST_FATAL;
+ error= TEST_SKIPPED;
return NULL;
}
{
if (HAVE_MEMCACHED_BINARY == 0)
{
- error= TEST_FATAL;
+ error= TEST_SKIPPED;
return NULL;
}
{
if (HAVE_MEMCACHED_BINARY == 0)
{
- error= TEST_FATAL;
+ error= TEST_SKIPPED;
return NULL;
}
{
if (HAVE_MEMCACHED_BINARY == 0)
{
- error= TEST_FATAL;
+ error= TEST_SKIPPED;
return NULL;
}
{
if (HAVE_MEMCACHED_BINARY == 0)
{
- error= TEST_FATAL;
+ error= TEST_SKIPPED;
return NULL;
}
{
if (HAVE_MEMCACHED_BINARY == 0)
{
- error= TEST_FATAL;
+ error= TEST_SKIPPED;
return NULL;
}
{
if (HAVE_MEMCACHED_BINARY == 0)
{
- error= TEST_FATAL;
+ error= TEST_SKIPPED;
return NULL;
}
{
if (HAVE_MEMCACHED_BINARY == 0)
{
- error= TEST_FATAL;
+ error= TEST_SKIPPED;
return NULL;
}
{
if (HAVE_MEMCACHED_BINARY == 0)
{
- error= TEST_FATAL;
+ error= TEST_SKIPPED;
return NULL;
}