Merge lp:~tangent-org/libmemcached/1.0-build/ Build: jenkins-Libmemcached-230
authorContinuous Integration <ci@tangent.org>
Thu, 21 Feb 2013 09:02:24 +0000 (04:02 -0500)
committerContinuous Integration <ci@tangent.org>
Thu, 21 Feb 2013 09:02:24 +0000 (04:02 -0500)
34 files changed:
Makefile.am
bootstrap.sh
clients/memcapable.cc
clients/utilities.cc
configure.ac
libhashkit/md5.cc
libmemcached-1.0/platform.h
libmemcached/common.h
libmemcached/connect.cc
libmemcached/csl/parser.yy
libmemcached/do.cc
libmemcached/get.cc
libmemcached/include.am
libmemcached/io.cc
libmemcached/poll.cc
libmemcached/poll.h
libmemcached/response.cc
libmemcached/windows.hpp [new file with mode: 0644]
libmemcachedutil-1.0/pid.h
libtest/alarm.cc
libtest/common.h
libtest/dream.cc
libtest/lite.h
libtest/m4/memcached.m4 [deleted file]
libtest/yatl.m4
m4/ax_harden_compiler_flags.m4
m4/ax_libevent.m4
m4/ax_memcached.m4 [new file with mode: 0644]
m4/ax_platform.m4
tests/libmemcached-1.0/all_tests.h
tests/libmemcached-1.0/mem_functions.cc
tests/libmemcached-1.0/mem_functions.h
tests/libmemcached-1.0/touch.cc
tests/mem_udp.cc

index 6aa50af828b6dec8e3734975648dc4daf68195db..a359ac00d229e52e17889078206e76b86a410afd 100644 (file)
@@ -86,6 +86,8 @@ TESTS += ${bin_PROGRAMS}
 TESTS += ${check_PROGRAMS}
 XFAIL_TESTS += ${bin_PROGRAMS}
 
+if ! BUILD_WIN32
+
 merge-clean:
        @find ./ | $(GREP) \.gcda | xargs rm -f
        @find ./ | $(GREP) \.gcno | xargs rm -f
@@ -101,8 +103,8 @@ merge-clean:
        @echo "Files that need to be either removed or checked in:"
        @bzr unknowns
 
-clean-local:
-       -rm -rf docs/_build docs/doctrees
+clean-local: clean-libtest-check clean-docs-check
+
 
 lcov: lcov-clean check
        @echo
@@ -117,11 +119,10 @@ lcov-clean: clean
        @rm -rf lcov */lcov.out
        @find . -name '*.gcno' | xargs rm -f
        @find . -name '*.gcda' | xargs rm -f
+endif
 
 DISTCLEANFILES+= config/top.h
 
-clean-local: clean-libtest-check clean-docs-check
-
 maintainer-clean-local:
        find . -type f -name '*~' -exec rm -f '{}' \;
        -rm -f @PACKAGE@-*.rpm
index fdc43f999d0024fc2b576ddf4a672631e84c8040..42c2157b4862a164f18747190400275c4b2757ff 100755 (executable)
@@ -296,42 +296,42 @@ function run_configure ()
   # Arguments for configure
   local BUILD_CONFIGURE_ARG= 
 
-  # Set ENV DEBUG in order to enable debugging
+  # If ENV DEBUG is set we enable both debug and asssert, otherwise we see if this is a VCS checkout and if so enable assert
+  # Set ENV ASSERT in order to enable assert
   if $DEBUG; then 
-    BUILD_CONFIGURE_ARG='--enable-debug'
+    BUILD_CONFIGURE_ARG+=' --enable-debug --enable-assert'
+  elif [[ -n "$VCS_CHECKOUT" ]]; then
+    BUILD_CONFIGURE_ARG+=' --enable-assert'
   fi
 
-  # Set ENV ASSERT in order to enable assert
-  if [[ -n "$ASSERT" ]]; then 
-    local ASSERT_ARG=
-    ASSERT_ARG='--enable-assert'
-    BUILD_CONFIGURE_ARG="$ASSERT_ARG $BUILD_CONFIGURE_ARG"
+  if [[ -n "$CONFIGURE_ARG" ]]; then 
+    BUILD_CONFIGURE_ARG+=" $CONFIGURE_ARG"
   fi
 
-  if [[ -n "$CONFIGURE_ARG" ]]; then 
-    BUILD_CONFIGURE_ARG= "$BUILD_CONFIGURE_ARG $CONFIGURE_ARG"
+  if [[ -n "$PREFIX_ARG" ]]; then 
+    BUILD_CONFIGURE_ARG+=" $PREFIX_ARG"
   fi
 
   ret=1;
   # If we are executing on OSX use CLANG, otherwise only use it if we find it in the ENV
   case $HOST_OS in
     *-darwin-*)
-      CC=clang CXX=clang++ $top_srcdir/configure $BUILD_CONFIGURE_ARG || die "Cannot execute CC=clang CXX=clang++ configure $BUILD_CONFIGURE_ARG $PREFIX_ARG"
+      CC=clang CXX=clang++ $top_srcdir/configure $BUILD_CONFIGURE_ARG || die "Cannot execute CC=clang CXX=clang++ configure $BUILD_CONFIGURE_ARG"
       ret=$?
       ;;
     rhel-5*)
       command_exists 'gcc44' || die "Could not locate gcc44"
-      CC=gcc44 CXX=gcc44 $top_srcdir/configure $BUILD_CONFIGURE_ARG $PREFIX_ARG || die "Cannot execute CC=gcc44 CXX=gcc44 configure $BUILD_CONFIGURE_ARG $PREFIX_ARG"
+      CC=gcc44 CXX=gcc44 $top_srcdir/configure $BUILD_CONFIGURE_ARG || die "Cannot execute CC=gcc44 CXX=gcc44 configure $BUILD_CONFIGURE_ARG"
       ret=$?
       ;;
     *)
-      $CONFIGURE $BUILD_CONFIGURE_ARG $PREFIX_ARG
+      $CONFIGURE $BUILD_CONFIGURE_ARG
       ret=$?
       ;;
   esac
 
   if [ $ret -ne 0 ]; then
-    die "Could not execute $CONFIGURE $BUILD_CONFIGURE_ARG $PREFIX_ARG"
+    die "Could not execute $CONFIGURE $BUILD_CONFIGURE_ARG"
   fi
 
   if [ ! -f 'Makefile' ]; then
@@ -367,6 +367,10 @@ function save_BUILD ()
     die "OLD_CONFIGURE_ARG($OLD_CONFIGURE_ARG) was set on push, programmer error!"
   fi
 
+  if [[ -n "$OLD_PREFIX" ]]; then
+    die "OLD_PREFIX($OLD_PREFIX) was set on push, programmer error!"
+  fi
+
   if [[ -n "$OLD_MAKE" ]]; then
     die "OLD_MAKE($OLD_MAKE) was set on push, programmer error!"
   fi
@@ -402,6 +406,10 @@ function restore_BUILD ()
     CONFIGURE_ARG=$OLD_CONFIGURE_ARG
   fi
 
+  if [[ -n "$OLD_PREFIX" ]]; then
+    PREFIX_ARG=$OLD_PREFIX
+  fi
+
   if [[ -n "$OLD_MAKE" ]]; then
     MAKE=$OLD_MAKE
   fi
@@ -412,59 +420,13 @@ function restore_BUILD ()
 
   OLD_CONFIGURE=
   OLD_CONFIGURE_ARG=
+  OLD_PREFIX=
   OLD_MAKE=
   OLD_TESTS_ENVIRONMENT=
 
   export -n CC CXX
 }
 
-function push_PREFIX_ARG ()
-{
-  if [[ -n "$OLD_PREFIX_ARG" ]]; then
-    die "OLD_PREFIX_ARG was set on push, programmer error!"
-  fi
-
-  if [[ -n "$PREFIX_ARG" ]]; then
-    OLD_PREFIX_ARG=$PREFIX_ARG
-    PREFIX_ARG=
-  fi
-
-  if [[ -n "$1" ]]; then
-    PREFIX_ARG="--prefix=$1"
-  fi
-}
-
-function pop_PREFIX_ARG ()
-{
-  if [[ -n "$OLD_PREFIX_ARG" ]]; then
-    PREFIX_ARG=$OLD_PREFIX_ARG
-    OLD_PREFIX_ARG=
-  else
-    PREFIX_ARG=
-  fi
-}
-
-function push_TESTS_ENVIRONMENT ()
-{
-  if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then
-    die "OLD_TESTS_ENVIRONMENT was set on push, programmer error!"
-  fi
-
-  if [[ -n "$TESTS_ENVIRONMENT" ]]; then
-    OLD_TESTS_ENVIRONMENT=$TESTS_ENVIRONMENT
-    TESTS_ENVIRONMENT=
-  fi
-}
-
-function pop_TESTS_ENVIRONMENT ()
-{
-  TESTS_ENVIRONMENT=
-  if [[ -n "$OLD_TESTS_ENVIRONMENT" ]]; then
-    TESTS_ENVIRONMENT=$OLD_TESTS_ENVIRONMENT
-    OLD_TESTS_ENVIRONMENT=
-  fi
-}
-
 function safe_pushd ()
 {
   pushd $1 &> /dev/null ;
@@ -513,11 +475,11 @@ function make_valgrind ()
     return 1
   fi
 
+  save_BUILD
+
   # If we are required to run configure, do so now
   run_configure_if_required
 
-  push_TESTS_ENVIRONMENT
-
   # If we don't have a configure, then most likely we will be missing libtool
   assert_file 'configure'
   if [[ -f 'libtool' ]]; then
@@ -528,13 +490,15 @@ function make_valgrind ()
 
   make_target 'check' || return 1
 
-  pop_TESTS_ENVIRONMENT
+  restore_BUILD
 }
 
 function make_install_system ()
 {
   local INSTALL_LOCATION=$(mktemp -d /tmp/XXXXXXXXXX)
-  push_PREFIX_ARG $INSTALL_LOCATION
+
+  save_BUILD
+  PREFIX_ARG="--prefix=$INSTALL_LOCATION"
 
   if [ ! -d $INSTALL_LOCATION ] ; then
     die "ASSERT temp directory not found '$INSTALL_LOCATION'"
@@ -542,17 +506,12 @@ function make_install_system ()
 
   run_configure #install_buid_dir
 
-  push_TESTS_ENVIRONMENT
-
   make_target 'install'
 
   make_target 'installcheck'
 
   make_target 'uninstall'
 
-  pop_TESTS_ENVIRONMENT
-  pop_PREFIX_ARG
-
   rm -r -f $INSTALL_LOCATION
   make 'distclean'
 
@@ -560,6 +519,7 @@ function make_install_system ()
     die "ASSERT Makefile should not exist"
   fi
 
+  restore_BUILD
   safe_popd
 }
 
@@ -900,11 +860,11 @@ function make_install_html ()
 
 function make_gdb ()
 {
+  save_BUILD
+
   if command_exists 'gdb'; then
     run_configure_if_required
 
-    push_TESTS_ENVIRONMENT
-
     # Set ENV GDB_COMMAND
     if [[ -z "$GDB_COMMAND" ]]; then
       setup_gdb_command
@@ -924,8 +884,6 @@ function make_gdb ()
       rm 'gdb.txt'
     fi
 
-    pop_TESTS_ENVIRONMENT
-
     if [ -f '.gdb_history' ]; then
       rm '.gdb_history'
     fi
@@ -937,6 +895,8 @@ function make_gdb ()
     echo 'gdb was not present'
     return 1
   fi
+
+  restore_BUILD
 }
 
 # $1 target to compile
@@ -1142,6 +1102,8 @@ function determine_vcs ()
     VCS_CHECKOUT=svn
   elif [[ -d '.hg' ]]; then
     VCS_CHECKOUT=hg
+  else
+    VCS_CHECKOUT=
   fi
 
   if [[ -n "$VCS_CHECKOUT" ]]; then
@@ -1466,7 +1428,7 @@ function bootstrap ()
 
   # Set ENV PREFIX in order to set --prefix for ./configure
   if [[ -n "$PREFIX" ]]; then 
-    push_PREFIX_ARG $PREFIX
+    PREFIX_ARG="--prefix=$PREFIX"
   fi
 
   # We should always have a target by this point
@@ -1580,6 +1542,7 @@ function main ()
 
   local OLD_CONFIGURE=
   local OLD_CONFIGURE_ARG=
+  local OLD_PREFIX=
   local OLD_MAKE=
   local OLD_TESTS_ENVIRONMENT=
 
@@ -1726,11 +1689,13 @@ export AUTOHEADER
 export AUTOM4TE
 export AUTOMAKE
 export AUTORECONF
+export CONFIGURE_ARG
 export DEBUG
 export GNU_BUILD_FLAGS
 export LIBTOOLIZE
 export LIBTOOLIZE_OPTIONS
 export MAKE
+export PREFIX_ARG
 export TESTS_ENVIRONMENT
 export VERBOSE
 export WARNINGS
index c8d294f95fb14d5235aad1e43ceeb894a60f1a8e..0343e15d5d840663a0035727fdf68b4651345d6a 100644 (file)
@@ -124,7 +124,7 @@ static struct addrinfo *lookuphost(const char *hostname, const char *port)
  */
 static memcached_socket_t set_noblock(void)
 {
-#ifdef WIN32
+#if defined(_WIN32)
   u_long arg = 1;
   if (ioctlsocket(sock, FIONBIO, &arg) == SOCKET_ERROR)
   {
index 5f5958e2a193dbe8e15fe161e2a32c10067d1e38..158890515ef43840bc9d49409e386bb0706ed980 100644 (file)
@@ -184,12 +184,12 @@ void process_hash_option(memcached_st *memc, char *opt_hash)
 void initialize_sockets(void)
 {
   /* Define the function for all platforms to avoid #ifdefs in each program */
-#if defined(WIN32) && WIN32
+#if defined(_WIN32)
   WSADATA wsaData;
   if (WSAStartup(MAKEWORD(2,0), &wsaData) != 0)
   {
     fprintf(stderr, "Socket Initialization Error. Program aborted\n");
     exit(EXIT_FAILURE);
   }
-#endif
+#endif // #if defined(_WIN32)
 }
index 9923d88809186c3e1ad3e9f8f2a86874f6567d7a..f21171d319ce2b883e37b80384dbb04e0e6d90d3 100644 (file)
@@ -1,5 +1,5 @@
 # LibmemcacheD
-# Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+# Copyright (C) 2011-2013 Data Differential, http://datadifferential.com/
 # Copyright (C) 2006-2010 Brian Aker, Monty Taylor, Trond Norbye
 # All rights reserved.
 #
@@ -100,9 +100,13 @@ PROTOCOL_BINARY_TEST
 ENABLE_DEPRECATED
 
 # Checks for programs.
+AC_PROG_AWK
+AC_PROG_SED
+AC_PROG_MKDIR_P
 AC_CHECK_PROGS([LEX],['flex'],[:])
 AC_CHECK_PROGS([YACC],['bison'],[:])
 AX_PROG_SPHINX_BUILD
+AX_PROG_MEMCACHED
 
 # Checks for libraries.
 AC_SEARCH_LIBS([getopt_long],[gnugetopt])
@@ -287,10 +291,12 @@ AC_DEFUN([CHECK_FOR_PTHREAD_AND_SASL],
          ])
 CHECK_FOR_PTHREAD_AND_SASL
 
-
 # backtrace(), others require shared builds
-AS_IF([test "x$enable_shared" = "xyes"],
-      [AC_DEFINE([HAVE_SHARED_ENABLED],[1],[Enable code which requires shared library support. Like backtrace().])])
+AC_DEFUN([__ENABLE_SHARED],
+         [AC_REQUIRE([AX_PLATFORM])
+         AS_IF([test "x${TARGET_WINDOWS}" = "xtrue"],[enable_shared=no])
+         AS_IF([test "x$enable_shared" = "xyes"],
+               [AC_DEFINE([HAVE_SHARED_ENABLED],[1],[Enable code which requires shared library support. Like backtrace().])])])
 AM_CONDITIONAL([SHARED_ENABLED],[test "x$enable_shared" = "xyes"])
 
 PANDORA_ENABLE_DTRACE
index 71069dbdd4f53b4339d1b9f83353b708d2613d93..cf68e3ca6dd2298c595ac9920952c3acbfe42ed9 100644 (file)
@@ -71,6 +71,8 @@ documentation and/or software.
 #include <string.h>
 #include <sys/types.h>
 
+#pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
+
 /* POINTER defines a generic pointer type */
 typedef unsigned char *POINTER;
 typedef const unsigned char *CONST_POINTER;
index 9cbc705fcd30ac9e9f77d55f70e264854c9e94b6..efdf53f81b495dd2ea2ad3f5bac8cbd9b554b6c8 100644 (file)
@@ -38,7 +38,7 @@
 #pragma once
 
 
-#if defined(WIN32) || defined(__MINGW32__)
+#if defined(_WIN32)
 # include <winsock2.h>
 # include <ws2tcpip.h>
 
@@ -59,4 +59,4 @@ typedef SOCKET memcached_socket_t;
 
 typedef int memcached_socket_t;
 
-#endif /* WIN32 */
+#endif /* _WIN32 */
index fac6d7758de58794a16f4c38ca91c9b567ccf211..71db19b01bd85b2d59faa99ec9ad39c0c086ec89 100644 (file)
 # include <dlfcn.h>
 #endif
 
-#if defined(WIN32) || defined(__MINGW32__)
+#if defined(_WIN32)
 # include "libmemcached/windows.hpp"
 #endif
 
index 2ec9975c319d5ba23f260c15b3ca4a5121441ea8..2e2dbf616fbe4fcb22f4fcc437f6fd17e947873b 100644 (file)
@@ -87,7 +87,7 @@ static memcached_return_t connect_poll(org::libmemcached::Instance* server, cons
       int local_errno= get_socket_errno(); // We cache in case closesocket() modifies errno
       switch (local_errno)
       {
-#ifdef TARGET_OS_LINUX
+#ifdef __linux__
       case ERESTART:
 #endif
       case EINTR:
@@ -103,22 +103,6 @@ static memcached_return_t connect_poll(org::libmemcached::Instance* server, cons
 
       default: // This should not happen
         break;
-#if 0
-        if (fds[0].revents & POLLERR)
-        {
-          int err;
-          socklen_t len= sizeof(err);
-          if (getsockopt(server->fd, SOL_SOCKET, SO_ERROR, (char*)&err, &len) == 0)
-          {
-            if (err == 0)
-            {
-              // This should never happen, if it does? Punt.  
-              continue;
-            }
-            local_errno= err;
-          }
-        }
-#endif
       }
 
       assert_msg(server->fd != INVALID_SOCKET, "poll() was passed an invalid file descriptor");
@@ -146,13 +130,9 @@ static memcached_return_t connect_poll(org::libmemcached::Instance* server, cons
         }
       }
 
-      return  memcached_set_error(*server, MEMCACHED_TIMEOUT, MEMCACHED_AT);
+      return  memcached_set_error(*server, MEMCACHED_TIMEOUT, MEMCACHED_AT, memcached_literal_param("(number_of == 0)"));
     }
 
-#if 0
-    server->revents(fds[0].revents);
-#endif
-
     assert (number_of == 1);
 
     if (fds[0].revents & POLLERR or
@@ -267,7 +247,7 @@ static memcached_return_t set_hostinfo(org::libmemcached::Instance* server)
 
 static inline void set_socket_nonblocking(org::libmemcached::Instance* server)
 {
-#ifdef WIN32
+#if defined(_WIN32)
   u_long arg= 1;
   if (ioctlsocket(server->fd, FIONBIO, &arg) == SOCKET_ERROR)
   {
@@ -372,7 +352,7 @@ static bool set_socket_options(org::libmemcached::Instance* server)
 
 #if defined(_WIN32)
 #else
-#if defined(SO_NOSIGPIPE)
+# if defined(SO_NOSIGPIPE)
   if (SO_NOSIGPIPE)
   {
     int set= 1;
@@ -388,7 +368,7 @@ static bool set_socket_options(org::libmemcached::Instance* server)
 #endif
     }
   }
-#endif // SO_NOSIGPIPE
+# endif // SO_NOSIGPIPE
 #endif // _WIN32
 
   if (server->root->flags.no_block)
@@ -461,7 +441,7 @@ static bool set_socket_options(org::libmemcached::Instance* server)
 
 static memcached_return_t unix_socket_connect(org::libmemcached::Instance* server)
 {
-#ifndef WIN32
+#ifndef _WIN32
   WATCHPOINT_ASSERT(server->fd == INVALID_SOCKET);
 
   do {
@@ -663,7 +643,8 @@ static memcached_return_t network_connect(org::libmemcached::Instance* server)
 
   if (timeout_error_occured and server->state < MEMCACHED_SERVER_STATE_IN_PROGRESS)
   {
-    return memcached_set_error(*server, MEMCACHED_TIMEOUT, MEMCACHED_AT);
+    return memcached_set_error(*server, MEMCACHED_TIMEOUT, MEMCACHED_AT,
+                               memcached_literal_param("if (timeout_error_occured and server->state < MEMCACHED_SERVER_STATE_IN_PROGRESS)"));
   }
 
   return memcached_set_error(*server, MEMCACHED_CONNECTION_FAILURE, MEMCACHED_AT); /* The last error should be from connect() */
index 6d4ccd55152b364374f683bb6fbe5d7b67a152c1..dd9c720b9631009f2ac0277eb51c2f2fdc7ae2ff 100644 (file)
@@ -53,7 +53,7 @@ class Context;
 %parse-param { class Context *context }
 %parse-param { yyscan_t *scanner }
 %pure-parser
-%require "2.4"
+%require "2.5"
 %start begin
 %verbose
 
@@ -66,13 +66,14 @@ class Context;
 #include <libmemcached/csl/scanner.h>
 
 #ifndef __INTEL_COMPILER
-#pragma GCC diagnostic ignored "-Wold-style-cast"
+# pragma GCC diagnostic ignored "-Wold-style-cast"
 #endif
 
 #ifndef __INTEL_COMPILER
-#ifndef __clang__
-#pragma GCC diagnostic ignored "-Wlogical-op"
-#endif
+# ifndef __clang__
+#  pragma GCC diagnostic ignored "-Wlogical-op"
+#  pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"
+# endif
 #endif
 
 int conf_lex(YYSTYPE* lvalp, void* scanner);
index c9d8e7e54c2e1d2bdda77d984633e727f4ddadc9..73ef06d34f11063859e19c92e331a4f27288a47a 100644 (file)
@@ -30,7 +30,7 @@ static memcached_return_t _vdo_udp(org::libmemcached::Instance* instance,
   vector[0].length= UDP_DATAGRAM_HEADER_LENGTH;
 
   msg.msg_iov= (struct iovec*)vector;
-#if defined(TARGET_OS_OSX) && TARGET_OS_OSX
+#ifdef __APPLE__
   msg.msg_iovlen= int(count);
 #else
   msg.msg_iovlen= count;
index 1de5f76fc56779fc3dd65ff1ec241229583b8669..0f151e8d01b4e6e4338ee05a9c4e9b6290c95d49 100644 (file)
@@ -2,7 +2,7 @@
  * 
  *  Libmemcached library
  *
- *  Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
+ *  Copyright (C) 2011-2013 Data Differential, http://datadifferential.com/
  *  Copyright (C) 2006-2009 Brian Aker All rights reserved.
  *
  *  Redistribution and use in source and binary forms, with or without
@@ -50,13 +50,13 @@ char *memcached_get(memcached_st *ptr, const char *key,
                               flags, error);
 }
 
-static memcached_return_t memcached_mget_by_key_real(memcached_st *ptr,
-                                                     const char *group_key,
-                                                     size_t group_key_length,
-                                                     const char * const *keys,
-                                                     const size_t *key_length,
-                                                     size_t number_of_keys,
-                                                     bool mget_mode);
+static memcached_return_t __mget_by_key_real(memcached_st *ptr,
+                                             const char *group_key,
+                                             size_t group_key_length,
+                                             const char * const *keys,
+                                             const size_t *key_length,
+                                             size_t number_of_keys,
+                                             const bool mget_mode);
 char *memcached_get_by_key(memcached_st *shell,
                            const char *group_key,
                            size_t group_key_length,
@@ -79,9 +79,9 @@ char *memcached_get_by_key(memcached_st *shell,
   }
 
   /* Request the key */
-  *error= memcached_mget_by_key_real(ptr, group_key, group_key_length,
-                                     (const char * const *)&key, &key_length, 
-                                     1, false);
+  *error= __mget_by_key_real(ptr, group_key, group_key_length,
+                             (const char * const *)&key, &key_length, 
+                             1, false);
   if (ptr)
   {
     assert_msg(ptr->query_id == query_id +1, "Programmer error, the query_id was not incremented.");
@@ -186,20 +186,20 @@ memcached_return_t memcached_mget(memcached_st *ptr,
 }
 
 static memcached_return_t binary_mget_by_key(memcached_st *ptr,
-                                             uint32_t master_server_key,
-                                             bool is_group_key_set,
+                                             const uint32_t master_server_key,
+                                             const bool is_group_key_set,
+                                             const char * const *keys,
+                                             const size_t *key_length,
+                                             const size_t number_of_keys,
+                                             const bool mget_mode);
+
+static memcached_return_t __mget_by_key_real(memcached_st *ptr,
+                                             const char *group_key,
+                                             const size_t group_key_length,
                                              const char * const *keys,
                                              const size_t *key_length,
                                              size_t number_of_keys,
-                                             bool mget_mode);
-
-static memcached_return_t memcached_mget_by_key_real(memcached_st *ptr,
-                                                     const char *group_key,
-                                                     size_t group_key_length,
-                                                     const char * const *keys,
-                                                     const size_t *key_length,
-                                                     size_t number_of_keys,
-                                                     bool mget_mode)
+                                             const bool mget_mode)
 {
   bool failures_occured_in_sending= false;
   const char *get_command= "get";
@@ -393,8 +393,7 @@ memcached_return_t memcached_mget_by_key(memcached_st *shell,
                                          size_t number_of_keys)
 {
   Memcached* ptr= memcached2Memcached(shell);
-  return memcached_mget_by_key_real(ptr, group_key, group_key_length, keys,
-                                    key_length, number_of_keys, true);
+  return __mget_by_key_real(ptr, group_key, group_key_length, keys, key_length, number_of_keys, true);
 }
 
 memcached_return_t memcached_mget_execute(memcached_st *ptr,
@@ -449,15 +448,16 @@ memcached_return_t memcached_mget_execute_by_key(memcached_st *shell,
   rc= memcached_mget_by_key(ptr, group_key, group_key_length, keys,
                             key_length, number_of_keys);
   ptr->callbacks= original_callbacks;
+
   return rc;
 }
 
 static memcached_return_t simple_binary_mget(memcached_st *ptr,
-                                             uint32_t master_server_key,
+                                             const uint32_t master_server_key,
                                              bool is_group_key_set,
                                              const char * const *keys,
                                              const size_t *key_length,
-                                             size_t number_of_keys, bool mget_mode)
+                                             const size_t number_of_keys, const bool mget_mode)
 {
   memcached_return_t rc= MEMCACHED_NOTFOUND;
 
@@ -502,17 +502,17 @@ static memcached_return_t simple_binary_mget(memcached_st *ptr,
       request.message.header.request.opcode= PROTOCOL_BINARY_CMD_GETK;
     }
 
-    memcached_return_t vk;
-    vk= memcached_validate_key_length(key_length[x],
-                                      ptr->flags.binary_protocol);
-    if (vk != MEMCACHED_SUCCESS)
     {
-      if (x > 0)
+      memcached_return_t vk= memcached_validate_key_length(key_length[x], ptr->flags.binary_protocol);
+      if (vk != MEMCACHED_SUCCESS)
       {
-        memcached_io_reset(instance);
-      }
+        if (x > 0)
+        {
+          memcached_io_reset(instance);
+        }
 
-      return vk;
+        return vk;
+      }
     }
 
     request.message.header.request.keylen= htons((uint16_t)(key_length[x] + memcached_array_size(ptr->_namespace)));
@@ -554,19 +554,12 @@ static memcached_return_t simple_binary_mget(memcached_st *ptr,
     for (uint32_t x= 0; x < memcached_server_count(ptr); ++x)
     {
       org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, x);
-      initialize_binary_request(instance, request.message.header);
 
       if (instance->response_count())
       {
-        if (memcached_io_write(instance) == false)
-        {
-          memcached_instance_response_reset(instance);
-          memcached_io_reset(instance);
-          rc= MEMCACHED_SOME_ERRORS;
-        }
-
-        if (memcached_io_write(instance, request.bytes,
-                               sizeof(request.bytes), true) == -1)
+        initialize_binary_request(instance, request.message.header);
+        if ((memcached_io_write(instance) == false) or
+            (memcached_io_write(instance, request.bytes, sizeof(request.bytes), true) == -1))
         {
           memcached_instance_response_reset(instance);
           memcached_io_reset(instance);
@@ -576,7 +569,6 @@ static memcached_return_t simple_binary_mget(memcached_st *ptr,
     }
   }
 
-
   return rc;
 }
 
@@ -585,7 +577,7 @@ static memcached_return_t replication_binary_mget(memcached_st *ptr,
                                                   bool* dead_servers,
                                                   const char *const *keys,
                                                   const size_t *key_length,
-                                                  size_t number_of_keys)
+                                                  const size_t number_of_keys)
 {
   memcached_return_t rc= MEMCACHED_NOTFOUND;
   uint32_t start= 0;
@@ -604,9 +596,11 @@ static memcached_return_t replication_binary_mget(memcached_st *ptr,
     for (uint32_t x= 0; x < number_of_keys; ++x)
     {
       if (hash[x] == memcached_server_count(ptr))
+      {
         continue; /* Already successfully sent */
+      }
 
-      uint32_t server= hash[x] + replica;
+      uint32_t server= hash[x] +replica;
 
       /* In case of randomized reads */
       if (randomize_read and ((server + start) <= (hash[x] + ptr->number_of_replicas)))
@@ -685,12 +679,12 @@ static memcached_return_t replication_binary_mget(memcached_st *ptr,
 }
 
 static memcached_return_t binary_mget_by_key(memcached_st *ptr,
-                                             uint32_t master_server_key,
+                                             const uint32_t master_server_key,
                                              bool is_group_key_set,
                                              const char * const *keys,
                                              const size_t *key_length,
-                                             size_t number_of_keys,
-                                             bool mget_mode)
+                                             const size_t number_of_keys,
+                                             const bool mget_mode)
 {
   if (ptr->number_of_replicas == 0)
   {
index f604731ae030c5c2705db849aff789b5d2b3e20c..0aabc2487c6f254f49ad5f70c24076fb7d7bb030 100644 (file)
@@ -50,6 +50,7 @@ noinst_HEADERS+= libmemcached/udp.hpp
 noinst_HEADERS+= libmemcached/version.hpp 
 noinst_HEADERS+= libmemcached/virtual_bucket.h 
 noinst_HEADERS+= libmemcached/watchpoint.h
+noinst_HEADERS+= libmemcached/windows.hpp
 
 lib_LTLIBRARIES+= libmemcached/libmemcached.la
 EXTRA_libmemcached_libmemcached_la_DEPENDENCIES=
@@ -61,8 +62,8 @@ libmemcached_libmemcached_la_CXXFLAGS= -DBUILDING_LIBMEMCACHED
 if BUILD_WIN32
 libmemcached_libmemcached_la_CFLAGS+= -DBUILDING_HASHKIT
 libmemcached_libmemcached_la_CXXFLAGS+= -DBUILDING_HASHKIT
-libmemcached_libmemcached_la_LIBADD+= -lmingw64
-libmemcached_libmemcached_la_LIBADD+= -lws2_64
+libmemcached_libmemcached_la_LIBADD+= -lmingw32
+libmemcached_libmemcached_la_LIBADD+= -lws2_32
 endif
 
 libmemcached_libmemcached_la_SOURCES+= libmemcached/instance.cc
index f6cc36969de7255653517214cf0271e4629b9946..1cd03769fadfe932fc6d69c1de8a3c3ed1168d69 100644 (file)
@@ -40,7 +40,7 @@
 #include <libmemcached/common.h>
 
 #ifdef HAVE_SYS_SOCKET_H
-#  include <sys/socket.h>
+# include <sys/socket.h>
 #endif
 
 void initialize_binary_request(org::libmemcached::Instance* server, protocol_binary_request_header& header)
@@ -212,7 +212,7 @@ static memcached_return_t io_wait(org::libmemcached::Instance* instance,
 
   if (instance->root->poll_timeout == 0) // Mimic 0 causes timeout behavior (not all platforms do this)
   {
-    return memcached_set_error(*instance, MEMCACHED_TIMEOUT, MEMCACHED_AT);
+    return memcached_set_error(*instance, MEMCACHED_TIMEOUT, MEMCACHED_AT, memcached_literal_param("poll_timeout() was set to zero"));
   }
 
   size_t loop_max= 5;
@@ -257,7 +257,7 @@ static memcached_return_t io_wait(org::libmemcached::Instance* instance,
 
     if (active_fd == 0)
     {
-      return memcached_set_error(*instance, MEMCACHED_TIMEOUT, MEMCACHED_AT);
+      return memcached_set_error(*instance, MEMCACHED_TIMEOUT, MEMCACHED_AT, memcached_literal_param("No active_fd were found"));
     }
 
     // Only an error should result in this code being called.
index abd15d4cb770886f9f114b40078941e77b84b6cb..6fdf242c90d0637c2eba38df2d9c3f2cb716fe28 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "libmemcached/common.h"
 
-#if defined(WIN32) || defined(__MINGW32__)
+#if defined(_WIN32)
 #include "libmemcached/poll.h"
 
 #include <sys/time.h>
@@ -31,7 +31,7 @@ int poll(struct pollfd fds[], nfds_t nfds, int tmo)
   {
     if (fds[x].events & (POLLIN | POLLOUT))
     {
-#ifndef WIN32
+#ifndef _WIN32
       if (fds[x].fd > maxfd)
       {
         maxfd= fds[x].fd;
@@ -82,4 +82,4 @@ int poll(struct pollfd fds[], nfds_t nfds, int tmo)
    return ret;
 }
 
-#endif // defined(WIN32) || defined(__MINGW32__)
+#endif // defined(_WIN32)
index 8445f009421987043c586db45730798a0aae66b9..46636c402e1d32b12d22a8f7abe2c94db59f54c9 100644 (file)
@@ -12,7 +12,7 @@
 
 #pragma once
 
-#if defined(WIN32) || defined(__MINGW32__)
+#if defined(_WIN32)
 
 #include <winsock2.h>
 
@@ -22,7 +22,7 @@ extern "C" {
 
 typedef struct pollfd
 {
-#ifdef WIN32
+#if defined(_WIN32)
   SOCKET fd;
 #else
   int fd;
@@ -45,4 +45,4 @@ int poll(struct pollfd fds[], nfds_t nfds, int tmo);
 }
 #endif
 
-#endif // defined(WIN32) || defined(__MINGW32__)
+#endif // defined(_WIN32)
index 96772ff380ac064d6182da66dd94ae6f89f04c97..391c9309814ef10c0eb4d04c0ae0644ed4fd1f94 100644 (file)
@@ -648,6 +648,25 @@ static memcached_return_t binary_read_one_response(org::libmemcached::Instance*
       }
       break;
 
+    case PROTOCOL_BINARY_CMD_TOUCH:
+      {
+        rc= MEMCACHED_SUCCESS;
+        if (bodylen == 4) // The four byte read is a bug?
+        {
+          char touch_buffer[4]; // @todo document this number
+          rc= memcached_safe_read(instance, touch_buffer, sizeof(touch_buffer));
+#if 0
+          fprintf(stderr, "%s:%d %d %d %d %d %.*s(%d)\n", __FILE__, __LINE__,
+                  int(touch_buffer[0]),
+                  int(touch_buffer[1]),
+                  int(touch_buffer[2]),
+                  int(touch_buffer[3]),
+                  int(bodylen), touch_buffer, int(bodylen));
+#endif
+        }
+        return memcached_set_error(*instance, rc, MEMCACHED_AT);
+      }
+
     case PROTOCOL_BINARY_CMD_FLUSH:
     case PROTOCOL_BINARY_CMD_QUIT:
     case PROTOCOL_BINARY_CMD_SET:
@@ -656,13 +675,8 @@ static memcached_return_t binary_read_one_response(org::libmemcached::Instance*
     case PROTOCOL_BINARY_CMD_APPEND:
     case PROTOCOL_BINARY_CMD_PREPEND:
     case PROTOCOL_BINARY_CMD_DELETE:
-    case PROTOCOL_BINARY_CMD_TOUCH:
       {
-        if (bodylen != 0)
-        {
-          char touch_buffer[32]; // @todo document this number
-          rc= memcached_safe_read(instance, buffer, sizeof(touch_buffer));
-        }
+        WATCHPOINT_ASSERT(bodylen == 0);
         return MEMCACHED_SUCCESS;
       }
 
diff --git a/libmemcached/windows.hpp b/libmemcached/windows.hpp
new file mode 100644 (file)
index 0000000..40564b1
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Libmemcached library
+ *
+ * Copyright (C) 2012 Data Differential, http://datadifferential.com/
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ *     * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#pragma once
+
+#ifdef __cplusplus
+# include <cerrno>
+#else
+# include <errno.h>
+#endif
+
+#ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+#endif
+
+#ifndef _WIN32_WINNT
+# define _WIN32_WINNT 0x0501
+#endif
+
+#ifdef __MINGW32__
+# if(_WIN32_WINNT >= 0x0501)
+# else
+#  undef _WIN32_WINNT
+#  define _WIN32_WINNT 0x0501
+# endif /* _WIN32_WINNT >= 0x0501 */
+#endif /* __MINGW32__ */
+
+#if defined(HAVE_WINSOCK2_H) && HAVE_WINSOCK2_H
+# include <winsock2.h>
+#endif
+
+#if defined(HAVE_WS2TCPIP_H) && HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+#endif
+
+#if defined(HAVE_IO_H) && HAVE_IO_H
+# include <io.h>
+#endif
+
+struct sockaddr_un
+{
+  short int sun_family;
+  char sun_path[108];
+};
+
+static inline int translate_windows_error()
+{
+  int local_errno= WSAGetLastError();
+
+  switch(local_errno) {
+  case WSAEINVAL:
+    local_errno= EINPROGRESS;
+    break;
+  case WSAEALREADY:
+  case WSAEWOULDBLOCK:
+    local_errno= EAGAIN;
+    break;
+
+  case WSAECONNREFUSED:
+    local_errno= ECONNREFUSED;
+    break;
+
+  case WSAENETUNREACH:
+    local_errno= ENETUNREACH;
+    break;
+
+  case WSAETIMEDOUT:
+    local_errno= ETIMEDOUT;
+    break;
+
+  case WSAECONNRESET:
+    local_errno= ECONNRESET;
+    break;
+
+  case WSAEADDRINUSE:
+    local_errno= EADDRINUSE;
+    break;
+
+  case WSAEOPNOTSUPP:
+    local_errno= EOPNOTSUPP;
+    break;
+
+  case WSAENOPROTOOPT:
+    local_errno= ENOPROTOOPT;
+    break;
+
+  default:
+    break;
+  }
+
+  return local_errno;
+}
index 01738accf3ede3efef13c50aada6712a6d988436..3ce0131c1f78f18dbe1521b6a0031fb20e896081 100644 (file)
@@ -36,8 +36,8 @@
 
 #pragma once
 
-#ifndef WIN32
-#include <netdb.h>
+#ifndef _WIN32
+# include <netdb.h>
 #endif
 
 #include <sys/types.h>
index a8bf17e89d3b66bcc2163b1d25ae3a5953d8a26c..6193fbb3cd094065a089c9a21cc84a1c67ae0127 100644 (file)
@@ -76,7 +76,7 @@ void set_alarm(long tv_sec, long tv_usec)
     }
   }
 
-#if defined(TARGET_OS_OSX) && TARGET_OS_OSX
+#ifdef __APPLE__
   struct timeval it_value= { time_t(tv_sec), suseconds_t(tv_usec) };
 #else
   struct timeval it_value= { tv_sec, tv_usec };
index 7be0221c343b57bb919a8011a0497c990cc171c4..b611e1a9fcd18a7cae461a8e5b85162e767a465e 100644 (file)
@@ -69,7 +69,7 @@
 # include <arpa/inet.h>
 #endif
 
-#if defined(WIN32) || defined(__MINGW32__)
+#if defined(_WIN32)
 # include "win32/wrappers.h"
 # define get_socket_errno() WSAGetLastError()
 #else
index 114ac672515af7b7d99ff3629574f8096f0fdf5d..cd7d6aa67e11e104567d8aacb0a44d53a2da4e83 100644 (file)
@@ -41,7 +41,7 @@ namespace libtest {
 
 void dream(time_t tv_sec, long tv_nsec)
 {
-#ifdef WIN32
+#if defined(_WIN32)
   if (tv_sec == 0 and tv_nsec)
   {
     tv_sec++;
index 52e96380ca60ac873f53e63287ab4058b8db8432..100b8e2044cc34856b986d68ce642fdf35d88d18 100644 (file)
@@ -51,7 +51,7 @@
 # include <string.h>
 #endif
 
-#ifdef _WIN32
+#if defined(_WIN32)
 # include <malloc.h>
 #else
 # include <alloca.h>
diff --git a/libtest/m4/memcached.m4 b/libtest/m4/memcached.m4
deleted file mode 100644 (file)
index 0fece50..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#serial 2
-
-AC_DEFUN([YATL_MEMCACHED],
-         [AX_WITH_PROG(MEMCACHED_BINARY, [memcached])
-         AS_IF([test -f "$ac_cv_path_MEMCACHED_BINARY"],
-               [AC_DEFINE([HAVE_MEMCACHED_BINARY], [1], [If Memcached binary is available])
-               AC_DEFINE_UNQUOTED([MEMCACHED_BINARY], "$ac_cv_path_MEMCACHED_BINARY", [Name of the memcached binary used in make test])],
-               [AC_DEFINE([HAVE_MEMCACHED_BINARY], [1], [If Memcached binary is available])
-               AC_DEFINE([MEMCACHED_BINARY], ["memcached/memcached"], [Name of the memcached binary used in make test])
-               ])
-         ])
index 4415863f63ab7954e501d1466c3e3081ec3dd7c2..61d1a2f0f4ecbbf3c0619a39025ac36b62d9ffe6 100644 (file)
@@ -7,10 +7,8 @@ AC_SUBST([LIBTEST_VERSION],[1.0])
 AC_CONFIG_FILES([libtest/version.h])
 
 m4_include([libtest/m4/mysql.m4])
-m4_include([libtest/m4/memcached.m4])
 AC_DEFINE([HAVE_MEMCACHED_SASL_BINARY],[0],[If Memcached binary with sasl support is available])
 
 YATL_MYSQL
-YATL_MEMCACHED
 
 AC_CONFIG_FILES([libtest/yatlcon.h])
index b31518aaa624e197e6e09c43951af422f473d294..2daeb1a19c4015c9c67ebdd0237c5bcd5f48b2ab 100644 (file)
@@ -1,3 +1,4 @@
+# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 # ===========================================================================
 #      https://github.com/BrianAker/ddm4/
 # ===========================================================================
@@ -52,7 +53,7 @@
 # ?  _APPEND_COMPILE_FLAGS_ERROR([-Wlong-long]) -- Don't turn on for
 # compatibility issues memcached_stat_st
 
-#serial 7
+#serial 8
 
 AC_DEFUN([_WARNINGS_AS_ERRORS],
     [AC_CACHE_CHECK([if all warnings into errors],[ac_cv_warnings_as_errors],
@@ -75,10 +76,12 @@ AC_DEFUN([_APPEND_COMPILE_FLAGS_ERROR],
 # Everything above this does the heavy lifting, while what follows does the specifics.
 
 AC_DEFUN([_HARDEN_LINKER_FLAGS],
-         [_APPEND_LINK_FLAGS_ERROR([-z relro -z now])
-         #_APPEND_LINK_FLAGS_ERROR([-pie])
-         AS_IF([test "x$ac_cv_warnings_as_errors" = xyes],
-               [AX_APPEND_LINK_FLAGS([-Werror])])
+         [
+         AS_IF([test "$CC" != "clang"],
+           [_APPEND_LINK_FLAGS_ERROR([-z relro -z now])
+#_APPEND_LINK_FLAGS_ERROR([-pie])
+           AS_IF([test "x$ac_cv_warnings_as_errors" = xyes],
+             [AX_APPEND_LINK_FLAGS([-Werror])])])
          ])
 
 AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS],
@@ -86,6 +89,7 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS],
 
          AS_IF([test "x$ax_enable_debug" = xyes],
            [CFLAGS=''
+           _APPEND_COMPILE_FLAGS_ERROR([-H])
            _APPEND_COMPILE_FLAGS_ERROR([-ggdb])
            _APPEND_COMPILE_FLAGS_ERROR([-g])
            _APPEND_COMPILE_FLAGS_ERROR([-O0])],
@@ -93,19 +97,26 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS],
            _APPEND_COMPILE_FLAGS_ERROR([-O2])])
 
          AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
-           [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])],
-           [_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])])
+           [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])
+           _APPEND_COMPILE_FLAGS_ERROR([-Wpragmas])
+           _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])],
+           [_APPEND_COMPILE_FLAGS_ERROR([-Wno-unknown-pragmas])
+           _APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])])
+
+         AS_IF([test "$CC" = "clang"],
+           [_APPEND_COMPILE_FLAGS_ERROR([-Qunused-arguments])])
 
          _APPEND_COMPILE_FLAGS_ERROR([-Wall])
          _APPEND_COMPILE_FLAGS_ERROR([-Wextra])
-         _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])
          _APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail])
          _APPEND_COMPILE_FLAGS_ERROR([-std=c99])
 # Anything below this comment please keep sorted.
-         _APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1])
 # _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wunsuffixed-float-constants])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wjump-misses-init])
           _APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes])
           _APPEND_COMPILE_FLAGS_ERROR([-Waddress])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wvarargs])
           _APPEND_COMPILE_FLAGS_ERROR([-Warray-bounds])
           _APPEND_COMPILE_FLAGS_ERROR([-Wbad-function-cast])
 # Not in use -Wc++-compat
@@ -114,6 +125,7 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS],
           _APPEND_COMPILE_FLAGS_ERROR([-Wfloat-equal])
           _APPEND_COMPILE_FLAGS_ERROR([-Wformat-security])
           _APPEND_COMPILE_FLAGS_ERROR([-Wformat=2])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wformat-y2k])
           _APPEND_COMPILE_FLAGS_ERROR([-Wlogical-op])
           _APPEND_COMPILE_FLAGS_ERROR([-Wmaybe-uninitialized])
           _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-field-initializers])
@@ -123,7 +135,6 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS],
           _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-prototypes])
           _APPEND_COMPILE_FLAGS_ERROR([-Wnested-externs])
           _APPEND_COMPILE_FLAGS_ERROR([-Wnormalized=id])
-          _APPEND_COMPILE_FLAGS_ERROR([-Wold-style-definition])
           _APPEND_COMPILE_FLAGS_ERROR([-Woverride-init])
           _APPEND_COMPILE_FLAGS_ERROR([-Wpointer-arith])
           _APPEND_COMPILE_FLAGS_ERROR([-Wpointer-sign])
@@ -140,10 +151,36 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS],
           _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-overflow=1])
           _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-prototypes])
           _APPEND_COMPILE_FLAGS_ERROR([-Wswitch-enum])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wtrampolines])
           _APPEND_COMPILE_FLAGS_ERROR([-Wundef])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wunsafe-loop-optimizations])
+          _APPEND_COMPILE_FLAGS_ERROR([-funsafe-loop-optimizations])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wclobbered])
           _APPEND_COMPILE_FLAGS_ERROR([-Wunused])
           _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result])
           _APPEND_COMPILE_FLAGS_ERROR([-Wunused-variable])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wunused-parameter])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wunused-local-typedefs])
           _APPEND_COMPILE_FLAGS_ERROR([-Wwrite-strings])
           _APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all])
           _APPEND_COMPILE_FLAGS_ERROR([-fwrapv])
@@ -157,6 +194,7 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS],
                   [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2])
                   #_APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector])
                   #_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector])
+                  #_APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1])
                   _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all])
                   ])])])])
 
@@ -172,6 +210,7 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS],
 
          AS_IF([test "x$ax_enable_debug" = xyes],
            [CXXFLAGS=''
+           _APPEND_COMPILE_FLAGS_ERROR([-H])
            _APPEND_COMPILE_FLAGS_ERROR([-ggdb])
            _APPEND_COMPILE_FLAGS_ERROR([-g])
            _APPEND_COMPILE_FLAGS_ERROR([-O0])],
@@ -179,17 +218,22 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS],
            _APPEND_COMPILE_FLAGS_ERROR([-O2])])
 
          AS_IF([test "x$ac_cv_vcs_checkout" = xyes],
-           [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])],
-           [_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])])
+           [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])
+           _APPEND_COMPILE_FLAGS_ERROR([-Wpragmas])
+           _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])],
+           [_APPEND_COMPILE_FLAGS_ERROR([-Wno-unknown-pragmas])
+           _APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])])
+
+         AS_IF([test "$CXX" = "clang++"],
+           [_APPEND_COMPILE_FLAGS_ERROR([-Qunused-arguments])])
 
          _APPEND_COMPILE_FLAGS_ERROR([-Wall])
          _APPEND_COMPILE_FLAGS_ERROR([-Wextra])
-         _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])
          _APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail])
 # Anything below this comment please keep sorted.
-         _APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1])
 # _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute])
           _APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wvarargs])
           _APPEND_COMPILE_FLAGS_ERROR([-Waddress])
           _APPEND_COMPILE_FLAGS_ERROR([-Warray-bounds])
           _APPEND_COMPILE_FLAGS_ERROR([-Wchar-subscripts])
@@ -197,6 +241,7 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS],
           _APPEND_COMPILE_FLAGS_ERROR([-Wctor-dtor-privacy])
           _APPEND_COMPILE_FLAGS_ERROR([-Wfloat-equal])
           _APPEND_COMPILE_FLAGS_ERROR([-Wformat=2])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wformat-y2k])
           _APPEND_COMPILE_FLAGS_ERROR([-Wmaybe-uninitialized])
           _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-field-initializers])
           _APPEND_COMPILE_FLAGS_ERROR([-Wlogical-op])
@@ -217,11 +262,39 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS],
           _APPEND_COMPILE_FLAGS_ERROR([-Wsign-compare])
           _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-overflow=1])
           _APPEND_COMPILE_FLAGS_ERROR([-Wswitch-enum])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wtrampolines])
           _APPEND_COMPILE_FLAGS_ERROR([-Wundef])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wunsafe-loop-optimizations])
+          _APPEND_COMPILE_FLAGS_ERROR([-funsafe-loop-optimizations])
           _APPEND_COMPILE_FLAGS_ERROR([-Wc++11-compat])
+#         _APPEND_COMPILE_FLAGS_ERROR([-Weffc++])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound])
+          _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr])
+#          _APPEND_COMPILE_FLAGS_ERROR([-Wold-style-cast])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wclobbered])
           _APPEND_COMPILE_FLAGS_ERROR([-Wunused])
           _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result])
           _APPEND_COMPILE_FLAGS_ERROR([-Wunused-variable])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wunused-parameter])
+          _APPEND_COMPILE_FLAGS_ERROR([-Wunused-local-typedefs])
           _APPEND_COMPILE_FLAGS_ERROR([-Wwrite-strings])
           _APPEND_COMPILE_FLAGS_ERROR([-Wformat-security])
           _APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all])
@@ -236,6 +309,7 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS],
                 [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2])
                 #_APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector])
                 #_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector])
+                #_APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1])
                 _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all])
                 ])])])])
 
index 686bff23aa9d5da071bd4180a2d8bc4cb9d67c04..c576bad5f082d703c11d41306aa19933c9c6dd39 100644 (file)
@@ -20,7 +20,7 @@
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.
 
-#serial 4
+#serial 5
  
 AC_DEFUN([AX_LIBEVENT],
          [AC_PREREQ([2.63])dnl
@@ -28,15 +28,15 @@ AC_DEFUN([AX_LIBEVENT],
            [AX_SAVE_FLAGS
            LIBS="-levent $LIBS"
            AC_LANG_PUSH([C])
-           AC_RUN_IFELSE([AC_LANG_PROGRAM([
+           AC_RUN_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/types.h>
 #include <sys/time.h>
 #include <stdlib.h>
 #include <event.h>
-               ],[
+               ]],[[
                struct event_base *tmp_event= event_init();
                event_base_free(tmp_event);
-               ])],
+               ]])],
              [ax_cv_libevent=yes],
              [ax_cv_libevent=no],
              [AC_MSG_WARN([test program execution failed])])
@@ -62,15 +62,15 @@ AC_DEFUN([AX_LIBEVENT2],
       [AX_SAVE_FLAGS
       LIBS="-levent $LIBS"
       AC_LANG_PUSH([C])
-      AC_RUN_IFELSE([AC_LANG_PROGRAM([
+      AC_RUN_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/types.h>
 #include <sys/time.h>
 #include <stdlib.h>
 #include <event2/event.h>
-          ],[
-          struct event_base *tmp_event= event_init();
-          event_base_free(tmp_event);
-          ])],
+          ]],[[
+          struct event_base *___event_base= event_base_new();  
+          event_base_free(___event_base);
+          ]])],
         [ax_cv_libevent2=yes],
         [ax_cv_libevent2=no],
         [AC_MSG_WARN([test program execution failed])])
@@ -97,16 +97,18 @@ AC_DEFUN([AX_LIBEVENT2_EVHTTP],
       [AX_SAVE_FLAGS
       LIBS="-levent $LIBS"
       AC_LANG_PUSH([C])
-      AC_RUN_IFELSE([AC_LANG_PROGRAM([
+      AC_RUN_IFELSE([AC_LANG_PROGRAM([[
 #include <sys/types.h>
 #include <sys/time.h>
 #include <stdlib.h>
 #include <event2/event.h>
 #include <event2/http.h>
-          ],[
-          struct event_base *libbase= event_base_new();  
-          struct evhttp *libsrvr= evhttp_new(libbase);
-          ])],
+          ]],[[
+          struct event_base *___event_base= event_base_new();  
+          struct evhttp *___evhttp= evhttp_new(___event_base);
+          evhttp_free(___evhttp);
+          event_base_free(___event_base);
+          ]])],
         [ax_cv_libevent2_evhttp=yes],
         [ax_cv_libevent2_evhttp=no],
         [AC_MSG_WARN([test program execution failed])])
diff --git a/m4/ax_memcached.m4 b/m4/ax_memcached.m4
new file mode 100644 (file)
index 0000000..21067c6
--- /dev/null
@@ -0,0 +1,58 @@
+# vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+# ===========================================================================
+#      https://github.com/BrianAker/ddm4/
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_PROG_MEMCACHED
+#
+# DESCRIPTION
+#
+#   Check for memcached and list version
+#
+# LICENSE
+#
+#  Copyright (C) 2013 Brian Aker
+#  All rights reserved.
+#
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions are
+#  met:
+#
+#      * Redistributions of source code must retain the above copyright
+#  notice, this list of conditions and the following disclaimer.
+#
+#      * Redistributions in binary form must reproduce the above
+#  copyright notice, this list of conditions and the following disclaimer
+#  in the documentation and/or other materials provided with the
+#  distribution.
+#
+#      * The names of its contributors may not be used to endorse or
+#  promote products derived from this software without specific prior
+#  written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#serial 3
+
+AC_DEFUN([AX_PROG_MEMCACHED],
+    [AX_WITH_PROG([MEMCACHED_BINARY],[memcached])
+    AS_IF([test -f "$ac_cv_path_MEMCACHED_BINARY"],
+      [AC_DEFINE([HAVE_MEMCACHED_BINARY], [1], [If Memcached binary is available])
+      AC_DEFINE_UNQUOTED([MEMCACHED_BINARY],"$ac_cv_path_MEMCACHED_BINARY",[Name of the memcached binary used in make test])
+      ax_memcached_version=`$MEMCACHED_BINARY -h | sed 1q | awk '{print \$ 2 }' | sed 's|[\-a-z0-9]*$||' | awk -F. '{printf "%d.%d.%d", $[]1, $[]2, $[]3}'`
+      AC_MSG_RESULT([memcached version "$ax_memcached_version"])
+      AC_DEFINE_UNQUOTED([MEMCACHED_VERSION],"$ax_memcached_version",[Memcached binary version])
+      ])
+    ])
index 56472c72efdb6fd82c5e54273a7e4f7245e7416b..01ff25d90abd58f28cc055d3703fccae6af1dd3f 100644 (file)
@@ -49,8 +49,7 @@
         AC_DEFINE([__APPLE_CC__],[1],[Workaround for bug in FreeBSD headers])],
         [*solaris*],[AC_DEFINE([TARGET_OS_SOLARIS],[1],[Whether we are building for Solaris])],
         [*darwin*],
-        [TARGET_OSX="true"
-        AC_DEFINE([TARGET_OS_OSX],[1],[Whether we build for OSX])],
+        [TARGET_OSX="true"],
         [*linux*],
         [TARGET_LINUX="true"
         AC_DEFINE([TARGET_OS_LINUX],[1],[Whether we build for Linux])])
index fe28e73318a8d441ac8b8c0adf89985ab783ea6f..643812d35a9f8529caca322bf82cb42090da8aa9 100644 (file)
@@ -144,6 +144,7 @@ test_st behavior_tests[] ={
   {"MEMCACHED_BEHAVIOR_TCP_KEEPALIVE", false, (test_callback_fn*)MEMCACHED_BEHAVIOR_TCP_KEEPALIVE_test},
   {"MEMCACHED_BEHAVIOR_TCP_KEEPIDLE", false, (test_callback_fn*)MEMCACHED_BEHAVIOR_TCP_KEEPIDLE_test},
   {"MEMCACHED_BEHAVIOR_POLL_TIMEOUT", false, (test_callback_fn*)MEMCACHED_BEHAVIOR_POLL_TIMEOUT_test},
+  {"MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH_TEST", true, (test_callback_fn*)MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH_TEST },
   {"MEMCACHED_CALLBACK_DELETE_TRIGGER_and_MEMCACHED_BEHAVIOR_NOREPLY", false, (test_callback_fn*)test_MEMCACHED_CALLBACK_DELETE_TRIGGER_and_MEMCACHED_BEHAVIOR_NOREPLY},
   {0, 0, 0}
 };
index 46f940d9d47ad6be688db4283f81727e844861fa..4241220ae41a2d7846f75fca55e8183a6a9316eb 100644 (file)
@@ -1750,6 +1750,54 @@ test_return_t mget_execute(memcached_st *original_memc)
   return TEST_SUCCESS;
 }
 
+test_return_t MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH_TEST(memcached_st *original_memc)
+{
+  test_skip(true, memcached_behavior_get(original_memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL));
+
+  memcached_st *memc= create_single_instance_memcached(original_memc, "--BINARY-PROTOCOL");
+  test_true(memc);
+
+  test_skip(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH, 8));
+
+  keys_st keys(20480);
+
+  /* First add all of the items.. */
+  char blob[1024] = {0};
+
+  for (size_t x= 0; x < keys.size(); ++x)
+  {
+    uint64_t query_id= memcached_query_id(memc);
+    memcached_return_t rc= memcached_add(memc,
+                                         keys.key_at(x), keys.length_at(x),
+                                         blob, sizeof(blob),
+                                         0, 0);
+    test_true(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED);
+    test_compare(query_id +1, memcached_query_id(memc));
+  }
+
+  /* Try to get all of them with a large multiget */
+  size_t counter= 0;
+  memcached_execute_fn callbacks[]= { &callback_counter };
+  test_compare(MEMCACHED_SUCCESS, 
+               memcached_mget_execute(memc,
+                                      keys.keys_ptr(), keys.lengths_ptr(),
+                                      keys.size(), callbacks, &counter, 1));
+
+  {
+    uint64_t query_id= memcached_query_id(memc);
+    test_compare(MEMCACHED_SUCCESS, 
+                 memcached_fetch_execute(memc, callbacks, (void *)&counter, 1));
+    test_compare(query_id, memcached_query_id(memc));
+
+    /* Verify that we got all of the items */
+    test_compare(keys.size(), counter);
+  }
+
+  memcached_free(memc);
+
+  return TEST_SUCCESS;
+}
+
 #define REGRESSION_BINARY_VS_BLOCK_COUNT  20480
 static pairs_st *global_pairs= NULL;
 
@@ -4601,7 +4649,7 @@ test_return_t regression_bug_583031(memcached_st *)
 {
   memcached_st *memc= memcached_create(NULL);
   test_true(memc);
-  test_compare(MEMCACHED_SUCCESS, memcached_server_add(memc, "10.2.3.4", 11211));
+  test_compare(MEMCACHED_SUCCESS, memcached_server_add(memc, "10.2.251.4", 11211));
 
   memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT, 3000);
   memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_RETRY_TIMEOUT, 1000);
index 374bc9c494acd5fdc332bfcea344e6405c063279..0ecea0d2d54e6362117818036268d8743efae004 100644 (file)
@@ -108,6 +108,7 @@ test_return_t memcached_server_remove_test(memcached_st*);
 test_return_t memcached_stat_execute_test(memcached_st *memc);
 test_return_t mget_end(memcached_st *memc);
 test_return_t mget_execute(memcached_st *original_memc);
+test_return_t MEMCACHED_BEHAVIOR_IO_KEY_PREFETCH_TEST(memcached_st *original_memc);
 test_return_t mget_result_alloc_test(memcached_st *memc);
 test_return_t mget_result_function(memcached_st *memc);
 test_return_t mget_result_test(memcached_st *memc);
index 044273fd4d0a2d5a7c3033bfebdc598d614a27f8..08ff68f4a4921add36039560d29ffed6cc75b5d0 100644 (file)
@@ -48,14 +48,13 @@ using namespace libtest;
 static test_return_t pre_touch(memcached_st *memc)
 {
   test_compare(MEMCACHED_SUCCESS, memcached_version(memc));
-  test_skip(true, libmemcached_util_version_check(memc, 1, 4, 8));
+  test_skip(true, libmemcached_util_version_check(memc, 1, 4, 15));
 
   return TEST_SUCCESS;
 }
 
 test_return_t test_memcached_touch(memcached_st *memc)
 {
-
   test_skip(TEST_SUCCESS, pre_touch(memc));
 
   size_t len;
@@ -85,21 +84,20 @@ test_return_t test_memcached_touch(memcached_st *memc)
     free(value);
   }
 
-  test_compare(MEMCACHED_SUCCESS,
-               memcached_touch(memc, test_literal_param(__func__), 60 *60));
+  rc= memcached_touch(memc, test_literal_param(__func__), 60 *60);
+  ASSERT_EQ_(MEMCACHED_SUCCESS, rc, "%s", memcached_last_error_message(memc));
 
   rc= memcached_touch(memc, test_literal_param(__func__), 60 *60 *24 *60);
-  test_compare(MEMCACHED_SUCCESS, rc);
+  ASSERT_EQ_(MEMCACHED_SUCCESS, rc, "%s", memcached_last_error_message(memc));
 
-  test_compare(MEMCACHED_NOTFOUND,
-               memcached_exist(memc, test_literal_param(__func__)));
+  rc= memcached_exist(memc, test_literal_param(__func__));
+  ASSERT_EQ_(MEMCACHED_NOTFOUND, rc, "%s", memcached_last_error_message(memc));
 
   return TEST_SUCCESS;
 }
 
 test_return_t test_memcached_touch_by_key(memcached_st *memc)
 {
-
   test_skip(TEST_SUCCESS, pre_touch(memc));
 
   size_t len;
@@ -132,19 +130,20 @@ test_return_t test_memcached_touch_by_key(memcached_st *memc)
     free(value);
   }
 
-  test_compare(MEMCACHED_SUCCESS,
-               memcached_touch_by_key(memc,
-                                      test_literal_param("grouping_key"),
-                                      test_literal_param(__func__),
-                                      60 *60));
+  rc= memcached_touch_by_key(memc,
+                             test_literal_param("grouping_key"),
+                             test_literal_param(__func__),
+                             60 *60);
+  ASSERT_EQ_(MEMCACHED_SUCCESS, rc, "%s", memcached_last_error_message(memc));
 
-  test_compare(MEMCACHED_SUCCESS,
-               memcached_touch_by_key(memc,
-                                      test_literal_param("grouping_key"),
-                                      test_literal_param(__func__),
-                                      60 *60 *24 *60));
-  test_compare(MEMCACHED_NOTFOUND,
-               memcached_exist_by_key(memc, test_literal_param("grouping_key"),test_literal_param(__func__)));
+  rc= memcached_touch_by_key(memc,
+                             test_literal_param("grouping_key"),
+                             test_literal_param(__func__),
+                             60 *60 *24 *60);
+  ASSERT_EQ_(MEMCACHED_SUCCESS, rc, "%s", memcached_last_error_message(memc));
+
+  rc= memcached_exist_by_key(memc, test_literal_param("grouping_key"),test_literal_param(__func__));
+  ASSERT_EQ_(MEMCACHED_NOTFOUND, rc, "%s", memcached_last_error_message(memc));
 
   return TEST_SUCCESS;
 }
index d59244715f7e127af7812487c9d8bfe5a6b8f245..732773d743b933cff6629f25c47646f7cac9321b 100644 (file)
@@ -483,7 +483,7 @@ static test_return_t udp_get_test(memcached_st *memc)
   size_t vlen;
   Expected expected_ids;
   get_udp_request_ids(memc, expected_ids);
-  test_null(memcached_get(memc, test_literal_param("foo"), &vlen, (uint32_t)0, &rc));
+  test_null(memcached_get(memc, test_literal_param("foo"), &vlen, NULL, &rc));
   test_compare(MEMCACHED_NOT_SUPPORTED, rc);
 
   return post_udp_op_check(memc, expected_ids);