Merge lp:~brianaker/libmemcached/merge-of-1.0 into lp:libmemcached

Proposed by Brian Aker
Status: Merged
Merged at revision: 1109
Proposed branch: lp:~brianaker/libmemcached/merge-of-1.0
Merge into: lp:libmemcached
Diff against target: 1745 lines (+475/-347)
39 files modified
bootstrap.sh (+15/-17)
clients/generator.cc (+5/-3)
clients/memcp.cc (+1/-1)
clients/memslap.cc (+5/-3)
clients/memtouch.cc (+1/-1)
clients/ms_setting.h (+1/-1)
docs/memcached_auto.rst (+4/-2)
libmemcached-1.2/deprecated_types.h (+1/-0)
libmemcached/auto.cc (+5/-0)
libmemcached/connect.cc (+1/-1)
libmemcached/error.cc (+138/-119)
libmemcached/get.cc (+15/-5)
libmemcached/io.cc (+9/-4)
libmemcached/io.hpp (+2/-1)
libmemcached/key.cc (+47/-23)
libmemcached/key.hpp (+0/-24)
libmemcached/response.cc (+10/-1)
libmemcached/stats.cc (+7/-6)
libmemcached/string.cc (+11/-9)
libmemcached/touch.cc (+2/-2)
libtest/cmdline.cc (+1/-1)
libtest/core.cc (+2/-2)
libtest/main.cc (+6/-3)
libtest/unittest.cc (+5/-5)
m4/ax_debug.m4 (+4/-2)
tests/cli.am (+9/-0)
tests/libmemcached-1.0/all_tests.h (+4/-2)
tests/libmemcached-1.0/mem_functions.cc (+113/-73)
tests/libmemcached-1.0/mem_functions.h (+2/-0)
tests/libmemcached-1.0/plus.cpp (+7/-0)
tests/libmemcached_world.h (+2/-0)
tests/libmemcached_world_socket.h (+3/-0)
tests/memcat.cc (+7/-5)
tests/memcp.cc (+4/-0)
tests/memdump.cc (+6/-13)
tests/memexist.cc (+8/-8)
tests/memping.cc (+2/-2)
tests/memrm.cc (+3/-1)
tests/memtouch.cc (+7/-7)
To merge this branch: bzr merge lp:~brianaker/libmemcached/merge-of-1.0
Reviewer Review Type Date Requested Status
Tangent Trunk Pending
Review via email: mp+190637@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bootstrap.sh'
--- bootstrap.sh 2013-06-13 22:13:53 +0000
+++ bootstrap.sh 2013-10-11 12:20:38 +0000
@@ -420,10 +420,6 @@
420 ret=1;420 ret=1;
421 # If we are executing on OSX use CLANG, otherwise only use it if we find it in the ENV421 # If we are executing on OSX use CLANG, otherwise only use it if we find it in the ENV
422 case $HOST_OS in422 case $HOST_OS in
423 *-darwin-*)
424 run CC=clang CXX=clang++ $top_srcdir/configure "$BUILD_CONFIGURE_ARG" || die "Cannot execute CC=clang CXX=clang++ configure $BUILD_CONFIGURE_ARG"
425 ret=$?
426 ;;
427 rhel-5*)423 rhel-5*)
428 command_exists 'gcc44' || die "Could not locate gcc44"424 command_exists 'gcc44' || die "Could not locate gcc44"
429 run CC=gcc44 CXX=gcc44 $top_srcdir/configure "$BUILD_CONFIGURE_ARG" || die "Cannot execute CC=gcc44 CXX=gcc44 configure $BUILD_CONFIGURE_ARG"425 run CC=gcc44 CXX=gcc44 $top_srcdir/configure "$BUILD_CONFIGURE_ARG" || die "Cannot execute CC=gcc44 CXX=gcc44 configure $BUILD_CONFIGURE_ARG"
@@ -793,18 +789,14 @@
793789
794 CC=clang CXX=clang++790 CC=clang CXX=clang++
795 export CC CXX791 export CC CXX
792 CONFIGURE='scan-build ./configure'
796 CONFIGURE_ARGS='--enable-debug'793 CONFIGURE_ARGS='--enable-debug'
797794
798 make_skeleton795 run_configure
799 ret=$?
800
801 make_target 'clean' 'warn'
802796
803 scan-build -o clang-html make -j4 -k797 scan-build -o clang-html make -j4 -k
804798
805 restore_BUILD799 restore_BUILD
806
807 return $ret
808}800}
809801
810# If we are locally testing, we should make sure the environment is setup correctly802# If we are locally testing, we should make sure the environment is setup correctly
@@ -1010,6 +1002,9 @@
1010{1002{
1011 if command_exists 'rpmbuild'; then1003 if command_exists 'rpmbuild'; then
1012 if [ -f 'rpm.am' -o -d 'rpm' ]; then1004 if [ -f 'rpm.am' -o -d 'rpm' ]; then
1005 mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
1006 mkdir -p ~/rpmbuild/RPMS/{i386,i486,i586,i686,noarch,athlon}
1007
1013 run_configure_if_required1008 run_configure_if_required
1014 make_target 'rpm'1009 make_target 'rpm'
10151010
@@ -1507,6 +1502,9 @@
15071502
1508execute_job ()1503execute_job ()
1509{1504{
1505 # We should always have a target by this point
1506 assert MAKE_TARGET
1507
1510 determine_target_platform1508 determine_target_platform
15111509
1512 determine_vcs1510 determine_vcs
@@ -1518,10 +1516,6 @@
1518 return 11516 return 1
1519 fi1517 fi
15201518
1521 if [ -z "$MAKE_TARGET" ]; then
1522 MAKE_TARGET="make_default"
1523 fi
1524
1525 if $print_setup_opt -o $debug; then1519 if $print_setup_opt -o $debug; then
1526 echo 1520 echo
1527 print_setup1521 print_setup
@@ -1541,9 +1535,6 @@
1541 PREFIX_ARG="--prefix=$PREFIX"1535 PREFIX_ARG="--prefix=$PREFIX"
1542 fi1536 fi
15431537
1544 # We should always have a target by this point
1545 assert MAKE_TARGET
1546
1547 if $CLEAN_OPTION; then1538 if $CLEAN_OPTION; then
1548 make_maintainer_clean1539 make_maintainer_clean
1549 fi1540 fi
@@ -1762,6 +1753,13 @@
1762 fi1753 fi
1763 fi1754 fi
17641755
1756 if [ -z "$MAKE_TARGET" ]; then
1757 MAKE_TARGET="make_default"
1758 fi
1759
1760 # We should always have a target by this point
1761 assert MAKE_TARGET
1762
1765 execute_job1763 execute_job
1766 local ret=$?1764 local ret=$?
17671765
17681766
=== modified file 'clients/generator.cc'
--- clients/generator.cc 2013-01-08 01:03:28 +0000
+++ clients/generator.cc 2013-10-11 12:20:38 +0000
@@ -22,6 +22,8 @@
2222
23#include "clients/generator.h"23#include "clients/generator.h"
2424
25#define KEY_BYTES 20
26
25/* Use this for string generation */27/* Use this for string generation */
26static const char ALPHANUMERICS[]=28static const char ALPHANUMERICS[]=
27 "0123456789ABCDEFGHIJKLMNOPQRSTWXYZabcdefghijklmnopqrstuvwxyz";29 "0123456789ABCDEFGHIJKLMNOPQRSTWXYZabcdefghijklmnopqrstuvwxyz";
@@ -75,13 +77,13 @@
7577
76 for (uint64_t x= 0; x < number_of; x++)78 for (uint64_t x= 0; x < number_of; x++)
77 {79 {
78 pairs[x].key= (char *)calloc(100, sizeof(char));80 pairs[x].key= (char *)calloc(KEY_BYTES, sizeof(char));
7981
80 if (pairs[x].key == NULL)82 if (pairs[x].key == NULL)
81 goto error;83 goto error;
8284
83 get_random_string(pairs[x].key, 100);85 get_random_string(pairs[x].key, KEY_BYTES);
84 pairs[x].key_length= 100;86 pairs[x].key_length= KEY_BYTES;
8587
86 if (value_length)88 if (value_length)
87 {89 {
8890
=== modified file 'clients/memcp.cc'
--- clients/memcp.cc 2013-06-11 12:31:47 +0000
+++ clients/memcp.cc 2013-10-11 12:20:38 +0000
@@ -1,5 +1,5 @@
1/* LibMemcached1/* LibMemcached
2 * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/2 * Copyright (C) 2011-2013 Data Differential, http://datadifferential.com/
3 * Copyright (C) 2006-2009 Brian Aker3 * Copyright (C) 2006-2009 Brian Aker
4 * All rights reserved.4 * All rights reserved.
5 *5 *
66
=== modified file 'clients/memslap.cc'
--- clients/memslap.cc 2013-04-03 13:14:23 +0000
+++ clients/memslap.cc 2013-10-11 12:20:38 +0000
@@ -66,6 +66,8 @@
66#define DEFAULT_EXECUTE_NUMBER 1000066#define DEFAULT_EXECUTE_NUMBER 10000
67#define DEFAULT_CONCURRENCY 167#define DEFAULT_CONCURRENCY 1
6868
69#define VALUE_BYTES 4096
70
69#define PROGRAM_NAME "memslap"71#define PROGRAM_NAME "memslap"
70#define PROGRAM_DESCRIPTION "Generates a load against a memcached custer of servers."72#define PROGRAM_DESCRIPTION "Generates a load against a memcached custer of servers."
7173
@@ -336,7 +338,7 @@
336338
337 if (opt_test == SET_TEST)339 if (opt_test == SET_TEST)
338 {340 {
339 context->execute_pairs= pairs_generate(opt_execute_number, 400);341 context->execute_pairs= pairs_generate(opt_execute_number, VALUE_BYTES);
340 context->execute_number= opt_execute_number;342 context->execute_number= opt_execute_number;
341 }343 }
342344
@@ -432,7 +434,7 @@
432 break;434 break;
433435
434 case OPT_DEBUG: /* --debug or -d */436 case OPT_DEBUG: /* --debug or -d */
435 opt_verbose = OPT_DEBUG;437 opt_verbose= OPT_DEBUG;
436 break;438 break;
437439
438 case OPT_VERSION: /* --version or -V */440 case OPT_VERSION: /* --version or -V */
@@ -566,7 +568,7 @@
566 /* We always used non-blocking IO for load since it is faster */568 /* We always used non-blocking IO for load since it is faster */
567 memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_NO_BLOCK, 0);569 memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_NO_BLOCK, 0);
568570
569 pairs_st *pairs= pairs_generate(number_of, 400);571 pairs_st *pairs= pairs_generate(number_of, VALUE_BYTES);
570 *actual_loaded= execute_set(memc_clone, pairs, number_of);572 *actual_loaded= execute_set(memc_clone, pairs, number_of);
571573
572 memcached_free(memc_clone);574 memcached_free(memc_clone);
573575
=== modified file 'clients/memtouch.cc'
--- clients/memtouch.cc 2013-06-11 12:31:47 +0000
+++ clients/memtouch.cc 2013-10-11 12:20:38 +0000
@@ -24,7 +24,7 @@
24#include "clients/utilities.h"24#include "clients/utilities.h"
2525
26#define PROGRAM_NAME "memtouch"26#define PROGRAM_NAME "memtouch"
27#define PROGRAM_DESCRIPTION "Update the expiration value of an alreasy existing value in the sever"27#define PROGRAM_DESCRIPTION "Update the expiration value of an already existing value in the server"
2828
2929
30/* Prototypes */30/* Prototypes */
3131
=== modified file 'clients/ms_setting.h'
--- clients/ms_setting.h 2012-07-10 20:34:40 +0000
+++ clients/ms_setting.h 2013-10-11 12:20:38 +0000
@@ -47,7 +47,7 @@
47#define MAX_TOKENS 1047#define MAX_TOKENS 10
4848
49/* server information */49/* server information */
50typedef struct mcd_sever50typedef struct mcd_server
51{51{
52 char srv_host_name[MCD_HOST_LENGTH]; /* host name of server */52 char srv_host_name[MCD_HOST_LENGTH]; /* host name of server */
53 int srv_port; /* server port */53 int srv_port; /* server port */
5454
=== modified file 'docs/memcached_auto.rst'
--- docs/memcached_auto.rst 2012-03-08 07:13:01 +0000
+++ docs/memcached_auto.rst 2013-10-11 12:20:38 +0000
@@ -53,7 +53,8 @@
53expiration values, the operation will succeed by seeding the value for that53expiration values, the operation will succeed by seeding the value for that
54key with a initial value to expire with the provided expiration time. The54key with a initial value to expire with the provided expiration time. The
55flags will be set to zero.The value is then returned via the uint32_t55flags will be set to zero.The value is then returned via the uint32_t
56value pointer you pass to it.56value pointer you pass to it. memcached_increment_with_initial is only available
57when using the binary protocol.
5758
58memcached_decrement_with_initial takes a key and keylength and decrements59memcached_decrement_with_initial takes a key and keylength and decrements
59the value by the offset passed to it. If the object specified by key does60the value by the offset passed to it. If the object specified by key does
@@ -62,7 +63,8 @@
62expiration values, the operation will succeed by seeding the value for that63expiration values, the operation will succeed by seeding the value for that
63key with a initial value to expire with the provided expiration time. The64key with a initial value to expire with the provided expiration time. The
64flags will be set to zero.The value is then returned via the uint32_t65flags will be set to zero.The value is then returned via the uint32_t
65value pointer you pass to it.66value pointer you pass to it. memcached_decrement_with_initial is only available
67when using the binary protocol.
6668
67:c:func:`memcached_increment_by_key`, :c:func:`memcached_decrement_by_key`,69:c:func:`memcached_increment_by_key`, :c:func:`memcached_decrement_by_key`,
68:c:func:`memcached_increment_with_initial_by_key`, and70:c:func:`memcached_increment_with_initial_by_key`, and
6971
=== modified file 'libmemcached-1.2/deprecated_types.h'
--- libmemcached-1.2/deprecated_types.h 2011-12-12 16:59:07 +0000
+++ libmemcached-1.2/deprecated_types.h 2013-10-11 12:20:38 +0000
@@ -57,4 +57,5 @@
57typedef memcached_trigger_key_fn memcached_trigger_key;57typedef memcached_trigger_key_fn memcached_trigger_key;
58typedef memcached_trigger_delete_key_fn memcached_trigger_delete_key;58typedef memcached_trigger_delete_key_fn memcached_trigger_delete_key;
59typedef memcached_dump_fn memcached_dump_func;59typedef memcached_dump_fn memcached_dump_func;
60typedef memcached_instance_st *memcached_server_instance_st;
6061
6162
=== modified file 'libmemcached/auto.cc'
--- libmemcached/auto.cc 2013-04-03 13:14:23 +0000
+++ libmemcached/auto.cc 2013-10-11 12:20:38 +0000
@@ -57,8 +57,13 @@
57 assert(memcached_last_error(instance->root) != MEMCACHED_SUCCESS);57 assert(memcached_last_error(instance->root) != MEMCACHED_SUCCESS);
58 *value= UINT64_MAX;58 *value= UINT64_MAX;
59 }59 }
60 else if (memcached_failed(rc))
61 {
62 *value= UINT64_MAX;
63 }
60 else64 else
61 {65 {
66 assert(memcached_last_error(instance->root) != MEMCACHED_NOTFOUND);
62 *value= instance->root->result.impl()->numeric_value;67 *value= instance->root->result.impl()->numeric_value;
63 }68 }
64}69}
6570
=== modified file 'libmemcached/connect.cc'
--- libmemcached/connect.cc 2013-06-12 08:17:31 +0000
+++ libmemcached/connect.cc 2013-10-11 12:20:38 +0000
@@ -76,7 +76,7 @@
76 if (server->root->poll_timeout == 0)76 if (server->root->poll_timeout == 0)
77 {77 {
78 return memcached_set_error(*server, MEMCACHED_TIMEOUT, MEMCACHED_AT,78 return memcached_set_error(*server, MEMCACHED_TIMEOUT, MEMCACHED_AT,
79 memcached_literal_param("The time to wait for a connection to be established was set to zero, which means it will always timeout (MEMCACHED_TIMEOUT)."));79 memcached_literal_param("The time to wait for a connection to be established was set to zero which produces a timeout to every call to poll()."));
80 }80 }
8181
82 while (--loop_max) // Should only loop on cases of ERESTART or EINTR82 while (--loop_max) // Should only loop on cases of ERESTART or EINTR
8383
=== modified file 'libmemcached/error.cc'
--- libmemcached/error.cc 2013-03-31 23:24:29 +0000
+++ libmemcached/error.cc 2013-10-11 12:20:38 +0000
@@ -36,6 +36,9 @@
36 */36 */
3737
38#include <libmemcached/common.h>38#include <libmemcached/common.h>
39
40#include "libmemcached/assert.hpp"
41
39#include <cerrno>42#include <cerrno>
40#include <cstdarg>43#include <cstdarg>
41#include <cstdio>44#include <cstdio>
@@ -87,111 +90,133 @@
87 memcached_error_free(memc);90 memcached_error_free(memc);
88 }91 }
8992
90 // For memory allocation we use our error since it is a bit more specific93 if (memcached_fatal(rc) or rc == MEMCACHED_CLIENT_ERROR)
91 if (local_errno == ENOMEM and rc == MEMCACHED_ERRNO)94 {
92 {95 // For memory allocation we use our error since it is a bit more specific
93 rc= MEMCACHED_MEMORY_ALLOCATION_FAILURE;96 if (local_errno == ENOMEM and rc == MEMCACHED_ERRNO)
94 }97 {
9598 rc= MEMCACHED_MEMORY_ALLOCATION_FAILURE;
96 if (rc == MEMCACHED_MEMORY_ALLOCATION_FAILURE)99 }
97 {100
98 local_errno= ENOMEM;101 if (rc == MEMCACHED_MEMORY_ALLOCATION_FAILURE)
99 }102 {
100103 local_errno= ENOMEM;
101 if (rc == MEMCACHED_ERRNO and not local_errno)104 }
102 {105
103 local_errno= errno;106 if (rc == MEMCACHED_ERRNO and not local_errno)
104 rc= MEMCACHED_ERRNO;107 {
105 }108 local_errno= errno;
106109 rc= MEMCACHED_ERRNO;
107 if (rc == MEMCACHED_ERRNO and local_errno == ENOTCONN)110 }
108 {111
109 rc= MEMCACHED_CONNECTION_FAILURE;112 if (rc == MEMCACHED_ERRNO and local_errno == ENOTCONN)
110 }113 {
111114 rc= MEMCACHED_CONNECTION_FAILURE;
112 if (rc == MEMCACHED_ERRNO and local_errno == ECONNRESET)115 }
113 {116
114 rc= MEMCACHED_CONNECTION_FAILURE;117 if (rc == MEMCACHED_ERRNO and local_errno == ECONNRESET)
115 }118 {
116119 rc= MEMCACHED_CONNECTION_FAILURE;
117 if (local_errno == EINVAL)120 }
118 {121
119 rc= MEMCACHED_INVALID_ARGUMENTS;122 if (local_errno == EINVAL)
120 }123 {
121124 rc= MEMCACHED_INVALID_ARGUMENTS;
122 if (local_errno == ECONNREFUSED)125 }
123 {126
124 rc= MEMCACHED_CONNECTION_FAILURE;127 if (local_errno == ECONNREFUSED)
125 }128 {
126129 rc= MEMCACHED_CONNECTION_FAILURE;
127 memcached_error_t *error= libmemcached_xmalloc(&memc, memcached_error_t);130 }
128 if (error == NULL) // Bad business if this happens131
129 {132 if (rc == MEMCACHED_TIMEOUT)
130 return;133 {
131 }134 }
132135
133 error->root= &memc;136 memcached_error_t *error= libmemcached_xmalloc(&memc, memcached_error_t);
134 error->query_id= memc.query_id;137 if (error == NULL) // Bad business if this happens
135 error->rc= rc;138 {
136 error->local_errno= local_errno;139 assert_msg(error, "libmemcached_xmalloc() failed to allocate a memcached_error_t");
137140 return;
138 const char *errmsg_ptr;141 }
139 char errmsg[MAX_ERROR_LENGTH];142
140 errmsg[0]= 0;143 error->root= &memc;
141 errmsg_ptr= errmsg;144 error->query_id= memc.query_id;
142145 error->rc= rc;
143 if (local_errno)146 error->local_errno= local_errno;
144 {147
148 // MEMCACHED_CLIENT_ERROR is a special case because it is an error coming from the server
149 if (rc == MEMCACHED_CLIENT_ERROR)
150 {
151 assert(str);
152 assert(str->size);
153 if (str and str->size)
154 {
155 assert(error->local_errno == 0);
156 error->local_errno= 0;
157
158 error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %.*s",
159 error->root,
160 int(str->size), str->c_str);
161 }
162 }
163 else if (local_errno)
164 {
165 const char *errmsg_ptr;
166 char errmsg[MAX_ERROR_LENGTH];
167 errmsg[0]= 0;
168 errmsg_ptr= errmsg;
169
145#if defined(STRERROR_R_CHAR_P) && STRERROR_R_CHAR_P170#if defined(STRERROR_R_CHAR_P) && STRERROR_R_CHAR_P
146 errmsg_ptr= strerror_r(local_errno, errmsg, sizeof(errmsg));171 errmsg_ptr= strerror_r(local_errno, errmsg, sizeof(errmsg));
147#elif defined(HAVE_STRERROR_R) && HAVE_STRERROR_R172#elif defined(HAVE_STRERROR_R) && HAVE_STRERROR_R
148 strerror_r(local_errno, errmsg, sizeof(errmsg));173 strerror_r(local_errno, errmsg, sizeof(errmsg));
149 errmsg_ptr= errmsg;174 errmsg_ptr= errmsg;
150#elif defined(HAVE_STRERROR) && HAVE_STRERROR175#elif defined(HAVE_STRERROR) && HAVE_STRERROR
151 snprintf(errmsg, sizeof(errmsg), "%s", strerror(local_errno));176 snprintf(errmsg, sizeof(errmsg), "%s", strerror(local_errno));
152 errmsg_ptr= errmsg;177 errmsg_ptr= errmsg;
153#endif178#endif
154 }179
155180 if (str and str->size and local_errno)
156181 {
157 if (str and str->size and local_errno)182 error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s(%s), %.*s -> %s",
158 {183 error->root,
159 error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s(%s), %.*s -> %s", 184 memcached_strerror(&memc, rc),
160 error->root,185 errmsg_ptr,
161 memcached_strerror(&memc, rc), 186 memcached_string_printf(*str), at);
162 errmsg_ptr,187 }
163 memcached_string_printf(*str), at);188 else
164 }189 {
165 else if (local_errno)190 error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s(%s) -> %s",
166 {191 error->root,
167 error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s(%s) -> %s", 192 memcached_strerror(&memc, rc),
168 error->root,193 errmsg_ptr,
169 memcached_strerror(&memc, rc), 194 at);
170 errmsg_ptr,195 }
171 at);196 }
172 }197 else if (rc == MEMCACHED_PARSE_ERROR and str and str->size)
173 else if (rc == MEMCACHED_PARSE_ERROR and str and str->size)198 {
174 {199 error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %.*s -> %s",
175 error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %.*s -> %s", 200 error->root,
176 error->root,201 int(str->size), str->c_str, at);
177 int(str->size), str->c_str, at);202 }
178 }203 else if (str and str->size)
179 else if (str and str->size)204 {
180 {205 error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s, %.*s -> %s",
181 error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s, %.*s -> %s", 206 error->root,
182 error->root,207 memcached_strerror(&memc, rc),
183 memcached_strerror(&memc, rc), 208 int(str->size), str->c_str, at);
184 int(str->size), str->c_str, at);209 }
185 }210 else
186 else211 {
187 {212 error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s -> %s",
188 error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s -> %s", 213 error->root,
189 error->root,214 memcached_strerror(&memc, rc), at);
190 memcached_strerror(&memc, rc), at);215 }
191 }216
192217 error->next= memc.error_messages;
193 error->next= memc.error_messages;218 memc.error_messages= error;
194 memc.error_messages= error;219 }
195220
196#if 0221#if 0
197 if (error_log_fd == -1)222 if (error_log_fd == -1)
@@ -231,13 +256,11 @@
231memcached_return_t memcached_set_error(Memcached& memc, memcached_return_t rc, const char *at, memcached_string_t& str)256memcached_return_t memcached_set_error(Memcached& memc, memcached_return_t rc, const char *at, memcached_string_t& str)
232{257{
233 assert_msg(rc != MEMCACHED_ERRNO, "Programmer error, MEMCACHED_ERRNO was set to be returned to client");258 assert_msg(rc != MEMCACHED_ERRNO, "Programmer error, MEMCACHED_ERRNO was set to be returned to client");
234 if (memcached_fatal(rc) == false)259 if (memcached_fatal(rc))
235 {260 {
236 return rc;261 _set(memc, &str, rc, at);
237 }262 }
238263
239 _set(memc, &str, rc, at);
240
241 return rc;264 return rc;
242}265}
243266
@@ -299,17 +322,15 @@
299 memcached_string_t error_host= { hostname_port_message, size_t(size) };322 memcached_string_t error_host= { hostname_port_message, size_t(size) };
300323
301 assert_msg(self.root, "Programmer error, root was not set on instance");324 assert_msg(self.root, "Programmer error, root was not set on instance");
302 if (self.root == NULL)325 if (self.root)
303 {326 {
304 return rc;327 _set(*self.root, &error_host, rc, at);
328 _set(self, (*self.root));
329 assert(self.error_messages);
330 assert(self.root->error_messages);
331 assert(self.error_messages->rc == self.root->error_messages->rc);
305 }332 }
306333
307 _set(*self.root, &error_host, rc, at);
308 _set(self, (*self.root));
309 assert(self.root->error_messages);
310 assert(self.error_messages);
311 assert(self.error_messages->rc == self.root->error_messages->rc);
312
313 return rc;334 return rc;
314}335}
315336
@@ -326,14 +347,12 @@
326347
327 memcached_string_t error_host= { hostname_port, size};348 memcached_string_t error_host= { hostname_port, size};
328349
329 if (self.root == NULL)350 if (self.root)
330 {351 {
331 return rc;352 _set(*self.root, &error_host, rc, at);
353 _set(self, *self.root);
332 }354 }
333355
334 _set(*self.root, &error_host, rc, at);
335 _set(self, *self.root);
336
337 return rc;356 return rc;
338}357}
339358
@@ -528,7 +547,7 @@
528 {547 {
529 if (memc->error_messages)548 if (memc->error_messages)
530 {549 {
531 if (memc->error_messages->size == 0)550 if (memc->error_messages->size and memc->error_messages->message[0])
532 {551 {
533 return memc->error_messages->message;552 return memc->error_messages->message;
534 }553 }
535554
=== modified file 'libmemcached/get.cc'
--- libmemcached/get.cc 2013-04-03 13:14:23 +0000
+++ libmemcached/get.cc 2013-10-11 12:20:38 +0000
@@ -114,7 +114,6 @@
114 {114 {
115 *error= MEMCACHED_NOTFOUND;115 *error= MEMCACHED_NOTFOUND;
116 }116 }
117
118 if (value == NULL)117 if (value == NULL)
119 {118 {
120 if (ptr->get_key_failure and *error == MEMCACHED_NOTFOUND)119 if (ptr->get_key_failure and *error == MEMCACHED_NOTFOUND)
@@ -221,12 +220,14 @@
221220
222 if (number_of_keys == 0)221 if (number_of_keys == 0)
223 {222 {
224 return memcached_set_error(*ptr, MEMCACHED_NOTFOUND, MEMCACHED_AT, memcached_literal_param("number_of_keys was zero"));223 return memcached_set_error(*ptr, MEMCACHED_INVALID_ARGUMENTS, MEMCACHED_AT, memcached_literal_param("Numbers of keys provided was zero"));
225 }224 }
226225
227 if (memcached_failed(memcached_key_test(*ptr, keys, key_length, number_of_keys)))226 if (memcached_failed((rc= memcached_key_test(*ptr, keys, key_length, number_of_keys))))
228 {227 {
229 return memcached_last_error(ptr);228 assert(memcached_last_error(ptr) == rc);
229
230 return rc;
230 }231 }
231232
232 bool is_group_key_set= false;233 bool is_group_key_set= false;
@@ -463,6 +464,11 @@
463464
464 bool flush= (number_of_keys == 1);465 bool flush= (number_of_keys == 1);
465466
467 if (memcached_failed(rc= memcached_key_test(*ptr, keys, key_length, number_of_keys)))
468 {
469 return rc;
470 }
471
466 /*472 /*
467 If a server fails we warn about errors and start all over with sending keys473 If a server fails we warn about errors and start all over with sending keys
468 to the server.474 to the server.
@@ -502,10 +508,13 @@
502 request.message.header.request.opcode= PROTOCOL_BINARY_CMD_GETK;508 request.message.header.request.opcode= PROTOCOL_BINARY_CMD_GETK;
503 }509 }
504510
511#if 0
505 {512 {
506 memcached_return_t vk= memcached_validate_key_length(key_length[x], ptr->flags.binary_protocol);513 memcached_return_t vk= memcached_validate_key_length(key_length[x], ptr->flags.binary_protocol);
507 if (vk != MEMCACHED_SUCCESS)514 if (memcached_failed(rc= memcached_key_test(*memc, (const char **)&key, &key_length, 1)))
508 {515 {
516 memcached_set_error(ptr, vk, MEMCACHED_AT, memcached_literal_param("Key was too long."));
517
509 if (x > 0)518 if (x > 0)
510 {519 {
511 memcached_io_reset(instance);520 memcached_io_reset(instance);
@@ -514,6 +523,7 @@
514 return vk;523 return vk;
515 }524 }
516 }525 }
526#endif
517527
518 request.message.header.request.keylen= htons((uint16_t)(key_length[x] + memcached_array_size(ptr->_namespace)));528 request.message.header.request.keylen= htons((uint16_t)(key_length[x] + memcached_array_size(ptr->_namespace)));
519 request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;529 request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
520530
=== modified file 'libmemcached/io.cc'
--- libmemcached/io.cc 2013-03-31 23:24:29 +0000
+++ libmemcached/io.cc 2013-10-11 12:20:38 +0000
@@ -99,7 +99,7 @@
99 case EWOULDBLOCK:99 case EWOULDBLOCK:
100#endif100#endif
101 case EAGAIN:101 case EAGAIN:
102#ifdef TARGET_OS_LINUX102#ifdef __linux
103 case ERESTART:103 case ERESTART:
104#endif104#endif
105 break; // No IO is fine, we can just move on105 break; // No IO is fine, we can just move on
@@ -265,7 +265,7 @@
265 assert_msg(active_fd == -1 , "poll() returned an unexpected value");265 assert_msg(active_fd == -1 , "poll() returned an unexpected value");
266 switch (local_errno)266 switch (local_errno)
267 {267 {
268#ifdef TARGET_OS_LINUX268#ifdef __linux
269 case ERESTART:269 case ERESTART:
270#endif270#endif
271 case EINTR:271 case EINTR:
@@ -412,6 +412,11 @@
412 return io_wait(instance, MEM_WRITE);412 return io_wait(instance, MEM_WRITE);
413}413}
414414
415memcached_return_t memcached_io_wait_for_read(memcached_instance_st* instance)
416{
417 return io_wait(instance, MEM_READ);
418}
419
415static memcached_return_t _io_fill(memcached_instance_st* instance)420static memcached_return_t _io_fill(memcached_instance_st* instance)
416{421{
417 ssize_t data_read;422 ssize_t data_read;
@@ -430,7 +435,7 @@
430 case EWOULDBLOCK:435 case EWOULDBLOCK:
431#endif436#endif
432 case EAGAIN:437 case EAGAIN:
433#ifdef TARGET_OS_LINUX438#ifdef __linux
434 case ERESTART:439 case ERESTART:
435#endif440#endif
436 {441 {
@@ -568,7 +573,7 @@
568 case EWOULDBLOCK:573 case EWOULDBLOCK:
569#endif574#endif
570 case EAGAIN:575 case EAGAIN:
571#ifdef TARGET_OS_LINUX576#ifdef __linux
572 case ERESTART:577 case ERESTART:
573#endif578#endif
574 if (memcached_success(io_wait(instance, MEM_READ)))579 if (memcached_success(io_wait(instance, MEM_READ)))
575580
=== modified file 'libmemcached/io.hpp'
--- libmemcached/io.hpp 2013-03-31 23:24:29 +0000
+++ libmemcached/io.hpp 2013-10-11 12:20:38 +0000
@@ -49,7 +49,8 @@
49 libmemcached_io_vector_st vector[],49 libmemcached_io_vector_st vector[],
50 const size_t number_of, const bool with_flush);50 const size_t number_of, const bool with_flush);
5151
52memcached_return_t memcached_io_wait_for_write(memcached_instance_st* ptr);52memcached_return_t memcached_io_wait_for_write(memcached_instance_st*);
53memcached_return_t memcached_io_wait_for_read(memcached_instance_st*);
5354
54void memcached_io_reset(memcached_instance_st* ptr);55void memcached_io_reset(memcached_instance_st* ptr);
5556
5657
=== modified file 'libmemcached/key.cc'
--- libmemcached/key.cc 2012-02-13 20:14:15 +0000
+++ libmemcached/key.cc 2013-10-11 12:20:38 +0000
@@ -37,47 +37,71 @@
3737
38#include <libmemcached/common.h>38#include <libmemcached/common.h>
3939
40static inline memcached_return_t memcached_validate_key_length(size_t key_length, bool)
41{
42 if (key_length == 0)
43 {
44 return MEMCACHED_BAD_KEY_PROVIDED;
45 }
46
47 // No one ever reimplemented MEMCACHED to use keys longer then the original ascii length
48#if 0
49 if (binary)
50 {
51 if (key_length > 0xffff)
52 {
53 return MEMCACHED_BAD_KEY_PROVIDED;
54 }
55 }
56 else
57#endif
58 {
59 if (key_length >= MEMCACHED_MAX_KEY)
60 {
61 return MEMCACHED_BAD_KEY_PROVIDED;
62 }
63 }
64
65 return MEMCACHED_SUCCESS;
66}
67
40memcached_return_t memcached_key_test(memcached_st &memc,68memcached_return_t memcached_key_test(memcached_st &memc,
41 const char * const *keys,69 const char * const *keys,
42 const size_t *key_length,70 const size_t *key_length,
43 size_t number_of_keys)71 size_t number_of_keys)
44{72{
73 if (number_of_keys == 0)
74 {
75 return memcached_set_error(memc, MEMCACHED_INVALID_ARGUMENTS, MEMCACHED_AT, memcached_literal_param("Numbers of keys provided was zero"));
76 }
77
45 if (keys == NULL or key_length == NULL)78 if (keys == NULL or key_length == NULL)
46 {79 {
47 return memcached_set_error(memc, MEMCACHED_BAD_KEY_PROVIDED, MEMCACHED_AT, memcached_literal_param("Key was NULL or length of key was zero."));80 return memcached_set_error(memc, MEMCACHED_BAD_KEY_PROVIDED, MEMCACHED_AT, memcached_literal_param("Key was NULL or length of key was zero."));
48 }81 }
4982
83 const bool is_binary= memcached_flag(memc, MEMCACHED_FLAG_BINARY_PROTOCOL);
84
50 // If we don't need to verify the key, or we are using the binary protoocol,85 // If we don't need to verify the key, or we are using the binary protoocol,
51 // we just check the size of the key86 // we just check the size of the key
52 if (memc.flags.verify_key == false or memc.flags.binary_protocol == true)87 for (size_t x= 0; x < number_of_keys; ++x)
53 {88 {
54 for (size_t x= 0; x < number_of_keys; x++)89 // We should set binary key, but the memcached server is broken for
55 {90 // longer keys at the moment.
56 // We should set binary key, but the memcached server is broken for91 memcached_return_t rc= memcached_validate_key_length(*(key_length +x), false /* memc.flags.binary_protocol */);
57 // longer keys at the moment.
58 memcached_return_t rc= memcached_validate_key_length(*(key_length +x), false /* memc.flags.binary_protocol */);
59 if (memcached_failed(rc))
60 {
61 return memcached_set_error(memc, rc, MEMCACHED_AT, memcached_literal_param("Key provided was too long."));
62 }
63 }
64
65 return MEMCACHED_SUCCESS;
66 }
67
68 for (size_t x= 0; x < number_of_keys; x++)
69 {
70 memcached_return_t rc= memcached_validate_key_length(*(key_length + x), false);
71 if (memcached_failed(rc))92 if (memcached_failed(rc))
72 {93 {
73 return memcached_set_error(memc, rc, MEMCACHED_AT, memcached_literal_param("Key provided was too long."));94 return memcached_set_error(memc, rc, MEMCACHED_AT, memcached_literal_param("Key provided was too long."));
74 }95 }
75 96
76 for (size_t y= 0; y < *(key_length + x); y++)97 if (memc.flags.verify_key and is_binary == false)
77 {98 {
78 if ((isgraph(keys[x][y])) == 0)99 for (size_t y= 0; y < *(key_length +x); ++y)
79 {100 {
80 return memcached_set_error(memc, MEMCACHED_BAD_KEY_PROVIDED, MEMCACHED_AT, memcached_literal_param("Key provided had invalid character."));101 if ((isgraph(keys[x][y])) == 0)
102 {
103 return memcached_set_error(memc, MEMCACHED_BAD_KEY_PROVIDED, MEMCACHED_AT, memcached_literal_param("Key provided had invalid character."));
104 }
81 }105 }
82 }106 }
83 }107 }
84108
=== modified file 'libmemcached/key.hpp'
--- libmemcached/key.hpp 2011-10-02 23:49:04 +0000
+++ libmemcached/key.hpp 2013-10-11 12:20:38 +0000
@@ -41,27 +41,3 @@
41 const size_t *key_length,41 const size_t *key_length,
42 size_t number_of_keys);42 size_t number_of_keys);
4343
44static inline memcached_return_t memcached_validate_key_length(size_t key_length, bool binary)
45{
46 if (key_length == 0)
47 {
48 return MEMCACHED_BAD_KEY_PROVIDED;
49 }
50
51 if (binary)
52 {
53 if (key_length > 0xffff)
54 {
55 return MEMCACHED_BAD_KEY_PROVIDED;
56 }
57 }
58 else
59 {
60 if (key_length >= MEMCACHED_MAX_KEY)
61 {
62 return MEMCACHED_BAD_KEY_PROVIDED;
63 }
64 }
65
66 return MEMCACHED_SUCCESS;
67}
6844
=== modified file 'libmemcached/response.cc'
--- libmemcached/response.cc 2013-06-11 12:31:47 +0000
+++ libmemcached/response.cc 2013-10-11 12:20:38 +0000
@@ -503,6 +503,8 @@
503 memcached_return_t rc;503 memcached_return_t rc;
504 protocol_binary_response_header header;504 protocol_binary_response_header header;
505505
506 assert(memcached_is_binary(instance->root));
507
506 if ((rc= memcached_safe_read(instance, &header.bytes, sizeof(header.bytes))) != MEMCACHED_SUCCESS)508 if ((rc= memcached_safe_read(instance, &header.bytes, sizeof(header.bytes))) != MEMCACHED_SUCCESS)
507 {509 {
508 WATCHPOINT_ERROR(rc);510 WATCHPOINT_ERROR(rc);
@@ -894,12 +896,19 @@
894 return memcached_set_error(*instance, MEMCACHED_NOT_SUPPORTED, MEMCACHED_AT);896 return memcached_set_error(*instance, MEMCACHED_NOT_SUPPORTED, MEMCACHED_AT);
895 }897 }
896898
897 /* We may have old commands in the buffer not set, first purge */899 /* We may have old commands in the buffer not sent, first purge */
898 if ((instance->root->flags.no_block) and (memcached_is_processing_input(instance->root) == false))900 if ((instance->root->flags.no_block) and (memcached_is_processing_input(instance->root) == false))
899 {901 {
900 (void)memcached_io_write(instance);902 (void)memcached_io_write(instance);
901 }903 }
902904
905 /* Before going into loop wait to see if we have any IO waiting for us */
906 if (0)
907 {
908 memcached_return_t read_rc= memcached_io_wait_for_read(instance);
909 fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, memcached_strerror(NULL, read_rc));
910 }
911
903 /*912 /*
904 * The previous implementation purged all pending requests and just913 * The previous implementation purged all pending requests and just
905 * returned the last one. Purge all pending messages to ensure backwards914 * returned the last one. Purge all pending messages to ensure backwards
906915
=== modified file 'libmemcached/stats.cc'
--- libmemcached/stats.cc 2013-03-31 23:24:29 +0000
+++ libmemcached/stats.cc 2013-10-11 12:20:38 +0000
@@ -346,7 +346,7 @@
346 return MEMCACHED_SUCCESS;346 return MEMCACHED_SUCCESS;
347}347}
348348
349char *memcached_stat_get_value(const memcached_st *, memcached_stat_st *memc_stat,349char *memcached_stat_get_value(const memcached_st* shell, memcached_stat_st *memc_stat,
350 const char *key, memcached_return_t *error)350 const char *key, memcached_return_t *error)
351{351{
352 memcached_return_t not_used;352 memcached_return_t not_used;
@@ -456,13 +456,15 @@
456 }456 }
457 else457 else
458 {458 {
459 *error= MEMCACHED_NOTFOUND;459 Memcached* memc= (Memcached*)memcached2Memcached(shell);
460 *error= memcached_set_error(*memc, MEMCACHED_INVALID_ARGUMENTS, MEMCACHED_AT, memcached_literal_param("Invalid key provided"));
460 return NULL;461 return NULL;
461 }462 }
462463
463 if (length >= SMALL_STRING_LEN || length < 0)464 if (length >= SMALL_STRING_LEN || length < 0)
464 {465 {
465 *error= MEMCACHED_FAILURE;466 Memcached* memc= (Memcached*)memcached2Memcached(shell);
467 *error= memcached_set_error(*memc, MEMCACHED_FAILURE, MEMCACHED_AT, memcached_literal_param("Internal failure occured with buffer, please report this bug."));
466 return NULL;468 return NULL;
467 }469 }
468470
@@ -658,8 +660,7 @@
658 if (args)660 if (args)
659 {661 {
660 args_length= strlen(args);662 args_length= strlen(args);
661 rc= memcached_validate_key_length(args_length, self->flags.binary_protocol);663 if (memcached_failed(rc= memcached_key_test(*self, (const char **)&args, &args_length, 1)))
662 if (memcached_failed(rc))
663 {664 {
664 *error= memcached_set_error(*self, rc, MEMCACHED_AT);665 *error= memcached_set_error(*self, rc, MEMCACHED_AT);
665 return NULL;666 return NULL;
@@ -746,7 +747,7 @@
746 if (args)747 if (args)
747 {748 {
748 args_length= strlen(args);749 args_length= strlen(args);
749 rc= memcached_validate_key_length(args_length, memc.flags.binary_protocol);750 rc= memcached_key_test(*memc_ptr, (const char **)&args, &args_length, 1);
750 }751 }
751752
752 if (memcached_success(rc))753 if (memcached_success(rc))
753754
=== modified file 'libmemcached/string.cc'
--- libmemcached/string.cc 2013-01-23 21:28:45 +0000
+++ libmemcached/string.cc 2013-10-11 12:20:38 +0000
@@ -281,18 +281,20 @@
281{281{
282 char* value= NULL;282 char* value= NULL;
283283
284 if (memcached_string_length(self))284 assert_msg(self, "Invalid memcached_string_st");
285 if (self)
285 {286 {
286 assert_msg(self, "Invalid memcached_string_st");287 if (memcached_string_length(self))
287 // If we fail at adding the null, we copy and move on
288 if (memcached_success(memcached_string_append_null(self)))
289 {288 {
290 return memcached_string_c_copy(self);289 // If we fail at adding the null, we copy and move on
290 if (memcached_failed(memcached_string_append_null(self)))
291 {
292 return NULL;
293 }
294
295 value= self->string;
296 _init_string(self);
291 }297 }
292
293 value= self->string;
294
295 _init_string(self);
296 }298 }
297299
298 return value;300 return value;
299301
=== modified file 'libmemcached/touch.cc'
--- libmemcached/touch.cc 2013-03-31 23:24:29 +0000
+++ libmemcached/touch.cc 2013-10-11 12:20:38 +0000
@@ -124,9 +124,9 @@
124 return rc;124 return rc;
125 }125 }
126126
127 if (memcached_failed(rc= memcached_validate_key_length(key_length, ptr->flags.binary_protocol)))127 if (memcached_failed(rc= memcached_key_test(*ptr, (const char **)&key, &key_length, 1)))
128 {128 {
129 return rc;129 return memcached_set_error(*ptr, rc, MEMCACHED_AT);
130 }130 }
131131
132 uint32_t server_key= memcached_generate_hash_with_redistribution(ptr, group_key, group_key_length);132 uint32_t server_key= memcached_generate_hash_with_redistribution(ptr, group_key, group_key_length);
133133
=== modified file 'libtest/cmdline.cc'
--- libtest/cmdline.cc 2013-06-12 07:11:22 +0000
+++ libtest/cmdline.cc 2013-10-11 12:20:38 +0000
@@ -359,7 +359,7 @@
359 int error;359 int error;
360 switch ((error= errno))360 switch ((error= errno))
361 {361 {
362#ifdef TARGET_OS_LINUX362#ifdef __linux
363 case ERESTART:363 case ERESTART:
364#endif364#endif
365 case EINTR:365 case EINTR:
366366
=== modified file 'libtest/core.cc'
--- libtest/core.cc 2012-12-09 11:40:11 +0000
+++ libtest/core.cc 2013-10-11 12:20:38 +0000
@@ -42,8 +42,8 @@
4242
43void create_core(void)43void create_core(void)
44{44{
45#if defined(TARGET_OS_OSX) && TARGET_OS_OSX45#if defined(__APPLE__) && __APPLE__
46 if (TARGET_OS_OSX)46 if (__APPLE__)
47 {47 {
48 return;48 return;
49 }49 }
5050
=== modified file 'libtest/main.cc'
--- libtest/main.cc 2013-06-12 07:11:22 +0000
+++ libtest/main.cc 2013-10-11 12:20:38 +0000
@@ -2,7 +2,7 @@
2 *2 *
3 * Data Differential YATL (i.e. libtest) library3 * Data Differential YATL (i.e. libtest) library
4 *4 *
5 * Copyright (C) 2012 Data Differential, http://datadifferential.com/5 * Copyright (C) 2012-2013 Data Differential, http://datadifferential.com/
6 *6 *
7 * Redistribution and use in source and binary forms, with or without7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are8 * modification, are permitted provided that the following conditions are
@@ -43,8 +43,11 @@
43#include <cstring>43#include <cstring>
44#include <ctime>44#include <ctime>
45#include <fnmatch.h>45#include <fnmatch.h>
46#include <iostream>
47#ifdef HAVE_STRINGS_H
48# include <strings.h>
49#endif
46#include <fstream>50#include <fstream>
47#include <iostream>
48#include <memory>51#include <memory>
49#include <sys/stat.h>52#include <sys/stat.h>
50#include <sys/time.h>53#include <sys/time.h>
@@ -113,7 +116,7 @@
113 Valgrind does not currently work reliably, or sometimes at all, on OSX116 Valgrind does not currently work reliably, or sometimes at all, on OSX
114 - Fri Jun 15 11:24:07 EDT 2012117 - Fri Jun 15 11:24:07 EDT 2012
115 */118 */
116#if defined(TARGET_OS_OSX) && TARGET_OS_OSX119#if defined(__APPLE__) && __APPLE__
117 if (valgrind_is_caller())120 if (valgrind_is_caller())
118 {121 {
119 return EXIT_SKIP;122 return EXIT_SKIP;
120123
=== modified file 'libtest/unittest.cc'
--- libtest/unittest.cc 2013-06-12 07:11:22 +0000
+++ libtest/unittest.cc 2013-10-11 12:20:38 +0000
@@ -657,7 +657,7 @@
657 const char *args[]= { "--fubar", 0 };657 const char *args[]= { "--fubar", 0 };
658#if defined(__APPLE__) && __APPLE__658#if defined(__APPLE__) && __APPLE__
659 ASSERT_EQ(Application::INVALID_POSIX_SPAWN, true_app.run(args));659 ASSERT_EQ(Application::INVALID_POSIX_SPAWN, true_app.run(args));
660#elif defined(TARGET_OS_FREEBSD) && TARGET_OS_FREEBSD660#elif defined(__FreeBSD__) && __FreeBSD__
661 ASSERT_EQ(Application::INVALID_POSIX_SPAWN, true_app.run(args));661 ASSERT_EQ(Application::INVALID_POSIX_SPAWN, true_app.run(args));
662#else662#else
663 ASSERT_EQ(Application::SUCCESS, true_app.run(args));663 ASSERT_EQ(Application::SUCCESS, true_app.run(args));
@@ -855,8 +855,8 @@
855static test_return_t gdb_wait_services_appliction_TEST(void *)855static test_return_t gdb_wait_services_appliction_TEST(void *)
856{856{
857 test_skip(true, false);857 test_skip(true, false);
858#if defined(TARGET_OS_OSX) && TARGET_OS_OSX858#if defined(__APPLE__) && __APPLE__
859 test_skip(0, TARGET_OS_OSX);859 test_skip(0, __APPLE__);
860#endif860#endif
861861
862 test_skip(0, access("/etc/services", R_OK ));862 test_skip(0, access("/etc/services", R_OK ));
@@ -879,8 +879,8 @@
879 test_skip(0, access("libtest/abort", X_OK ));879 test_skip(0, access("libtest/abort", X_OK ));
880 test_skip(true, false);880 test_skip(true, false);
881881
882#if defined(TARGET_OS_OSX) && TARGET_OS_OSX882#if defined(__APPLE__) && __APPLE__
883 test_skip(0, TARGET_OS_OSX);883 test_skip(0, __APPLE__);
884#endif884#endif
885885
886 libtest::Application abort_app("libtest/abort", true);886 libtest::Application abort_app("libtest/abort", true);
887887
=== modified file 'm4/ax_debug.m4'
--- m4/ax_debug.m4 2013-01-08 01:03:28 +0000
+++ m4/ax_debug.m4 2013-10-11 12:20:38 +0000
@@ -43,7 +43,7 @@
43# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE43# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
44# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.44# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4545
46#serial 546#serial 6
4747
48AC_DEFUN([AX_DEBUG],48AC_DEFUN([AX_DEBUG],
49 [AC_PREREQ([2.63])dnl49 [AC_PREREQ([2.63])dnl
@@ -52,7 +52,9 @@
52 [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],52 [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])],
53 [ax_enable_debug=yes53 [ax_enable_debug=yes
54 AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging code.])54 AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging code.])
55 AX_CHECK_LIBRARY([MCHECK],[mcheck.h],[mcheck],[AX_APPEND_LINK_FLAGS([-lmcheck])])],55 AX_CHECK_LIBRARY([MCHECK],[mcheck.h],[mcheck],[AX_APPEND_LINK_FLAGS([-lmcheck])])
56 AX_ADD_AM_MACRO([--debug],[AM_YFLAGS])
57 AX_ADD_AM_MACRO([-D_GLIBCXX_DEBUG],[AM_CPPFLAGS])],
56 [ax_enable_debug=no58 [ax_enable_debug=no
57 AC_SUBST([MCHECK])59 AC_SUBST([MCHECK])
58 AC_DEFINE([DEBUG],[0],[Define to 1 to enable debugging code.])])60 AC_DEFINE([DEBUG],[0],[Define to 1 to enable debugging code.])])
5961
=== modified file 'tests/cli.am'
--- tests/cli.am 2013-05-03 20:00:36 +0000
+++ tests/cli.am 2013-10-11 12:20:38 +0000
@@ -122,3 +122,12 @@
122122
123valgrind-memtouch: tests/memtouch123valgrind-memtouch: tests/memtouch
124 @$(VALGRIND_COMMAND) tests/memtouch124 @$(VALGRIND_COMMAND) tests/memtouch
125
126test-memdump: tests/memdump
127 tests/memdump
128
129gdb-memdump: tests/memdump
130 @$(GDB_COMMAND) tests/memdump
131
132valgrind-memdump: tests/memdump
133 @$(VALGRIND_COMMAND) tests/memdump
125134
=== modified file 'tests/libmemcached-1.0/all_tests.h'
--- tests/libmemcached-1.0/all_tests.h 2013-02-23 21:43:42 +0000
+++ tests/libmemcached-1.0/all_tests.h 2013-10-11 12:20:38 +0000
@@ -70,9 +70,11 @@
70 {"partial mget", false, (test_callback_fn*)get_test5 },70 {"partial mget", false, (test_callback_fn*)get_test5 },
71 {"stats_servername", false, (test_callback_fn*)stats_servername_test },71 {"stats_servername", false, (test_callback_fn*)stats_servername_test },
72 {"increment", false, (test_callback_fn*)increment_test },72 {"increment", false, (test_callback_fn*)increment_test },
73 {"increment_with_initial", true, (test_callback_fn*)increment_with_initial_test },73 {"memcached_increment_with_initial(0)", true, (test_callback_fn*)increment_with_initial_test },
74 {"memcached_increment_with_initial(999)", true, (test_callback_fn*)increment_with_initial_999_test },
74 {"decrement", false, (test_callback_fn*)decrement_test },75 {"decrement", false, (test_callback_fn*)decrement_test },
75 {"decrement_with_initial", true, (test_callback_fn*)decrement_with_initial_test },76 {"memcached_decrement_with_initial(3)", true, (test_callback_fn*)decrement_with_initial_test },
77 {"memcached_decrement_with_initial(999)", true, (test_callback_fn*)decrement_with_initial_999_test },
76 {"increment_by_key", false, (test_callback_fn*)increment_by_key_test },78 {"increment_by_key", false, (test_callback_fn*)increment_by_key_test },
77 {"increment_with_initial_by_key", true, (test_callback_fn*)increment_with_initial_by_key_test },79 {"increment_with_initial_by_key", true, (test_callback_fn*)increment_with_initial_by_key_test },
78 {"decrement_by_key", false, (test_callback_fn*)decrement_by_key_test },80 {"decrement_by_key", false, (test_callback_fn*)decrement_by_key_test },
7981
=== modified file 'tests/libmemcached-1.0/mem_functions.cc'
--- tests/libmemcached-1.0/mem_functions.cc 2013-04-20 09:55:24 +0000
+++ tests/libmemcached-1.0/mem_functions.cc 2013-10-11 12:20:38 +0000
@@ -994,6 +994,7 @@
994 test_compare(MEMCACHED_SUCCESS,994 test_compare(MEMCACHED_SUCCESS,
995 memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, true));995 memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, true));
996 test_compare(query_id, memcached_query_id(memc_clone)); // We should not increase the query_id for memcached_behavior_set()996 test_compare(query_id, memcached_query_id(memc_clone)); // We should not increase the query_id for memcached_behavior_set()
997 ASSERT_TRUE(memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY));
997998
998 /* All keys are valid in the binary protocol (except for length) */999 /* All keys are valid in the binary protocol (except for length) */
999 if (memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == false)1000 if (memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == false)
@@ -1295,24 +1296,39 @@
1295 return TEST_SUCCESS;1296 return TEST_SUCCESS;
1296}1297}
12971298
1299static test_return_t __increment_with_initial_test(memcached_st *memc, uint64_t initial)
1300{
1301 uint64_t new_number;
1302
1303 test_compare(MEMCACHED_SUCCESS, memcached_flush_buffers(memc));
1304
1305 if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL))
1306 {
1307 test_compare(MEMCACHED_SUCCESS,
1308 memcached_increment_with_initial(memc, test_literal_param("number"), 1, initial, 0, &new_number));
1309 test_compare(new_number, initial);
1310
1311 test_compare(MEMCACHED_SUCCESS,
1312 memcached_increment_with_initial(memc, test_literal_param("number"), 1, initial, 0, &new_number));
1313 test_compare(new_number, (initial +1));
1314 }
1315 else
1316 {
1317 test_compare(MEMCACHED_INVALID_ARGUMENTS,
1318 memcached_increment_with_initial(memc, test_literal_param("number"), 1, initial, 0, &new_number));
1319 }
1320
1321 return TEST_SUCCESS;
1322}
1323
1298test_return_t increment_with_initial_test(memcached_st *memc)1324test_return_t increment_with_initial_test(memcached_st *memc)
1299{1325{
1300 test_skip(true, memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL));1326 return __increment_with_initial_test(memc, 0);
13011327}
1302 uint64_t new_number;1328
1303 uint64_t initial= 0;1329test_return_t increment_with_initial_999_test(memcached_st *memc)
13041330{
1305 test_compare(MEMCACHED_SUCCESS, memcached_flush_buffers(memc));1331 return __increment_with_initial_test(memc, 999);
1306
1307 test_compare(MEMCACHED_SUCCESS,
1308 memcached_increment_with_initial(memc, test_literal_param("number"), 1, initial, 0, &new_number));
1309 test_compare(new_number, initial);
1310
1311 test_compare(MEMCACHED_SUCCESS,
1312 memcached_increment_with_initial(memc, test_literal_param("number"), 1, initial, 0, &new_number));
1313 test_compare(new_number, (initial +1));
1314
1315 return TEST_SUCCESS;
1316}1332}
13171333
1318test_return_t decrement_test(memcached_st *memc)1334test_return_t decrement_test(memcached_st *memc)
@@ -1342,30 +1358,38 @@
1342 return TEST_SUCCESS;1358 return TEST_SUCCESS;
1343}1359}
13441360
1361static test_return_t __decrement_with_initial_test(memcached_st *memc, uint64_t initial)
1362{
1363 test_skip(true, memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL));
1364
1365 test_compare(MEMCACHED_SUCCESS, memcached_flush_buffers(memc));
1366
1367 uint64_t new_number;
1368 test_compare(MEMCACHED_SUCCESS,
1369 memcached_decrement_with_initial(memc,
1370 test_literal_param(__func__),
1371 1, initial,
1372 0, &new_number));
1373 test_compare(new_number, initial);
1374
1375 test_compare(MEMCACHED_SUCCESS,
1376 memcached_decrement_with_initial(memc,
1377 test_literal_param(__func__),
1378 1, initial,
1379 0, &new_number));
1380 test_compare(new_number, (initial - 1));
1381
1382 return TEST_SUCCESS;
1383}
1384
1345test_return_t decrement_with_initial_test(memcached_st *memc)1385test_return_t decrement_with_initial_test(memcached_st *memc)
1346{1386{
1347 test_skip(true, memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL));1387 return __decrement_with_initial_test(memc, 3);
13481388}
1349 uint64_t initial= 3;1389
13501390test_return_t decrement_with_initial_999_test(memcached_st *memc)
1351 test_compare(MEMCACHED_SUCCESS, memcached_flush_buffers(memc));1391{
13521392 return __decrement_with_initial_test(memc, 999);
1353 uint64_t new_number;
1354 test_compare(MEMCACHED_SUCCESS,
1355 memcached_decrement_with_initial(memc,
1356 test_literal_param(__func__),
1357 1, initial,
1358 0, &new_number));
1359 test_compare(new_number, initial);
1360
1361 test_compare(MEMCACHED_SUCCESS,
1362 memcached_decrement_with_initial(memc,
1363 test_literal_param(__func__),
1364 1, initial,
1365 0, &new_number));
1366 test_compare(new_number, (initial - 1));
1367
1368 return TEST_SUCCESS;
1369}1393}
13701394
1371test_return_t increment_by_key_test(memcached_st *memc)1395test_return_t increment_by_key_test(memcached_st *memc)
@@ -1399,24 +1423,32 @@
13991423
1400test_return_t increment_with_initial_by_key_test(memcached_st *memc)1424test_return_t increment_with_initial_by_key_test(memcached_st *memc)
1401{1425{
1402 test_skip(true, memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL));
1403
1404 uint64_t new_number;1426 uint64_t new_number;
1405 const char *master_key= "foo";1427 const char *master_key= "foo";
1406 const char *key= "number";1428 const char *key= "number";
1407 uint64_t initial= 0;1429 uint64_t initial= 0;
14081430
1409 test_compare(MEMCACHED_SUCCESS,1431 if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL))
1410 memcached_increment_with_initial_by_key(memc, master_key, strlen(master_key),1432 {
1411 key, strlen(key),1433 test_compare(MEMCACHED_SUCCESS,
1412 1, initial, 0, &new_number));1434 memcached_increment_with_initial_by_key(memc, master_key, strlen(master_key),
1413 test_compare(new_number, initial);1435 key, strlen(key),
1436 1, initial, 0, &new_number));
1437 test_compare(new_number, initial);
14141438
1415 test_compare(MEMCACHED_SUCCESS,1439 test_compare(MEMCACHED_SUCCESS,
1416 memcached_increment_with_initial_by_key(memc, master_key, strlen(master_key),1440 memcached_increment_with_initial_by_key(memc, master_key, strlen(master_key),
1417 key, strlen(key),1441 key, strlen(key),
1418 1, initial, 0, &new_number));1442 1, initial, 0, &new_number));
1419 test_compare(new_number, (initial +1));1443 test_compare(new_number, (initial +1));
1444 }
1445 else
1446 {
1447 test_compare(MEMCACHED_INVALID_ARGUMENTS,
1448 memcached_increment_with_initial_by_key(memc, master_key, strlen(master_key),
1449 key, strlen(key),
1450 1, initial, 0, &new_number));
1451 }
14201452
1421 return TEST_SUCCESS;1453 return TEST_SUCCESS;
1422}1454}
@@ -1457,19 +1489,30 @@
1457 uint64_t new_number;1489 uint64_t new_number;
1458 uint64_t initial= 3;1490 uint64_t initial= 3;
14591491
1460 test_compare(MEMCACHED_SUCCESS,1492 if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL))
1461 memcached_decrement_with_initial_by_key(memc,1493 {
1462 test_literal_param("foo"),1494 test_compare(MEMCACHED_SUCCESS,
1463 test_literal_param("number"),1495 memcached_decrement_with_initial_by_key(memc,
1464 1, initial, 0, &new_number));1496 test_literal_param("foo"),
1465 test_compare(new_number, initial);1497 test_literal_param("number"),
1498 1, initial, 0, &new_number));
1499 test_compare(new_number, initial);
14661500
1467 test_compare(MEMCACHED_SUCCESS,1501 test_compare(MEMCACHED_SUCCESS,
1468 memcached_decrement_with_initial_by_key(memc,1502 memcached_decrement_with_initial_by_key(memc,
1469 test_literal_param("foo"),1503 test_literal_param("foo"),
1470 test_literal_param("number"),1504 test_literal_param("number"),
1471 1, initial, 0, &new_number));1505 1, initial, 0, &new_number));
1472 test_compare(new_number, (initial - 1));1506 test_compare(new_number, (initial - 1));
1507 }
1508 else
1509 {
1510 test_compare(MEMCACHED_INVALID_ARGUMENTS,
1511 memcached_decrement_with_initial_by_key(memc,
1512 test_literal_param("foo"),
1513 test_literal_param("number"),
1514 1, initial, 0, &new_number));
1515 }
14731516
1474 return TEST_SUCCESS;1517 return TEST_SUCCESS;
1475}1518}
@@ -3040,7 +3083,7 @@
3040 const char *key= "mine";3083 const char *key= "mine";
3041 char *value;3084 char *value;
30423085
3043 /* Make sure be default none exists */3086 /* Make sure by default none exists */
3044 value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);3087 value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
3045 test_null(value);3088 test_null(value);
3046 test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));3089 test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));
@@ -3051,7 +3094,7 @@
30513094
3052 value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);3095 value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
3053 test_true(value);3096 test_true(value);
3054 test_memcmp(value, key, 4);3097 test_memcmp(value, key, strlen(key));
3055 test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));3098 test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));
30563099
3057 /* Test that we can turn it off */3100 /* Test that we can turn it off */
@@ -3069,7 +3112,7 @@
3069 value= (char *)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);3112 value= (char *)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
3070 test_true(value);3113 test_true(value);
3071 test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));3114 test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));
3072 test_memcmp(value, key, 4);3115 test_memcmp(value, key, strlen(key));
30733116
3074 /* Set to Zero, and then Set to something too large */3117 /* Set to Zero, and then Set to something too large */
3075 {3118 {
@@ -3079,9 +3122,7 @@
3079 test_compare(MEMCACHED_SUCCESS,3122 test_compare(MEMCACHED_SUCCESS,
3080 memcached_callback_set(memc, MEMCACHED_CALLBACK_NAMESPACE, NULL));3123 memcached_callback_set(memc, MEMCACHED_CALLBACK_NAMESPACE, NULL));
30813124
3082 value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);3125 ASSERT_NULL_(memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc), "Setting namespace to NULL did not work");
3083 test_null(value);
3084 test_compare(MEMCACHED_SUCCESS, rc);
30853126
3086 /* Test a long key for failure */3127 /* Test a long key for failure */
3087 /* TODO, extend test to determine based on setting, what result should be */3128 /* TODO, extend test to determine based on setting, what result should be */
@@ -3109,11 +3150,10 @@
3109{3150{
3110 memcached_return_t rc;3151 memcached_return_t rc;
3111 const char *key= "mine";3152 const char *key= "mine";
3112 char *value;
31133153
3114 // Make sure we default to a null namespace3154 // Make sure we default to a null namespace
3115 value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);3155 char* value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
3116 test_null(value);3156 ASSERT_NULL_(value, "memc had a value for namespace when none should exist");
3117 test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));3157 test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));
31183158
3119 /* Test a clean set */3159 /* Test a clean set */
@@ -3121,8 +3161,8 @@
3121 memcached_callback_set(memc, MEMCACHED_CALLBACK_NAMESPACE, (void *)key));3161 memcached_callback_set(memc, MEMCACHED_CALLBACK_NAMESPACE, (void *)key));
31223162
3123 value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);3163 value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc);
3124 test_true(value);3164 ASSERT_TRUE(value);
3125 test_memcmp(value, key, 4);3165 test_memcmp(value, key, strlen(key));
3126 test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));3166 test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc));
31273167
3128 return TEST_SUCCESS;3168 return TEST_SUCCESS;
31293169
=== modified file 'tests/libmemcached-1.0/mem_functions.h'
--- tests/libmemcached-1.0/mem_functions.h 2013-02-23 21:43:42 +0000
+++ tests/libmemcached-1.0/mem_functions.h 2013-10-11 12:20:38 +0000
@@ -67,6 +67,7 @@
67test_return_t decrement_test(memcached_st *memc);67test_return_t decrement_test(memcached_st *memc);
68test_return_t decrement_with_initial_by_key_test(memcached_st *memc);68test_return_t decrement_with_initial_by_key_test(memcached_st *memc);
69test_return_t decrement_with_initial_test(memcached_st *memc);69test_return_t decrement_with_initial_test(memcached_st *memc);
70test_return_t decrement_with_initial_999_test(memcached_st *memc);
70test_return_t delete_test(memcached_st *memc);71test_return_t delete_test(memcached_st *memc);
71test_return_t deprecated_set_memory_alloc(memcached_st *memc);72test_return_t deprecated_set_memory_alloc(memcached_st *memc);
72test_return_t enable_cas(memcached_st *memc);73test_return_t enable_cas(memcached_st *memc);
@@ -88,6 +89,7 @@
88test_return_t increment_test(memcached_st *memc);89test_return_t increment_test(memcached_st *memc);
89test_return_t increment_with_initial_by_key_test(memcached_st *memc);90test_return_t increment_with_initial_by_key_test(memcached_st *memc);
90test_return_t increment_with_initial_test(memcached_st *memc);91test_return_t increment_with_initial_test(memcached_st *memc);
92test_return_t increment_with_initial_999_test(memcached_st *memc);
91test_return_t init_test(memcached_st *not_used);93test_return_t init_test(memcached_st *not_used);
92test_return_t jenkins_run (memcached_st *);94test_return_t jenkins_run (memcached_st *);
93test_return_t key_setup(memcached_st *memc);95test_return_t key_setup(memcached_st *memc);
9496
=== modified file 'tests/libmemcached-1.0/plus.cpp'
--- tests/libmemcached-1.0/plus.cpp 2013-04-03 13:14:23 +0000
+++ tests/libmemcached-1.0/plus.cpp 2013-10-11 12:20:38 +0000
@@ -181,6 +181,13 @@
181 vector<char> return_value;181 vector<char> return_value;
182182
183 /* We need to empty the server before we continue the test */183 /* We need to empty the server before we continue the test */
184 bool flush_res= memc.flush();
185 if (flush_res == false)
186 {
187 std::string error_string;
188 ASSERT_TRUE(memc.error(error_string));
189 Error << error_string;
190 }
184 test_true(memc.flush());191 test_true(memc.flush());
185192
186 test_true(memc.mget(keys));193 test_true(memc.mget(keys));
187194
=== modified file 'tests/libmemcached_world.h'
--- tests/libmemcached_world.h 2013-06-12 07:11:22 +0000
+++ tests/libmemcached_world.h 2013-10-11 12:20:38 +0000
@@ -87,12 +87,14 @@
87static bool world_destroy(void *object)87static bool world_destroy(void *object)
88{88{
89 libmemcached_test_container_st *container= (libmemcached_test_container_st *)object;89 libmemcached_test_container_st *container= (libmemcached_test_container_st *)object;
90#if 0
90#if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT91#if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT
91 if (LIBMEMCACHED_WITH_SASL_SUPPORT)92 if (LIBMEMCACHED_WITH_SASL_SUPPORT)
92 {93 {
93 sasl_done();94 sasl_done();
94 }95 }
95#endif96#endif
97#endif
9698
97 delete container;99 delete container;
98100
99101
=== modified file 'tests/libmemcached_world_socket.h'
--- tests/libmemcached_world_socket.h 2013-01-24 11:17:17 +0000
+++ tests/libmemcached_world_socket.h 2013-10-11 12:20:38 +0000
@@ -75,12 +75,15 @@
75static bool world_destroy(void *object)75static bool world_destroy(void *object)
76{76{
77 libmemcached_test_container_st *container= (libmemcached_test_container_st *)object;77 libmemcached_test_container_st *container= (libmemcached_test_container_st *)object;
78
79#if 0
78#if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT80#if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT
79 if (LIBMEMCACHED_WITH_SASL_SUPPORT)81 if (LIBMEMCACHED_WITH_SASL_SUPPORT)
80 {82 {
81 sasl_done();83 sasl_done();
82 }84 }
83#endif85#endif
86#endif
8487
85 delete container;88 delete container;
8689
8790
=== modified file 'tests/memcat.cc'
--- tests/memcat.cc 2013-01-28 22:51:05 +0000
+++ tests/memcat.cc 2013-10-11 12:20:38 +0000
@@ -64,10 +64,10 @@
64static test_return_t cat_test(void *)64static test_return_t cat_test(void *)
65{65{
66 char buffer[1024];66 char buffer[1024];
67 snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));67 int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
68 const char *args[]= { buffer, "foo", 0 };68 const char *args[]= { buffer, "foo", 0 };
6969
70 memcached_st *memc= memcached(buffer, strlen(buffer));70 memcached_st *memc= memcached(buffer, length);
71 test_true(memc);71 test_true(memc);
7272
73 test_compare(MEMCACHED_SUCCESS,73 test_compare(MEMCACHED_SUCCESS,
@@ -77,6 +77,7 @@
77 test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));77 test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));
78 test_compare(MEMCACHED_SUCCESS, rc);78 test_compare(MEMCACHED_SUCCESS, rc);
7979
80 snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
80 test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));81 test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));
8182
82 test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));83 test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));
@@ -90,11 +91,11 @@
90static test_return_t NOT_FOUND_test(void *)91static test_return_t NOT_FOUND_test(void *)
91{92{
92 char buffer[1024];93 char buffer[1024];
93 snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));94 int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
94 const char *args[]= { buffer, "foo", 0 };95 const char *args[]= { buffer, "foo", 0 };
9596
96 memcached_st *memc= memcached(buffer, strlen(buffer));97 memcached_st *memc= memcached(buffer, length);
97 test_true(memc);98 ASSERT_TRUE(memc);
9899
99 test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0));100 test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0));
100101
@@ -102,6 +103,7 @@
102 test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));103 test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));
103 test_compare(MEMCACHED_NOTFOUND, rc);104 test_compare(MEMCACHED_NOTFOUND, rc);
104105
106 snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
105 test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true));107 test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true));
106108
107 test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));109 test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));
108110
=== modified file 'tests/memcp.cc'
--- tests/memcp.cc 2013-06-12 07:11:22 +0000
+++ tests/memcp.cc 2013-10-11 12:20:38 +0000
@@ -63,6 +63,7 @@
63 return TEST_SUCCESS;63 return TEST_SUCCESS;
64}64}
6565
66#if 0
66static test_return_t server_test(void *)67static test_return_t server_test(void *)
67{68{
68 int fd;69 int fd;
@@ -82,10 +83,13 @@
8283
83 return TEST_SUCCESS;84 return TEST_SUCCESS;
84}85}
86#endif
8587
86test_st memcp_tests[] ={88test_st memcp_tests[] ={
87 {"--help", true, help_test },89 {"--help", true, help_test },
90#if 0
88 {"--server_test", true, server_test },91 {"--server_test", true, server_test },
92#endif
89 {0, 0, 0}93 {0, 0, 0}
90};94};
9195
9296
=== modified file 'tests/memdump.cc'
--- tests/memdump.cc 2013-01-28 22:51:05 +0000
+++ tests/memdump.cc 2013-10-11 12:20:38 +0000
@@ -75,10 +75,10 @@
75static test_return_t FOUND_test(void *)75static test_return_t FOUND_test(void *)
76{76{
77 char buffer[1024];77 char buffer[1024];
78 snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));78 int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
79 const char *args[]= { buffer, 0 };79 const char *args[]= { buffer, 0 };
8080
81 memcached_st *memc= memcached(buffer, strlen(buffer));81 memcached_st *memc= memcached(buffer, length);
82 test_true(memc);82 test_true(memc);
8383
84 test_compare(MEMCACHED_SUCCESS,84 test_compare(MEMCACHED_SUCCESS,
@@ -91,6 +91,7 @@
91 test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));91 test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));
92 test_compare(MEMCACHED_SUCCESS, rc);92 test_compare(MEMCACHED_SUCCESS, rc);
9393
94 length= snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
94 test_true(exec_cmdline(executable, args, true) <= EXIT_FAILURE);95 test_true(exec_cmdline(executable, args, true) <= EXIT_FAILURE);
9596
96 memcached_free(memc);97 memcached_free(memc);
@@ -110,19 +111,11 @@
110 {0, 0, 0, 0}111 {0, 0, 0, 0}
111};112};
112113
113static void *world_create(server_startup_st& servers, test_return_t& error)114static void *world_create(server_startup_st& servers, test_return_t&)
114{115{
115 if (libtest::has_memcached() == false)116 SKIP_UNLESS(libtest::has_memcached());
116 {
117 error= TEST_SKIPPED;
118 return NULL;
119 }
120117
121 if (server_startup(servers, "memcached", libtest::default_port(), NULL) == false)118 ASSERT_TRUE(server_startup(servers, "memcached", libtest::default_port(), NULL));
122 {
123 error= TEST_FAILURE;
124 return NULL;
125 }
126119
127 return &servers;120 return &servers;
128}121}
129122
=== modified file 'tests/memexist.cc'
--- tests/memexist.cc 2013-01-28 22:51:05 +0000
+++ tests/memexist.cc 2013-10-11 12:20:38 +0000
@@ -64,10 +64,10 @@
64static test_return_t exist_test(void *)64static test_return_t exist_test(void *)
65{65{
66 char buffer[1024];66 char buffer[1024];
67 snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));67 int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
68 const char *args[]= { buffer, "foo", 0 };68 const char *args[]= { buffer, "foo", 0 };
6969
70 memcached_st *memc= memcached(buffer, strlen(buffer));70 memcached_st *memc= memcached(buffer, length);
71 test_true(memc);71 test_true(memc);
7272
73 test_compare(MEMCACHED_SUCCESS,73 test_compare(MEMCACHED_SUCCESS,
@@ -90,11 +90,11 @@
90static test_return_t NOT_FOUND_test(void *)90static test_return_t NOT_FOUND_test(void *)
91{91{
92 char buffer[1024];92 char buffer[1024];
93 snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));93 int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
94 const char *args[]= { buffer, "foo", 0 };94 const char *args[]= { buffer, "foo", 0 };
9595
96 memcached_st *memc= memcached(buffer, strlen(buffer));96 memcached_st *memc= memcached(buffer, length);
97 test_true(memc);97 ASSERT_TRUE(memc);
9898
99 test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0));99 test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0));
100100
@@ -115,9 +115,9 @@
115static test_return_t check_version(void*)115static test_return_t check_version(void*)
116{116{
117 char buffer[1024];117 char buffer[1024];
118 snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));118 int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
119 memcached_st *memc= memcached(buffer, strlen(buffer));119 memcached_st *memc= memcached(buffer, length);
120 test_true(memc);120 ASSERT_TRUE(memc);
121 121
122 test_return_t result= TEST_SUCCESS;122 test_return_t result= TEST_SUCCESS;
123 if (libmemcached_util_version_check(memc, 1, 4, 8) == false)123 if (libmemcached_util_version_check(memc, 1, 4, 8) == false)
124124
=== modified file 'tests/memping.cc'
--- tests/memping.cc 2013-04-03 13:14:23 +0000
+++ tests/memping.cc 2013-10-11 12:20:38 +0000
@@ -64,7 +64,7 @@
64static test_return_t ping_TEST(void *)64static test_return_t ping_TEST(void *)
65{65{
66 char buffer[1024];66 char buffer[1024];
67 snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));67 snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
68 const char *args[]= { buffer, 0 };68 const char *args[]= { buffer, 0 };
6969
70 test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));70 test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));
@@ -75,7 +75,7 @@
75static test_return_t NOT_FOUND_TEST(void *)75static test_return_t NOT_FOUND_TEST(void *)
76{76{
77 char buffer[1024];77 char buffer[1024];
78 snprintf(buffer, sizeof(buffer), "--server=nonexist.libmemcached.org:%d", int(default_port()));78 snprintf(buffer, sizeof(buffer), "--servers=nonexist.libmemcached.org:%d", int(default_port()));
79 const char *args[]= { buffer, 0 };79 const char *args[]= { buffer, 0 };
8080
81 test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true));81 test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true));
8282
=== modified file 'tests/memrm.cc'
--- tests/memrm.cc 2013-01-28 22:51:05 +0000
+++ tests/memrm.cc 2013-10-11 12:20:38 +0000
@@ -84,6 +84,8 @@
84 test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));84 test_null(memcached_get(memc, test_literal_param("foo"), 0, 0, &rc));
85 test_compare(MEMCACHED_SUCCESS, rc);85 test_compare(MEMCACHED_SUCCESS, rc);
8686
87 char memrm_buffer[1024];
88 snprintf(memrm_buffer, sizeof(memrm_buffer), "--servers=localhost:%d", int(default_port()));
87 const char *args[]= { buffer, "foo", 0 };89 const char *args[]= { buffer, "foo", 0 };
88 test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));90 test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true));
8991
@@ -121,7 +123,7 @@
121static test_return_t multiple_NOT_FOUND_TEST(void *)123static test_return_t multiple_NOT_FOUND_TEST(void *)
122{124{
123 char buffer[1024];125 char buffer[1024];
124 snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));126 snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
125 const char *args[]= { buffer, "protocols", "foo", "mine", "bar", "dog", "cat", "foo", "mine",127 const char *args[]= { buffer, "protocols", "foo", "mine", "bar", "dog", "cat", "foo", "mine",
126 "eye", "for", "the", "to", "not", "know", "what", "I", "should", "be", "doing", 0 };128 "eye", "for", "the", "to", "not", "know", "what", "I", "should", "be", "doing", 0 };
127129
128130
=== modified file 'tests/memtouch.cc'
--- tests/memtouch.cc 2013-01-28 22:51:05 +0000
+++ tests/memtouch.cc 2013-10-11 12:20:38 +0000
@@ -65,9 +65,9 @@
65static test_return_t touch_test(void *)65static test_return_t touch_test(void *)
66{66{
67 char buffer[1024];67 char buffer[1024];
68 snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));68 int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
6969
70 memcached_st *memc= memcached(buffer, strlen(buffer));70 memcached_st *memc= memcached(buffer, length);
71 test_true(memc);71 test_true(memc);
7272
73 test_compare(MEMCACHED_SUCCESS,73 test_compare(MEMCACHED_SUCCESS,
@@ -89,15 +89,15 @@
89static test_return_t NOT_FOUND_test(void *)89static test_return_t NOT_FOUND_test(void *)
90{90{
91 char buffer[1024];91 char buffer[1024];
92 snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));92 int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
93 memcached_st *memc= memcached(buffer, strlen(buffer));93 memcached_st *memc= memcached(buffer, length);
94 test_true(memc);94 test_true(memc);
9595
96 test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0));96 test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0));
9797
98 test_compare(MEMCACHED_NOTFOUND, memcached_exist(memc, test_literal_param("foo")));98 test_compare(MEMCACHED_NOTFOUND, memcached_exist(memc, test_literal_param("foo")));
9999
100 snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));100 length= snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port()));
101 const char *args[]= { "--expire=30", buffer, "foo", 0 };101 const char *args[]= { "--expire=30", buffer, "foo", 0 };
102 test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true));102 test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true));
103103
@@ -111,8 +111,8 @@
111static test_return_t check_version(void*)111static test_return_t check_version(void*)
112{112{
113 char buffer[1024];113 char buffer[1024];
114 snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));114 int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port()));
115 memcached_st *memc= memcached(buffer, strlen(buffer));115 memcached_st *memc= memcached(buffer, length);
116 test_true(memc);116 test_true(memc);
117 117
118 test_return_t result= TEST_SUCCESS;118 test_return_t result= TEST_SUCCESS;

Subscribers

People subscribed via source and target branches

to all changes: