Merge lp:~brianaker/libmemcached/merge-of-1.0 into lp:libmemcached
- merge-of-1.0
- Merge into 1.2
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tangent Trunk | Pending | ||
Review via email: mp+190637@code.launchpad.net |
Commit message
Description of the change
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
1 | === modified file 'bootstrap.sh' | |||
2 | --- bootstrap.sh 2013-06-13 22:13:53 +0000 | |||
3 | +++ bootstrap.sh 2013-10-11 12:20:38 +0000 | |||
4 | @@ -420,10 +420,6 @@ | |||
5 | 420 | ret=1; | 420 | ret=1; |
6 | 421 | # If we are executing on OSX use CLANG, otherwise only use it if we find it in the ENV | 421 | # If we are executing on OSX use CLANG, otherwise only use it if we find it in the ENV |
7 | 422 | case $HOST_OS in | 422 | case $HOST_OS in |
8 | 423 | *-darwin-*) | ||
9 | 424 | run CC=clang CXX=clang++ $top_srcdir/configure "$BUILD_CONFIGURE_ARG" || die "Cannot execute CC=clang CXX=clang++ configure $BUILD_CONFIGURE_ARG" | ||
10 | 425 | ret=$? | ||
11 | 426 | ;; | ||
12 | 427 | rhel-5*) | 423 | rhel-5*) |
13 | 428 | command_exists 'gcc44' || die "Could not locate gcc44" | 424 | command_exists 'gcc44' || die "Could not locate gcc44" |
14 | 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" |
15 | @@ -793,18 +789,14 @@ | |||
16 | 793 | 789 | ||
17 | 794 | CC=clang CXX=clang++ | 790 | CC=clang CXX=clang++ |
18 | 795 | export CC CXX | 791 | export CC CXX |
19 | 792 | CONFIGURE='scan-build ./configure' | ||
20 | 796 | CONFIGURE_ARGS='--enable-debug' | 793 | CONFIGURE_ARGS='--enable-debug' |
21 | 797 | 794 | ||
26 | 798 | make_skeleton | 795 | run_configure |
23 | 799 | ret=$? | ||
24 | 800 | |||
25 | 801 | make_target 'clean' 'warn' | ||
27 | 802 | 796 | ||
28 | 803 | scan-build -o clang-html make -j4 -k | 797 | scan-build -o clang-html make -j4 -k |
29 | 804 | 798 | ||
30 | 805 | restore_BUILD | 799 | restore_BUILD |
31 | 806 | |||
32 | 807 | return $ret | ||
33 | 808 | } | 800 | } |
34 | 809 | 801 | ||
35 | 810 | # If we are locally testing, we should make sure the environment is setup correctly | 802 | # If we are locally testing, we should make sure the environment is setup correctly |
36 | @@ -1010,6 +1002,9 @@ | |||
37 | 1010 | { | 1002 | { |
38 | 1011 | if command_exists 'rpmbuild'; then | 1003 | if command_exists 'rpmbuild'; then |
39 | 1012 | if [ -f 'rpm.am' -o -d 'rpm' ]; then | 1004 | if [ -f 'rpm.am' -o -d 'rpm' ]; then |
40 | 1005 | mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} | ||
41 | 1006 | mkdir -p ~/rpmbuild/RPMS/{i386,i486,i586,i686,noarch,athlon} | ||
42 | 1007 | |||
43 | 1013 | run_configure_if_required | 1008 | run_configure_if_required |
44 | 1014 | make_target 'rpm' | 1009 | make_target 'rpm' |
45 | 1015 | 1010 | ||
46 | @@ -1507,6 +1502,9 @@ | |||
47 | 1507 | 1502 | ||
48 | 1508 | execute_job () | 1503 | execute_job () |
49 | 1509 | { | 1504 | { |
50 | 1505 | # We should always have a target by this point | ||
51 | 1506 | assert MAKE_TARGET | ||
52 | 1507 | |||
53 | 1510 | determine_target_platform | 1508 | determine_target_platform |
54 | 1511 | 1509 | ||
55 | 1512 | determine_vcs | 1510 | determine_vcs |
56 | @@ -1518,10 +1516,6 @@ | |||
57 | 1518 | return 1 | 1516 | return 1 |
58 | 1519 | fi | 1517 | fi |
59 | 1520 | 1518 | ||
60 | 1521 | if [ -z "$MAKE_TARGET" ]; then | ||
61 | 1522 | MAKE_TARGET="make_default" | ||
62 | 1523 | fi | ||
63 | 1524 | |||
64 | 1525 | if $print_setup_opt -o $debug; then | 1519 | if $print_setup_opt -o $debug; then |
65 | 1526 | echo | 1520 | echo |
66 | 1527 | print_setup | 1521 | print_setup |
67 | @@ -1541,9 +1535,6 @@ | |||
68 | 1541 | PREFIX_ARG="--prefix=$PREFIX" | 1535 | PREFIX_ARG="--prefix=$PREFIX" |
69 | 1542 | fi | 1536 | fi |
70 | 1543 | 1537 | ||
71 | 1544 | # We should always have a target by this point | ||
72 | 1545 | assert MAKE_TARGET | ||
73 | 1546 | |||
74 | 1547 | if $CLEAN_OPTION; then | 1538 | if $CLEAN_OPTION; then |
75 | 1548 | make_maintainer_clean | 1539 | make_maintainer_clean |
76 | 1549 | fi | 1540 | fi |
77 | @@ -1762,6 +1753,13 @@ | |||
78 | 1762 | fi | 1753 | fi |
79 | 1763 | fi | 1754 | fi |
80 | 1764 | 1755 | ||
81 | 1756 | if [ -z "$MAKE_TARGET" ]; then | ||
82 | 1757 | MAKE_TARGET="make_default" | ||
83 | 1758 | fi | ||
84 | 1759 | |||
85 | 1760 | # We should always have a target by this point | ||
86 | 1761 | assert MAKE_TARGET | ||
87 | 1762 | |||
88 | 1765 | execute_job | 1763 | execute_job |
89 | 1766 | local ret=$? | 1764 | local ret=$? |
90 | 1767 | 1765 | ||
91 | 1768 | 1766 | ||
92 | === modified file 'clients/generator.cc' | |||
93 | --- clients/generator.cc 2013-01-08 01:03:28 +0000 | |||
94 | +++ clients/generator.cc 2013-10-11 12:20:38 +0000 | |||
95 | @@ -22,6 +22,8 @@ | |||
96 | 22 | 22 | ||
97 | 23 | #include "clients/generator.h" | 23 | #include "clients/generator.h" |
98 | 24 | 24 | ||
99 | 25 | #define KEY_BYTES 20 | ||
100 | 26 | |||
101 | 25 | /* Use this for string generation */ | 27 | /* Use this for string generation */ |
102 | 26 | static const char ALPHANUMERICS[]= | 28 | static const char ALPHANUMERICS[]= |
103 | 27 | "0123456789ABCDEFGHIJKLMNOPQRSTWXYZabcdefghijklmnopqrstuvwxyz"; | 29 | "0123456789ABCDEFGHIJKLMNOPQRSTWXYZabcdefghijklmnopqrstuvwxyz"; |
104 | @@ -75,13 +77,13 @@ | |||
105 | 75 | 77 | ||
106 | 76 | for (uint64_t x= 0; x < number_of; x++) | 78 | for (uint64_t x= 0; x < number_of; x++) |
107 | 77 | { | 79 | { |
109 | 78 | pairs[x].key= (char *)calloc(100, sizeof(char)); | 80 | pairs[x].key= (char *)calloc(KEY_BYTES, sizeof(char)); |
110 | 79 | 81 | ||
111 | 80 | if (pairs[x].key == NULL) | 82 | if (pairs[x].key == NULL) |
112 | 81 | goto error; | 83 | goto error; |
113 | 82 | 84 | ||
116 | 83 | get_random_string(pairs[x].key, 100); | 85 | get_random_string(pairs[x].key, KEY_BYTES); |
117 | 84 | pairs[x].key_length= 100; | 86 | pairs[x].key_length= KEY_BYTES; |
118 | 85 | 87 | ||
119 | 86 | if (value_length) | 88 | if (value_length) |
120 | 87 | { | 89 | { |
121 | 88 | 90 | ||
122 | === modified file 'clients/memcp.cc' | |||
123 | --- clients/memcp.cc 2013-06-11 12:31:47 +0000 | |||
124 | +++ clients/memcp.cc 2013-10-11 12:20:38 +0000 | |||
125 | @@ -1,5 +1,5 @@ | |||
126 | 1 | /* LibMemcached | 1 | /* LibMemcached |
128 | 2 | * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ | 2 | * Copyright (C) 2011-2013 Data Differential, http://datadifferential.com/ |
129 | 3 | * Copyright (C) 2006-2009 Brian Aker | 3 | * Copyright (C) 2006-2009 Brian Aker |
130 | 4 | * All rights reserved. | 4 | * All rights reserved. |
131 | 5 | * | 5 | * |
132 | 6 | 6 | ||
133 | === modified file 'clients/memslap.cc' | |||
134 | --- clients/memslap.cc 2013-04-03 13:14:23 +0000 | |||
135 | +++ clients/memslap.cc 2013-10-11 12:20:38 +0000 | |||
136 | @@ -66,6 +66,8 @@ | |||
137 | 66 | #define DEFAULT_EXECUTE_NUMBER 10000 | 66 | #define DEFAULT_EXECUTE_NUMBER 10000 |
138 | 67 | #define DEFAULT_CONCURRENCY 1 | 67 | #define DEFAULT_CONCURRENCY 1 |
139 | 68 | 68 | ||
140 | 69 | #define VALUE_BYTES 4096 | ||
141 | 70 | |||
142 | 69 | #define PROGRAM_NAME "memslap" | 71 | #define PROGRAM_NAME "memslap" |
143 | 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." |
144 | 71 | 73 | ||
145 | @@ -336,7 +338,7 @@ | |||
146 | 336 | 338 | ||
147 | 337 | if (opt_test == SET_TEST) | 339 | if (opt_test == SET_TEST) |
148 | 338 | { | 340 | { |
150 | 339 | context->execute_pairs= pairs_generate(opt_execute_number, 400); | 341 | context->execute_pairs= pairs_generate(opt_execute_number, VALUE_BYTES); |
151 | 340 | context->execute_number= opt_execute_number; | 342 | context->execute_number= opt_execute_number; |
152 | 341 | } | 343 | } |
153 | 342 | 344 | ||
154 | @@ -432,7 +434,7 @@ | |||
155 | 432 | break; | 434 | break; |
156 | 433 | 435 | ||
157 | 434 | case OPT_DEBUG: /* --debug or -d */ | 436 | case OPT_DEBUG: /* --debug or -d */ |
159 | 435 | opt_verbose = OPT_DEBUG; | 437 | opt_verbose= OPT_DEBUG; |
160 | 436 | break; | 438 | break; |
161 | 437 | 439 | ||
162 | 438 | case OPT_VERSION: /* --version or -V */ | 440 | case OPT_VERSION: /* --version or -V */ |
163 | @@ -566,7 +568,7 @@ | |||
164 | 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 */ |
165 | 567 | memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_NO_BLOCK, 0); | 569 | memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_NO_BLOCK, 0); |
166 | 568 | 570 | ||
168 | 569 | pairs_st *pairs= pairs_generate(number_of, 400); | 571 | pairs_st *pairs= pairs_generate(number_of, VALUE_BYTES); |
169 | 570 | *actual_loaded= execute_set(memc_clone, pairs, number_of); | 572 | *actual_loaded= execute_set(memc_clone, pairs, number_of); |
170 | 571 | 573 | ||
171 | 572 | memcached_free(memc_clone); | 574 | memcached_free(memc_clone); |
172 | 573 | 575 | ||
173 | === modified file 'clients/memtouch.cc' | |||
174 | --- clients/memtouch.cc 2013-06-11 12:31:47 +0000 | |||
175 | +++ clients/memtouch.cc 2013-10-11 12:20:38 +0000 | |||
176 | @@ -24,7 +24,7 @@ | |||
177 | 24 | #include "clients/utilities.h" | 24 | #include "clients/utilities.h" |
178 | 25 | 25 | ||
179 | 26 | #define PROGRAM_NAME "memtouch" | 26 | #define PROGRAM_NAME "memtouch" |
181 | 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" |
182 | 28 | 28 | ||
183 | 29 | 29 | ||
184 | 30 | /* Prototypes */ | 30 | /* Prototypes */ |
185 | 31 | 31 | ||
186 | === modified file 'clients/ms_setting.h' | |||
187 | --- clients/ms_setting.h 2012-07-10 20:34:40 +0000 | |||
188 | +++ clients/ms_setting.h 2013-10-11 12:20:38 +0000 | |||
189 | @@ -47,7 +47,7 @@ | |||
190 | 47 | #define MAX_TOKENS 10 | 47 | #define MAX_TOKENS 10 |
191 | 48 | 48 | ||
192 | 49 | /* server information */ | 49 | /* server information */ |
194 | 50 | typedef struct mcd_sever | 50 | typedef struct mcd_server |
195 | 51 | { | 51 | { |
196 | 52 | char srv_host_name[MCD_HOST_LENGTH]; /* host name of server */ | 52 | char srv_host_name[MCD_HOST_LENGTH]; /* host name of server */ |
197 | 53 | int srv_port; /* server port */ | 53 | int srv_port; /* server port */ |
198 | 54 | 54 | ||
199 | === modified file 'docs/memcached_auto.rst' | |||
200 | --- docs/memcached_auto.rst 2012-03-08 07:13:01 +0000 | |||
201 | +++ docs/memcached_auto.rst 2013-10-11 12:20:38 +0000 | |||
202 | @@ -53,7 +53,8 @@ | |||
203 | 53 | expiration values, the operation will succeed by seeding the value for that | 53 | expiration values, the operation will succeed by seeding the value for that |
204 | 54 | key with a initial value to expire with the provided expiration time. The | 54 | key with a initial value to expire with the provided expiration time. The |
205 | 55 | flags will be set to zero.The value is then returned via the uint32_t | 55 | flags will be set to zero.The value is then returned via the uint32_t |
207 | 56 | value pointer you pass to it. | 56 | value pointer you pass to it. memcached_increment_with_initial is only available |
208 | 57 | when using the binary protocol. | ||
209 | 57 | 58 | ||
210 | 58 | memcached_decrement_with_initial takes a key and keylength and decrements | 59 | memcached_decrement_with_initial takes a key and keylength and decrements |
211 | 59 | the value by the offset passed to it. If the object specified by key does | 60 | the value by the offset passed to it. If the object specified by key does |
212 | @@ -62,7 +63,8 @@ | |||
213 | 62 | expiration values, the operation will succeed by seeding the value for that | 63 | expiration values, the operation will succeed by seeding the value for that |
214 | 63 | key with a initial value to expire with the provided expiration time. The | 64 | key with a initial value to expire with the provided expiration time. The |
215 | 64 | flags will be set to zero.The value is then returned via the uint32_t | 65 | flags will be set to zero.The value is then returned via the uint32_t |
217 | 65 | value pointer you pass to it. | 66 | value pointer you pass to it. memcached_decrement_with_initial is only available |
218 | 67 | when using the binary protocol. | ||
219 | 66 | 68 | ||
220 | 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`, |
221 | 68 | :c:func:`memcached_increment_with_initial_by_key`, and | 70 | :c:func:`memcached_increment_with_initial_by_key`, and |
222 | 69 | 71 | ||
223 | === modified file 'libmemcached-1.2/deprecated_types.h' | |||
224 | --- libmemcached-1.2/deprecated_types.h 2011-12-12 16:59:07 +0000 | |||
225 | +++ libmemcached-1.2/deprecated_types.h 2013-10-11 12:20:38 +0000 | |||
226 | @@ -57,4 +57,5 @@ | |||
227 | 57 | typedef memcached_trigger_key_fn memcached_trigger_key; | 57 | typedef memcached_trigger_key_fn memcached_trigger_key; |
228 | 58 | typedef memcached_trigger_delete_key_fn memcached_trigger_delete_key; | 58 | typedef memcached_trigger_delete_key_fn memcached_trigger_delete_key; |
229 | 59 | typedef memcached_dump_fn memcached_dump_func; | 59 | typedef memcached_dump_fn memcached_dump_func; |
230 | 60 | typedef memcached_instance_st *memcached_server_instance_st; | ||
231 | 60 | 61 | ||
232 | 61 | 62 | ||
233 | === modified file 'libmemcached/auto.cc' | |||
234 | --- libmemcached/auto.cc 2013-04-03 13:14:23 +0000 | |||
235 | +++ libmemcached/auto.cc 2013-10-11 12:20:38 +0000 | |||
236 | @@ -57,8 +57,13 @@ | |||
237 | 57 | assert(memcached_last_error(instance->root) != MEMCACHED_SUCCESS); | 57 | assert(memcached_last_error(instance->root) != MEMCACHED_SUCCESS); |
238 | 58 | *value= UINT64_MAX; | 58 | *value= UINT64_MAX; |
239 | 59 | } | 59 | } |
240 | 60 | else if (memcached_failed(rc)) | ||
241 | 61 | { | ||
242 | 62 | *value= UINT64_MAX; | ||
243 | 63 | } | ||
244 | 60 | else | 64 | else |
245 | 61 | { | 65 | { |
246 | 66 | assert(memcached_last_error(instance->root) != MEMCACHED_NOTFOUND); | ||
247 | 62 | *value= instance->root->result.impl()->numeric_value; | 67 | *value= instance->root->result.impl()->numeric_value; |
248 | 63 | } | 68 | } |
249 | 64 | } | 69 | } |
250 | 65 | 70 | ||
251 | === modified file 'libmemcached/connect.cc' | |||
252 | --- libmemcached/connect.cc 2013-06-12 08:17:31 +0000 | |||
253 | +++ libmemcached/connect.cc 2013-10-11 12:20:38 +0000 | |||
254 | @@ -76,7 +76,7 @@ | |||
255 | 76 | if (server->root->poll_timeout == 0) | 76 | if (server->root->poll_timeout == 0) |
256 | 77 | { | 77 | { |
257 | 78 | return memcached_set_error(*server, MEMCACHED_TIMEOUT, MEMCACHED_AT, | 78 | return memcached_set_error(*server, MEMCACHED_TIMEOUT, MEMCACHED_AT, |
259 | 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().")); |
260 | 80 | } | 80 | } |
261 | 81 | 81 | ||
262 | 82 | while (--loop_max) // Should only loop on cases of ERESTART or EINTR | 82 | while (--loop_max) // Should only loop on cases of ERESTART or EINTR |
263 | 83 | 83 | ||
264 | === modified file 'libmemcached/error.cc' | |||
265 | --- libmemcached/error.cc 2013-03-31 23:24:29 +0000 | |||
266 | +++ libmemcached/error.cc 2013-10-11 12:20:38 +0000 | |||
267 | @@ -36,6 +36,9 @@ | |||
268 | 36 | */ | 36 | */ |
269 | 37 | 37 | ||
270 | 38 | #include <libmemcached/common.h> | 38 | #include <libmemcached/common.h> |
271 | 39 | |||
272 | 40 | #include "libmemcached/assert.hpp" | ||
273 | 41 | |||
274 | 39 | #include <cerrno> | 42 | #include <cerrno> |
275 | 40 | #include <cstdarg> | 43 | #include <cstdarg> |
276 | 41 | #include <cstdio> | 44 | #include <cstdio> |
277 | @@ -87,111 +90,133 @@ | |||
278 | 87 | memcached_error_free(memc); | 90 | memcached_error_free(memc); |
279 | 88 | } | 91 | } |
280 | 89 | 92 | ||
336 | 90 | // For memory allocation we use our error since it is a bit more specific | 93 | if (memcached_fatal(rc) or rc == MEMCACHED_CLIENT_ERROR) |
337 | 91 | if (local_errno == ENOMEM and rc == MEMCACHED_ERRNO) | 94 | { |
338 | 92 | { | 95 | // For memory allocation we use our error since it is a bit more specific |
339 | 93 | rc= MEMCACHED_MEMORY_ALLOCATION_FAILURE; | 96 | if (local_errno == ENOMEM and rc == MEMCACHED_ERRNO) |
340 | 94 | } | 97 | { |
341 | 95 | 98 | rc= MEMCACHED_MEMORY_ALLOCATION_FAILURE; | |
342 | 96 | if (rc == MEMCACHED_MEMORY_ALLOCATION_FAILURE) | 99 | } |
343 | 97 | { | 100 | |
344 | 98 | local_errno= ENOMEM; | 101 | if (rc == MEMCACHED_MEMORY_ALLOCATION_FAILURE) |
345 | 99 | } | 102 | { |
346 | 100 | 103 | local_errno= ENOMEM; | |
347 | 101 | if (rc == MEMCACHED_ERRNO and not local_errno) | 104 | } |
348 | 102 | { | 105 | |
349 | 103 | local_errno= errno; | 106 | if (rc == MEMCACHED_ERRNO and not local_errno) |
350 | 104 | rc= MEMCACHED_ERRNO; | 107 | { |
351 | 105 | } | 108 | local_errno= errno; |
352 | 106 | 109 | rc= MEMCACHED_ERRNO; | |
353 | 107 | if (rc == MEMCACHED_ERRNO and local_errno == ENOTCONN) | 110 | } |
354 | 108 | { | 111 | |
355 | 109 | rc= MEMCACHED_CONNECTION_FAILURE; | 112 | if (rc == MEMCACHED_ERRNO and local_errno == ENOTCONN) |
356 | 110 | } | 113 | { |
357 | 111 | 114 | rc= MEMCACHED_CONNECTION_FAILURE; | |
358 | 112 | if (rc == MEMCACHED_ERRNO and local_errno == ECONNRESET) | 115 | } |
359 | 113 | { | 116 | |
360 | 114 | rc= MEMCACHED_CONNECTION_FAILURE; | 117 | if (rc == MEMCACHED_ERRNO and local_errno == ECONNRESET) |
361 | 115 | } | 118 | { |
362 | 116 | 119 | rc= MEMCACHED_CONNECTION_FAILURE; | |
363 | 117 | if (local_errno == EINVAL) | 120 | } |
364 | 118 | { | 121 | |
365 | 119 | rc= MEMCACHED_INVALID_ARGUMENTS; | 122 | if (local_errno == EINVAL) |
366 | 120 | } | 123 | { |
367 | 121 | 124 | rc= MEMCACHED_INVALID_ARGUMENTS; | |
368 | 122 | if (local_errno == ECONNREFUSED) | 125 | } |
369 | 123 | { | 126 | |
370 | 124 | rc= MEMCACHED_CONNECTION_FAILURE; | 127 | if (local_errno == ECONNREFUSED) |
371 | 125 | } | 128 | { |
372 | 126 | 129 | rc= MEMCACHED_CONNECTION_FAILURE; | |
373 | 127 | memcached_error_t *error= libmemcached_xmalloc(&memc, memcached_error_t); | 130 | } |
374 | 128 | if (error == NULL) // Bad business if this happens | 131 | |
375 | 129 | { | 132 | if (rc == MEMCACHED_TIMEOUT) |
376 | 130 | return; | 133 | { |
377 | 131 | } | 134 | } |
378 | 132 | 135 | ||
379 | 133 | error->root= &memc; | 136 | memcached_error_t *error= libmemcached_xmalloc(&memc, memcached_error_t); |
380 | 134 | error->query_id= memc.query_id; | 137 | if (error == NULL) // Bad business if this happens |
381 | 135 | error->rc= rc; | 138 | { |
382 | 136 | error->local_errno= local_errno; | 139 | assert_msg(error, "libmemcached_xmalloc() failed to allocate a memcached_error_t"); |
383 | 137 | 140 | return; | |
384 | 138 | const char *errmsg_ptr; | 141 | } |
385 | 139 | char errmsg[MAX_ERROR_LENGTH]; | 142 | |
386 | 140 | errmsg[0]= 0; | 143 | error->root= &memc; |
387 | 141 | errmsg_ptr= errmsg; | 144 | error->query_id= memc.query_id; |
388 | 142 | 145 | error->rc= rc; | |
389 | 143 | if (local_errno) | 146 | error->local_errno= local_errno; |
390 | 144 | { | 147 | |
391 | 148 | // MEMCACHED_CLIENT_ERROR is a special case because it is an error coming from the server | ||
392 | 149 | if (rc == MEMCACHED_CLIENT_ERROR) | ||
393 | 150 | { | ||
394 | 151 | assert(str); | ||
395 | 152 | assert(str->size); | ||
396 | 153 | if (str and str->size) | ||
397 | 154 | { | ||
398 | 155 | assert(error->local_errno == 0); | ||
399 | 156 | error->local_errno= 0; | ||
400 | 157 | |||
401 | 158 | error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %.*s", | ||
402 | 159 | error->root, | ||
403 | 160 | int(str->size), str->c_str); | ||
404 | 161 | } | ||
405 | 162 | } | ||
406 | 163 | else if (local_errno) | ||
407 | 164 | { | ||
408 | 165 | const char *errmsg_ptr; | ||
409 | 166 | char errmsg[MAX_ERROR_LENGTH]; | ||
410 | 167 | errmsg[0]= 0; | ||
411 | 168 | errmsg_ptr= errmsg; | ||
412 | 169 | |||
413 | 145 | #if defined(STRERROR_R_CHAR_P) && STRERROR_R_CHAR_P | 170 | #if defined(STRERROR_R_CHAR_P) && STRERROR_R_CHAR_P |
415 | 146 | errmsg_ptr= strerror_r(local_errno, errmsg, sizeof(errmsg)); | 171 | errmsg_ptr= strerror_r(local_errno, errmsg, sizeof(errmsg)); |
416 | 147 | #elif defined(HAVE_STRERROR_R) && HAVE_STRERROR_R | 172 | #elif defined(HAVE_STRERROR_R) && HAVE_STRERROR_R |
419 | 148 | strerror_r(local_errno, errmsg, sizeof(errmsg)); | 173 | strerror_r(local_errno, errmsg, sizeof(errmsg)); |
420 | 149 | errmsg_ptr= errmsg; | 174 | errmsg_ptr= errmsg; |
421 | 150 | #elif defined(HAVE_STRERROR) && HAVE_STRERROR | 175 | #elif defined(HAVE_STRERROR) && HAVE_STRERROR |
424 | 151 | snprintf(errmsg, sizeof(errmsg), "%s", strerror(local_errno)); | 176 | snprintf(errmsg, sizeof(errmsg), "%s", strerror(local_errno)); |
425 | 152 | errmsg_ptr= errmsg; | 177 | errmsg_ptr= errmsg; |
426 | 153 | #endif | 178 | #endif |
468 | 154 | } | 179 | |
469 | 155 | 180 | if (str and str->size and local_errno) | |
470 | 156 | 181 | { | |
471 | 157 | if (str and str->size and local_errno) | 182 | error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s(%s), %.*s -> %s", |
472 | 158 | { | 183 | error->root, |
473 | 159 | error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s(%s), %.*s -> %s", | 184 | memcached_strerror(&memc, rc), |
474 | 160 | error->root, | 185 | errmsg_ptr, |
475 | 161 | memcached_strerror(&memc, rc), | 186 | memcached_string_printf(*str), at); |
476 | 162 | errmsg_ptr, | 187 | } |
477 | 163 | memcached_string_printf(*str), at); | 188 | else |
478 | 164 | } | 189 | { |
479 | 165 | else if (local_errno) | 190 | error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s(%s) -> %s", |
480 | 166 | { | 191 | error->root, |
481 | 167 | error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s(%s) -> %s", | 192 | memcached_strerror(&memc, rc), |
482 | 168 | error->root, | 193 | errmsg_ptr, |
483 | 169 | memcached_strerror(&memc, rc), | 194 | at); |
484 | 170 | errmsg_ptr, | 195 | } |
485 | 171 | at); | 196 | } |
486 | 172 | } | 197 | else if (rc == MEMCACHED_PARSE_ERROR and str and str->size) |
487 | 173 | else if (rc == MEMCACHED_PARSE_ERROR and str and str->size) | 198 | { |
488 | 174 | { | 199 | error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %.*s -> %s", |
489 | 175 | error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %.*s -> %s", | 200 | error->root, |
490 | 176 | error->root, | 201 | int(str->size), str->c_str, at); |
491 | 177 | int(str->size), str->c_str, at); | 202 | } |
492 | 178 | } | 203 | else if (str and str->size) |
493 | 179 | else if (str and str->size) | 204 | { |
494 | 180 | { | 205 | error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s, %.*s -> %s", |
495 | 181 | error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s, %.*s -> %s", | 206 | error->root, |
496 | 182 | error->root, | 207 | memcached_strerror(&memc, rc), |
497 | 183 | memcached_strerror(&memc, rc), | 208 | int(str->size), str->c_str, at); |
498 | 184 | int(str->size), str->c_str, at); | 209 | } |
499 | 185 | } | 210 | else |
500 | 186 | else | 211 | { |
501 | 187 | { | 212 | error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s -> %s", |
502 | 188 | error->size= (int)snprintf(error->message, MAX_ERROR_LENGTH, "(%p) %s -> %s", | 213 | error->root, |
503 | 189 | error->root, | 214 | memcached_strerror(&memc, rc), at); |
504 | 190 | memcached_strerror(&memc, rc), at); | 215 | } |
505 | 191 | } | 216 | |
506 | 192 | 217 | error->next= memc.error_messages; | |
507 | 193 | error->next= memc.error_messages; | 218 | memc.error_messages= error; |
508 | 194 | memc.error_messages= error; | 219 | } |
509 | 195 | 220 | ||
510 | 196 | #if 0 | 221 | #if 0 |
511 | 197 | if (error_log_fd == -1) | 222 | if (error_log_fd == -1) |
512 | @@ -231,13 +256,11 @@ | |||
513 | 231 | memcached_return_t memcached_set_error(Memcached& memc, memcached_return_t rc, const char *at, memcached_string_t& str) | 256 | memcached_return_t memcached_set_error(Memcached& memc, memcached_return_t rc, const char *at, memcached_string_t& str) |
514 | 232 | { | 257 | { |
515 | 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"); |
517 | 234 | if (memcached_fatal(rc) == false) | 259 | if (memcached_fatal(rc)) |
518 | 235 | { | 260 | { |
520 | 236 | return rc; | 261 | _set(memc, &str, rc, at); |
521 | 237 | } | 262 | } |
522 | 238 | 263 | ||
523 | 239 | _set(memc, &str, rc, at); | ||
524 | 240 | |||
525 | 241 | return rc; | 264 | return rc; |
526 | 242 | } | 265 | } |
527 | 243 | 266 | ||
528 | @@ -299,17 +322,15 @@ | |||
529 | 299 | memcached_string_t error_host= { hostname_port_message, size_t(size) }; | 322 | memcached_string_t error_host= { hostname_port_message, size_t(size) }; |
530 | 300 | 323 | ||
531 | 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"); |
533 | 302 | if (self.root == NULL) | 325 | if (self.root) |
534 | 303 | { | 326 | { |
536 | 304 | return rc; | 327 | _set(*self.root, &error_host, rc, at); |
537 | 328 | _set(self, (*self.root)); | ||
538 | 329 | assert(self.error_messages); | ||
539 | 330 | assert(self.root->error_messages); | ||
540 | 331 | assert(self.error_messages->rc == self.root->error_messages->rc); | ||
541 | 305 | } | 332 | } |
542 | 306 | 333 | ||
543 | 307 | _set(*self.root, &error_host, rc, at); | ||
544 | 308 | _set(self, (*self.root)); | ||
545 | 309 | assert(self.root->error_messages); | ||
546 | 310 | assert(self.error_messages); | ||
547 | 311 | assert(self.error_messages->rc == self.root->error_messages->rc); | ||
548 | 312 | |||
549 | 313 | return rc; | 334 | return rc; |
550 | 314 | } | 335 | } |
551 | 315 | 336 | ||
552 | @@ -326,14 +347,12 @@ | |||
553 | 326 | 347 | ||
554 | 327 | memcached_string_t error_host= { hostname_port, size}; | 348 | memcached_string_t error_host= { hostname_port, size}; |
555 | 328 | 349 | ||
557 | 329 | if (self.root == NULL) | 350 | if (self.root) |
558 | 330 | { | 351 | { |
560 | 331 | return rc; | 352 | _set(*self.root, &error_host, rc, at); |
561 | 353 | _set(self, *self.root); | ||
562 | 332 | } | 354 | } |
563 | 333 | 355 | ||
564 | 334 | _set(*self.root, &error_host, rc, at); | ||
565 | 335 | _set(self, *self.root); | ||
566 | 336 | |||
567 | 337 | return rc; | 356 | return rc; |
568 | 338 | } | 357 | } |
569 | 339 | 358 | ||
570 | @@ -528,7 +547,7 @@ | |||
571 | 528 | { | 547 | { |
572 | 529 | if (memc->error_messages) | 548 | if (memc->error_messages) |
573 | 530 | { | 549 | { |
575 | 531 | if (memc->error_messages->size == 0) | 550 | if (memc->error_messages->size and memc->error_messages->message[0]) |
576 | 532 | { | 551 | { |
577 | 533 | return memc->error_messages->message; | 552 | return memc->error_messages->message; |
578 | 534 | } | 553 | } |
579 | 535 | 554 | ||
580 | === modified file 'libmemcached/get.cc' | |||
581 | --- libmemcached/get.cc 2013-04-03 13:14:23 +0000 | |||
582 | +++ libmemcached/get.cc 2013-10-11 12:20:38 +0000 | |||
583 | @@ -114,7 +114,6 @@ | |||
584 | 114 | { | 114 | { |
585 | 115 | *error= MEMCACHED_NOTFOUND; | 115 | *error= MEMCACHED_NOTFOUND; |
586 | 116 | } | 116 | } |
587 | 117 | |||
588 | 118 | if (value == NULL) | 117 | if (value == NULL) |
589 | 119 | { | 118 | { |
590 | 120 | if (ptr->get_key_failure and *error == MEMCACHED_NOTFOUND) | 119 | if (ptr->get_key_failure and *error == MEMCACHED_NOTFOUND) |
591 | @@ -221,12 +220,14 @@ | |||
592 | 221 | 220 | ||
593 | 222 | if (number_of_keys == 0) | 221 | if (number_of_keys == 0) |
594 | 223 | { | 222 | { |
596 | 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")); |
597 | 225 | } | 224 | } |
598 | 226 | 225 | ||
600 | 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)))) |
601 | 228 | { | 227 | { |
603 | 229 | return memcached_last_error(ptr); | 228 | assert(memcached_last_error(ptr) == rc); |
604 | 229 | |||
605 | 230 | return rc; | ||
606 | 230 | } | 231 | } |
607 | 231 | 232 | ||
608 | 232 | bool is_group_key_set= false; | 233 | bool is_group_key_set= false; |
609 | @@ -463,6 +464,11 @@ | |||
610 | 463 | 464 | ||
611 | 464 | bool flush= (number_of_keys == 1); | 465 | bool flush= (number_of_keys == 1); |
612 | 465 | 466 | ||
613 | 467 | if (memcached_failed(rc= memcached_key_test(*ptr, keys, key_length, number_of_keys))) | ||
614 | 468 | { | ||
615 | 469 | return rc; | ||
616 | 470 | } | ||
617 | 471 | |||
618 | 466 | /* | 472 | /* |
619 | 467 | If a server fails we warn about errors and start all over with sending keys | 473 | If a server fails we warn about errors and start all over with sending keys |
620 | 468 | to the server. | 474 | to the server. |
621 | @@ -502,10 +508,13 @@ | |||
622 | 502 | request.message.header.request.opcode= PROTOCOL_BINARY_CMD_GETK; | 508 | request.message.header.request.opcode= PROTOCOL_BINARY_CMD_GETK; |
623 | 503 | } | 509 | } |
624 | 504 | 510 | ||
625 | 511 | #if 0 | ||
626 | 505 | { | 512 | { |
627 | 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); |
629 | 507 | if (vk != MEMCACHED_SUCCESS) | 514 | if (memcached_failed(rc= memcached_key_test(*memc, (const char **)&key, &key_length, 1))) |
630 | 508 | { | 515 | { |
631 | 516 | memcached_set_error(ptr, vk, MEMCACHED_AT, memcached_literal_param("Key was too long.")); | ||
632 | 517 | |||
633 | 509 | if (x > 0) | 518 | if (x > 0) |
634 | 510 | { | 519 | { |
635 | 511 | memcached_io_reset(instance); | 520 | memcached_io_reset(instance); |
636 | @@ -514,6 +523,7 @@ | |||
637 | 514 | return vk; | 523 | return vk; |
638 | 515 | } | 524 | } |
639 | 516 | } | 525 | } |
640 | 526 | #endif | ||
641 | 517 | 527 | ||
642 | 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))); |
643 | 519 | request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES; | 529 | request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES; |
644 | 520 | 530 | ||
645 | === modified file 'libmemcached/io.cc' | |||
646 | --- libmemcached/io.cc 2013-03-31 23:24:29 +0000 | |||
647 | +++ libmemcached/io.cc 2013-10-11 12:20:38 +0000 | |||
648 | @@ -99,7 +99,7 @@ | |||
649 | 99 | case EWOULDBLOCK: | 99 | case EWOULDBLOCK: |
650 | 100 | #endif | 100 | #endif |
651 | 101 | case EAGAIN: | 101 | case EAGAIN: |
653 | 102 | #ifdef TARGET_OS_LINUX | 102 | #ifdef __linux |
654 | 103 | case ERESTART: | 103 | case ERESTART: |
655 | 104 | #endif | 104 | #endif |
656 | 105 | break; // No IO is fine, we can just move on | 105 | break; // No IO is fine, we can just move on |
657 | @@ -265,7 +265,7 @@ | |||
658 | 265 | assert_msg(active_fd == -1 , "poll() returned an unexpected value"); | 265 | assert_msg(active_fd == -1 , "poll() returned an unexpected value"); |
659 | 266 | switch (local_errno) | 266 | switch (local_errno) |
660 | 267 | { | 267 | { |
662 | 268 | #ifdef TARGET_OS_LINUX | 268 | #ifdef __linux |
663 | 269 | case ERESTART: | 269 | case ERESTART: |
664 | 270 | #endif | 270 | #endif |
665 | 271 | case EINTR: | 271 | case EINTR: |
666 | @@ -412,6 +412,11 @@ | |||
667 | 412 | return io_wait(instance, MEM_WRITE); | 412 | return io_wait(instance, MEM_WRITE); |
668 | 413 | } | 413 | } |
669 | 414 | 414 | ||
670 | 415 | memcached_return_t memcached_io_wait_for_read(memcached_instance_st* instance) | ||
671 | 416 | { | ||
672 | 417 | return io_wait(instance, MEM_READ); | ||
673 | 418 | } | ||
674 | 419 | |||
675 | 415 | static memcached_return_t _io_fill(memcached_instance_st* instance) | 420 | static memcached_return_t _io_fill(memcached_instance_st* instance) |
676 | 416 | { | 421 | { |
677 | 417 | ssize_t data_read; | 422 | ssize_t data_read; |
678 | @@ -430,7 +435,7 @@ | |||
679 | 430 | case EWOULDBLOCK: | 435 | case EWOULDBLOCK: |
680 | 431 | #endif | 436 | #endif |
681 | 432 | case EAGAIN: | 437 | case EAGAIN: |
683 | 433 | #ifdef TARGET_OS_LINUX | 438 | #ifdef __linux |
684 | 434 | case ERESTART: | 439 | case ERESTART: |
685 | 435 | #endif | 440 | #endif |
686 | 436 | { | 441 | { |
687 | @@ -568,7 +573,7 @@ | |||
688 | 568 | case EWOULDBLOCK: | 573 | case EWOULDBLOCK: |
689 | 569 | #endif | 574 | #endif |
690 | 570 | case EAGAIN: | 575 | case EAGAIN: |
692 | 571 | #ifdef TARGET_OS_LINUX | 576 | #ifdef __linux |
693 | 572 | case ERESTART: | 577 | case ERESTART: |
694 | 573 | #endif | 578 | #endif |
695 | 574 | if (memcached_success(io_wait(instance, MEM_READ))) | 579 | if (memcached_success(io_wait(instance, MEM_READ))) |
696 | 575 | 580 | ||
697 | === modified file 'libmemcached/io.hpp' | |||
698 | --- libmemcached/io.hpp 2013-03-31 23:24:29 +0000 | |||
699 | +++ libmemcached/io.hpp 2013-10-11 12:20:38 +0000 | |||
700 | @@ -49,7 +49,8 @@ | |||
701 | 49 | libmemcached_io_vector_st vector[], | 49 | libmemcached_io_vector_st vector[], |
702 | 50 | const size_t number_of, const bool with_flush); | 50 | const size_t number_of, const bool with_flush); |
703 | 51 | 51 | ||
705 | 52 | memcached_return_t memcached_io_wait_for_write(memcached_instance_st* ptr); | 52 | memcached_return_t memcached_io_wait_for_write(memcached_instance_st*); |
706 | 53 | memcached_return_t memcached_io_wait_for_read(memcached_instance_st*); | ||
707 | 53 | 54 | ||
708 | 54 | void memcached_io_reset(memcached_instance_st* ptr); | 55 | void memcached_io_reset(memcached_instance_st* ptr); |
709 | 55 | 56 | ||
710 | 56 | 57 | ||
711 | === modified file 'libmemcached/key.cc' | |||
712 | --- libmemcached/key.cc 2012-02-13 20:14:15 +0000 | |||
713 | +++ libmemcached/key.cc 2013-10-11 12:20:38 +0000 | |||
714 | @@ -37,47 +37,71 @@ | |||
715 | 37 | 37 | ||
716 | 38 | #include <libmemcached/common.h> | 38 | #include <libmemcached/common.h> |
717 | 39 | 39 | ||
718 | 40 | static inline memcached_return_t memcached_validate_key_length(size_t key_length, bool) | ||
719 | 41 | { | ||
720 | 42 | if (key_length == 0) | ||
721 | 43 | { | ||
722 | 44 | return MEMCACHED_BAD_KEY_PROVIDED; | ||
723 | 45 | } | ||
724 | 46 | |||
725 | 47 | // No one ever reimplemented MEMCACHED to use keys longer then the original ascii length | ||
726 | 48 | #if 0 | ||
727 | 49 | if (binary) | ||
728 | 50 | { | ||
729 | 51 | if (key_length > 0xffff) | ||
730 | 52 | { | ||
731 | 53 | return MEMCACHED_BAD_KEY_PROVIDED; | ||
732 | 54 | } | ||
733 | 55 | } | ||
734 | 56 | else | ||
735 | 57 | #endif | ||
736 | 58 | { | ||
737 | 59 | if (key_length >= MEMCACHED_MAX_KEY) | ||
738 | 60 | { | ||
739 | 61 | return MEMCACHED_BAD_KEY_PROVIDED; | ||
740 | 62 | } | ||
741 | 63 | } | ||
742 | 64 | |||
743 | 65 | return MEMCACHED_SUCCESS; | ||
744 | 66 | } | ||
745 | 67 | |||
746 | 40 | memcached_return_t memcached_key_test(memcached_st &memc, | 68 | memcached_return_t memcached_key_test(memcached_st &memc, |
747 | 41 | const char * const *keys, | 69 | const char * const *keys, |
748 | 42 | const size_t *key_length, | 70 | const size_t *key_length, |
749 | 43 | size_t number_of_keys) | 71 | size_t number_of_keys) |
750 | 44 | { | 72 | { |
751 | 73 | if (number_of_keys == 0) | ||
752 | 74 | { | ||
753 | 75 | return memcached_set_error(memc, MEMCACHED_INVALID_ARGUMENTS, MEMCACHED_AT, memcached_literal_param("Numbers of keys provided was zero")); | ||
754 | 76 | } | ||
755 | 77 | |||
756 | 45 | if (keys == NULL or key_length == NULL) | 78 | if (keys == NULL or key_length == NULL) |
757 | 46 | { | 79 | { |
758 | 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.")); |
759 | 48 | } | 81 | } |
760 | 49 | 82 | ||
761 | 83 | const bool is_binary= memcached_flag(memc, MEMCACHED_FLAG_BINARY_PROTOCOL); | ||
762 | 84 | |||
763 | 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, |
764 | 51 | // we just check the size of the key | 86 | // we just check the size of the key |
784 | 52 | if (memc.flags.verify_key == false or memc.flags.binary_protocol == true) | 87 | for (size_t x= 0; x < number_of_keys; ++x) |
785 | 53 | { | 88 | { |
786 | 54 | for (size_t x= 0; x < number_of_keys; x++) | 89 | // We should set binary key, but the memcached server is broken for |
787 | 55 | { | 90 | // longer keys at the moment. |
788 | 56 | // We should set binary key, but the memcached server is broken for | 91 | memcached_return_t rc= memcached_validate_key_length(*(key_length +x), false /* memc.flags.binary_protocol */); |
770 | 57 | // longer keys at the moment. | ||
771 | 58 | memcached_return_t rc= memcached_validate_key_length(*(key_length +x), false /* memc.flags.binary_protocol */); | ||
772 | 59 | if (memcached_failed(rc)) | ||
773 | 60 | { | ||
774 | 61 | return memcached_set_error(memc, rc, MEMCACHED_AT, memcached_literal_param("Key provided was too long.")); | ||
775 | 62 | } | ||
776 | 63 | } | ||
777 | 64 | |||
778 | 65 | return MEMCACHED_SUCCESS; | ||
779 | 66 | } | ||
780 | 67 | |||
781 | 68 | for (size_t x= 0; x < number_of_keys; x++) | ||
782 | 69 | { | ||
783 | 70 | memcached_return_t rc= memcached_validate_key_length(*(key_length + x), false); | ||
789 | 71 | if (memcached_failed(rc)) | 92 | if (memcached_failed(rc)) |
790 | 72 | { | 93 | { |
791 | 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.")); |
792 | 74 | } | 95 | } |
795 | 75 | 96 | ||
796 | 76 | for (size_t y= 0; y < *(key_length + x); y++) | 97 | if (memc.flags.verify_key and is_binary == false) |
797 | 77 | { | 98 | { |
799 | 78 | if ((isgraph(keys[x][y])) == 0) | 99 | for (size_t y= 0; y < *(key_length +x); ++y) |
800 | 79 | { | 100 | { |
802 | 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) |
803 | 102 | { | ||
804 | 103 | return memcached_set_error(memc, MEMCACHED_BAD_KEY_PROVIDED, MEMCACHED_AT, memcached_literal_param("Key provided had invalid character.")); | ||
805 | 104 | } | ||
806 | 81 | } | 105 | } |
807 | 82 | } | 106 | } |
808 | 83 | } | 107 | } |
809 | 84 | 108 | ||
810 | === modified file 'libmemcached/key.hpp' | |||
811 | --- libmemcached/key.hpp 2011-10-02 23:49:04 +0000 | |||
812 | +++ libmemcached/key.hpp 2013-10-11 12:20:38 +0000 | |||
813 | @@ -41,27 +41,3 @@ | |||
814 | 41 | const size_t *key_length, | 41 | const size_t *key_length, |
815 | 42 | size_t number_of_keys); | 42 | size_t number_of_keys); |
816 | 43 | 43 | ||
817 | 44 | static inline memcached_return_t memcached_validate_key_length(size_t key_length, bool binary) | ||
818 | 45 | { | ||
819 | 46 | if (key_length == 0) | ||
820 | 47 | { | ||
821 | 48 | return MEMCACHED_BAD_KEY_PROVIDED; | ||
822 | 49 | } | ||
823 | 50 | |||
824 | 51 | if (binary) | ||
825 | 52 | { | ||
826 | 53 | if (key_length > 0xffff) | ||
827 | 54 | { | ||
828 | 55 | return MEMCACHED_BAD_KEY_PROVIDED; | ||
829 | 56 | } | ||
830 | 57 | } | ||
831 | 58 | else | ||
832 | 59 | { | ||
833 | 60 | if (key_length >= MEMCACHED_MAX_KEY) | ||
834 | 61 | { | ||
835 | 62 | return MEMCACHED_BAD_KEY_PROVIDED; | ||
836 | 63 | } | ||
837 | 64 | } | ||
838 | 65 | |||
839 | 66 | return MEMCACHED_SUCCESS; | ||
840 | 67 | } | ||
841 | 68 | 44 | ||
842 | === modified file 'libmemcached/response.cc' | |||
843 | --- libmemcached/response.cc 2013-06-11 12:31:47 +0000 | |||
844 | +++ libmemcached/response.cc 2013-10-11 12:20:38 +0000 | |||
845 | @@ -503,6 +503,8 @@ | |||
846 | 503 | memcached_return_t rc; | 503 | memcached_return_t rc; |
847 | 504 | protocol_binary_response_header header; | 504 | protocol_binary_response_header header; |
848 | 505 | 505 | ||
849 | 506 | assert(memcached_is_binary(instance->root)); | ||
850 | 507 | |||
851 | 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) |
852 | 507 | { | 509 | { |
853 | 508 | WATCHPOINT_ERROR(rc); | 510 | WATCHPOINT_ERROR(rc); |
854 | @@ -894,12 +896,19 @@ | |||
855 | 894 | return memcached_set_error(*instance, MEMCACHED_NOT_SUPPORTED, MEMCACHED_AT); | 896 | return memcached_set_error(*instance, MEMCACHED_NOT_SUPPORTED, MEMCACHED_AT); |
856 | 895 | } | 897 | } |
857 | 896 | 898 | ||
859 | 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 */ |
860 | 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)) |
861 | 899 | { | 901 | { |
862 | 900 | (void)memcached_io_write(instance); | 902 | (void)memcached_io_write(instance); |
863 | 901 | } | 903 | } |
864 | 902 | 904 | ||
865 | 905 | /* Before going into loop wait to see if we have any IO waiting for us */ | ||
866 | 906 | if (0) | ||
867 | 907 | { | ||
868 | 908 | memcached_return_t read_rc= memcached_io_wait_for_read(instance); | ||
869 | 909 | fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, memcached_strerror(NULL, read_rc)); | ||
870 | 910 | } | ||
871 | 911 | |||
872 | 903 | /* | 912 | /* |
873 | 904 | * The previous implementation purged all pending requests and just | 913 | * The previous implementation purged all pending requests and just |
874 | 905 | * returned the last one. Purge all pending messages to ensure backwards | 914 | * returned the last one. Purge all pending messages to ensure backwards |
875 | 906 | 915 | ||
876 | === modified file 'libmemcached/stats.cc' | |||
877 | --- libmemcached/stats.cc 2013-03-31 23:24:29 +0000 | |||
878 | +++ libmemcached/stats.cc 2013-10-11 12:20:38 +0000 | |||
879 | @@ -346,7 +346,7 @@ | |||
880 | 346 | return MEMCACHED_SUCCESS; | 346 | return MEMCACHED_SUCCESS; |
881 | 347 | } | 347 | } |
882 | 348 | 348 | ||
884 | 349 | char *memcached_stat_get_value(const memcached_st *, memcached_stat_st *memc_stat, | 349 | char *memcached_stat_get_value(const memcached_st* shell, memcached_stat_st *memc_stat, |
885 | 350 | const char *key, memcached_return_t *error) | 350 | const char *key, memcached_return_t *error) |
886 | 351 | { | 351 | { |
887 | 352 | memcached_return_t not_used; | 352 | memcached_return_t not_used; |
888 | @@ -456,13 +456,15 @@ | |||
889 | 456 | } | 456 | } |
890 | 457 | else | 457 | else |
891 | 458 | { | 458 | { |
893 | 459 | *error= MEMCACHED_NOTFOUND; | 459 | Memcached* memc= (Memcached*)memcached2Memcached(shell); |
894 | 460 | *error= memcached_set_error(*memc, MEMCACHED_INVALID_ARGUMENTS, MEMCACHED_AT, memcached_literal_param("Invalid key provided")); | ||
895 | 460 | return NULL; | 461 | return NULL; |
896 | 461 | } | 462 | } |
897 | 462 | 463 | ||
898 | 463 | if (length >= SMALL_STRING_LEN || length < 0) | 464 | if (length >= SMALL_STRING_LEN || length < 0) |
899 | 464 | { | 465 | { |
901 | 465 | *error= MEMCACHED_FAILURE; | 466 | Memcached* memc= (Memcached*)memcached2Memcached(shell); |
902 | 467 | *error= memcached_set_error(*memc, MEMCACHED_FAILURE, MEMCACHED_AT, memcached_literal_param("Internal failure occured with buffer, please report this bug.")); | ||
903 | 466 | return NULL; | 468 | return NULL; |
904 | 467 | } | 469 | } |
905 | 468 | 470 | ||
906 | @@ -658,8 +660,7 @@ | |||
907 | 658 | if (args) | 660 | if (args) |
908 | 659 | { | 661 | { |
909 | 660 | args_length= strlen(args); | 662 | args_length= strlen(args); |
912 | 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))) |
911 | 662 | if (memcached_failed(rc)) | ||
913 | 663 | { | 664 | { |
914 | 664 | *error= memcached_set_error(*self, rc, MEMCACHED_AT); | 665 | *error= memcached_set_error(*self, rc, MEMCACHED_AT); |
915 | 665 | return NULL; | 666 | return NULL; |
916 | @@ -746,7 +747,7 @@ | |||
917 | 746 | if (args) | 747 | if (args) |
918 | 747 | { | 748 | { |
919 | 748 | args_length= strlen(args); | 749 | args_length= strlen(args); |
921 | 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); |
922 | 750 | } | 751 | } |
923 | 751 | 752 | ||
924 | 752 | if (memcached_success(rc)) | 753 | if (memcached_success(rc)) |
925 | 753 | 754 | ||
926 | === modified file 'libmemcached/string.cc' | |||
927 | --- libmemcached/string.cc 2013-01-23 21:28:45 +0000 | |||
928 | +++ libmemcached/string.cc 2013-10-11 12:20:38 +0000 | |||
929 | @@ -281,18 +281,20 @@ | |||
930 | 281 | { | 281 | { |
931 | 282 | char* value= NULL; | 282 | char* value= NULL; |
932 | 283 | 283 | ||
934 | 284 | if (memcached_string_length(self)) | 284 | assert_msg(self, "Invalid memcached_string_st"); |
935 | 285 | if (self) | ||
936 | 285 | { | 286 | { |
940 | 286 | assert_msg(self, "Invalid memcached_string_st"); | 287 | if (memcached_string_length(self)) |
938 | 287 | // If we fail at adding the null, we copy and move on | ||
939 | 288 | if (memcached_success(memcached_string_append_null(self))) | ||
941 | 289 | { | 288 | { |
943 | 290 | return memcached_string_c_copy(self); | 289 | // If we fail at adding the null, we copy and move on |
944 | 290 | if (memcached_failed(memcached_string_append_null(self))) | ||
945 | 291 | { | ||
946 | 292 | return NULL; | ||
947 | 293 | } | ||
948 | 294 | |||
949 | 295 | value= self->string; | ||
950 | 296 | _init_string(self); | ||
951 | 291 | } | 297 | } |
952 | 292 | |||
953 | 293 | value= self->string; | ||
954 | 294 | |||
955 | 295 | _init_string(self); | ||
956 | 296 | } | 298 | } |
957 | 297 | 299 | ||
958 | 298 | return value; | 300 | return value; |
959 | 299 | 301 | ||
960 | === modified file 'libmemcached/touch.cc' | |||
961 | --- libmemcached/touch.cc 2013-03-31 23:24:29 +0000 | |||
962 | +++ libmemcached/touch.cc 2013-10-11 12:20:38 +0000 | |||
963 | @@ -124,9 +124,9 @@ | |||
964 | 124 | return rc; | 124 | return rc; |
965 | 125 | } | 125 | } |
966 | 126 | 126 | ||
968 | 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))) |
969 | 128 | { | 128 | { |
971 | 129 | return rc; | 129 | return memcached_set_error(*ptr, rc, MEMCACHED_AT); |
972 | 130 | } | 130 | } |
973 | 131 | 131 | ||
974 | 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); |
975 | 133 | 133 | ||
976 | === modified file 'libtest/cmdline.cc' | |||
977 | --- libtest/cmdline.cc 2013-06-12 07:11:22 +0000 | |||
978 | +++ libtest/cmdline.cc 2013-10-11 12:20:38 +0000 | |||
979 | @@ -359,7 +359,7 @@ | |||
980 | 359 | int error; | 359 | int error; |
981 | 360 | switch ((error= errno)) | 360 | switch ((error= errno)) |
982 | 361 | { | 361 | { |
984 | 362 | #ifdef TARGET_OS_LINUX | 362 | #ifdef __linux |
985 | 363 | case ERESTART: | 363 | case ERESTART: |
986 | 364 | #endif | 364 | #endif |
987 | 365 | case EINTR: | 365 | case EINTR: |
988 | 366 | 366 | ||
989 | === modified file 'libtest/core.cc' | |||
990 | --- libtest/core.cc 2012-12-09 11:40:11 +0000 | |||
991 | +++ libtest/core.cc 2013-10-11 12:20:38 +0000 | |||
992 | @@ -42,8 +42,8 @@ | |||
993 | 42 | 42 | ||
994 | 43 | void create_core(void) | 43 | void create_core(void) |
995 | 44 | { | 44 | { |
998 | 45 | #if defined(TARGET_OS_OSX) && TARGET_OS_OSX | 45 | #if defined(__APPLE__) && __APPLE__ |
999 | 46 | if (TARGET_OS_OSX) | 46 | if (__APPLE__) |
1000 | 47 | { | 47 | { |
1001 | 48 | return; | 48 | return; |
1002 | 49 | } | 49 | } |
1003 | 50 | 50 | ||
1004 | === modified file 'libtest/main.cc' | |||
1005 | --- libtest/main.cc 2013-06-12 07:11:22 +0000 | |||
1006 | +++ libtest/main.cc 2013-10-11 12:20:38 +0000 | |||
1007 | @@ -2,7 +2,7 @@ | |||
1008 | 2 | * | 2 | * |
1009 | 3 | * Data Differential YATL (i.e. libtest) library | 3 | * Data Differential YATL (i.e. libtest) library |
1010 | 4 | * | 4 | * |
1012 | 5 | * Copyright (C) 2012 Data Differential, http://datadifferential.com/ | 5 | * Copyright (C) 2012-2013 Data Differential, http://datadifferential.com/ |
1013 | 6 | * | 6 | * |
1014 | 7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without |
1015 | 8 | * modification, are permitted provided that the following conditions are | 8 | * modification, are permitted provided that the following conditions are |
1016 | @@ -43,8 +43,11 @@ | |||
1017 | 43 | #include <cstring> | 43 | #include <cstring> |
1018 | 44 | #include <ctime> | 44 | #include <ctime> |
1019 | 45 | #include <fnmatch.h> | 45 | #include <fnmatch.h> |
1020 | 46 | #include <iostream> | ||
1021 | 47 | #ifdef HAVE_STRINGS_H | ||
1022 | 48 | # include <strings.h> | ||
1023 | 49 | #endif | ||
1024 | 46 | #include <fstream> | 50 | #include <fstream> |
1025 | 47 | #include <iostream> | ||
1026 | 48 | #include <memory> | 51 | #include <memory> |
1027 | 49 | #include <sys/stat.h> | 52 | #include <sys/stat.h> |
1028 | 50 | #include <sys/time.h> | 53 | #include <sys/time.h> |
1029 | @@ -113,7 +116,7 @@ | |||
1030 | 113 | Valgrind does not currently work reliably, or sometimes at all, on OSX | 116 | Valgrind does not currently work reliably, or sometimes at all, on OSX |
1031 | 114 | - Fri Jun 15 11:24:07 EDT 2012 | 117 | - Fri Jun 15 11:24:07 EDT 2012 |
1032 | 115 | */ | 118 | */ |
1034 | 116 | #if defined(TARGET_OS_OSX) && TARGET_OS_OSX | 119 | #if defined(__APPLE__) && __APPLE__ |
1035 | 117 | if (valgrind_is_caller()) | 120 | if (valgrind_is_caller()) |
1036 | 118 | { | 121 | { |
1037 | 119 | return EXIT_SKIP; | 122 | return EXIT_SKIP; |
1038 | 120 | 123 | ||
1039 | === modified file 'libtest/unittest.cc' | |||
1040 | --- libtest/unittest.cc 2013-06-12 07:11:22 +0000 | |||
1041 | +++ libtest/unittest.cc 2013-10-11 12:20:38 +0000 | |||
1042 | @@ -657,7 +657,7 @@ | |||
1043 | 657 | const char *args[]= { "--fubar", 0 }; | 657 | const char *args[]= { "--fubar", 0 }; |
1044 | 658 | #if defined(__APPLE__) && __APPLE__ | 658 | #if defined(__APPLE__) && __APPLE__ |
1045 | 659 | ASSERT_EQ(Application::INVALID_POSIX_SPAWN, true_app.run(args)); | 659 | ASSERT_EQ(Application::INVALID_POSIX_SPAWN, true_app.run(args)); |
1047 | 660 | #elif defined(TARGET_OS_FREEBSD) && TARGET_OS_FREEBSD | 660 | #elif defined(__FreeBSD__) && __FreeBSD__ |
1048 | 661 | ASSERT_EQ(Application::INVALID_POSIX_SPAWN, true_app.run(args)); | 661 | ASSERT_EQ(Application::INVALID_POSIX_SPAWN, true_app.run(args)); |
1049 | 662 | #else | 662 | #else |
1050 | 663 | ASSERT_EQ(Application::SUCCESS, true_app.run(args)); | 663 | ASSERT_EQ(Application::SUCCESS, true_app.run(args)); |
1051 | @@ -855,8 +855,8 @@ | |||
1052 | 855 | static test_return_t gdb_wait_services_appliction_TEST(void *) | 855 | static test_return_t gdb_wait_services_appliction_TEST(void *) |
1053 | 856 | { | 856 | { |
1054 | 857 | test_skip(true, false); | 857 | test_skip(true, false); |
1057 | 858 | #if defined(TARGET_OS_OSX) && TARGET_OS_OSX | 858 | #if defined(__APPLE__) && __APPLE__ |
1058 | 859 | test_skip(0, TARGET_OS_OSX); | 859 | test_skip(0, __APPLE__); |
1059 | 860 | #endif | 860 | #endif |
1060 | 861 | 861 | ||
1061 | 862 | test_skip(0, access("/etc/services", R_OK )); | 862 | test_skip(0, access("/etc/services", R_OK )); |
1062 | @@ -879,8 +879,8 @@ | |||
1063 | 879 | test_skip(0, access("libtest/abort", X_OK )); | 879 | test_skip(0, access("libtest/abort", X_OK )); |
1064 | 880 | test_skip(true, false); | 880 | test_skip(true, false); |
1065 | 881 | 881 | ||
1068 | 882 | #if defined(TARGET_OS_OSX) && TARGET_OS_OSX | 882 | #if defined(__APPLE__) && __APPLE__ |
1069 | 883 | test_skip(0, TARGET_OS_OSX); | 883 | test_skip(0, __APPLE__); |
1070 | 884 | #endif | 884 | #endif |
1071 | 885 | 885 | ||
1072 | 886 | libtest::Application abort_app("libtest/abort", true); | 886 | libtest::Application abort_app("libtest/abort", true); |
1073 | 887 | 887 | ||
1074 | === modified file 'm4/ax_debug.m4' | |||
1075 | --- m4/ax_debug.m4 2013-01-08 01:03:28 +0000 | |||
1076 | +++ m4/ax_debug.m4 2013-10-11 12:20:38 +0000 | |||
1077 | @@ -43,7 +43,7 @@ | |||
1078 | 43 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 43 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
1079 | 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. |
1080 | 45 | 45 | ||
1082 | 46 | #serial 5 | 46 | #serial 6 |
1083 | 47 | 47 | ||
1084 | 48 | AC_DEFUN([AX_DEBUG], | 48 | AC_DEFUN([AX_DEBUG], |
1085 | 49 | [AC_PREREQ([2.63])dnl | 49 | [AC_PREREQ([2.63])dnl |
1086 | @@ -52,7 +52,9 @@ | |||
1087 | 52 | [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])], | 52 | [Add debug code/turns off optimizations (yes|no) @<:@default=no@:>@])], |
1088 | 53 | [ax_enable_debug=yes | 53 | [ax_enable_debug=yes |
1089 | 54 | AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging code.]) | 54 | AC_DEFINE([DEBUG],[1],[Define to 1 to enable debugging code.]) |
1091 | 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])]) |
1092 | 56 | AX_ADD_AM_MACRO([--debug],[AM_YFLAGS]) | ||
1093 | 57 | AX_ADD_AM_MACRO([-D_GLIBCXX_DEBUG],[AM_CPPFLAGS])], | ||
1094 | 56 | [ax_enable_debug=no | 58 | [ax_enable_debug=no |
1095 | 57 | AC_SUBST([MCHECK]) | 59 | AC_SUBST([MCHECK]) |
1096 | 58 | AC_DEFINE([DEBUG],[0],[Define to 1 to enable debugging code.])]) | 60 | AC_DEFINE([DEBUG],[0],[Define to 1 to enable debugging code.])]) |
1097 | 59 | 61 | ||
1098 | === modified file 'tests/cli.am' | |||
1099 | --- tests/cli.am 2013-05-03 20:00:36 +0000 | |||
1100 | +++ tests/cli.am 2013-10-11 12:20:38 +0000 | |||
1101 | @@ -122,3 +122,12 @@ | |||
1102 | 122 | 122 | ||
1103 | 123 | valgrind-memtouch: tests/memtouch | 123 | valgrind-memtouch: tests/memtouch |
1104 | 124 | @$(VALGRIND_COMMAND) tests/memtouch | 124 | @$(VALGRIND_COMMAND) tests/memtouch |
1105 | 125 | |||
1106 | 126 | test-memdump: tests/memdump | ||
1107 | 127 | tests/memdump | ||
1108 | 128 | |||
1109 | 129 | gdb-memdump: tests/memdump | ||
1110 | 130 | @$(GDB_COMMAND) tests/memdump | ||
1111 | 131 | |||
1112 | 132 | valgrind-memdump: tests/memdump | ||
1113 | 133 | @$(VALGRIND_COMMAND) tests/memdump | ||
1114 | 125 | 134 | ||
1115 | === modified file 'tests/libmemcached-1.0/all_tests.h' | |||
1116 | --- tests/libmemcached-1.0/all_tests.h 2013-02-23 21:43:42 +0000 | |||
1117 | +++ tests/libmemcached-1.0/all_tests.h 2013-10-11 12:20:38 +0000 | |||
1118 | @@ -70,9 +70,11 @@ | |||
1119 | 70 | {"partial mget", false, (test_callback_fn*)get_test5 }, | 70 | {"partial mget", false, (test_callback_fn*)get_test5 }, |
1120 | 71 | {"stats_servername", false, (test_callback_fn*)stats_servername_test }, | 71 | {"stats_servername", false, (test_callback_fn*)stats_servername_test }, |
1121 | 72 | {"increment", false, (test_callback_fn*)increment_test }, | 72 | {"increment", false, (test_callback_fn*)increment_test }, |
1123 | 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 }, |
1124 | 74 | {"memcached_increment_with_initial(999)", true, (test_callback_fn*)increment_with_initial_999_test }, | ||
1125 | 74 | {"decrement", false, (test_callback_fn*)decrement_test }, | 75 | {"decrement", false, (test_callback_fn*)decrement_test }, |
1127 | 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 }, |
1128 | 77 | {"memcached_decrement_with_initial(999)", true, (test_callback_fn*)decrement_with_initial_999_test }, | ||
1129 | 76 | {"increment_by_key", false, (test_callback_fn*)increment_by_key_test }, | 78 | {"increment_by_key", false, (test_callback_fn*)increment_by_key_test }, |
1130 | 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 }, |
1131 | 78 | {"decrement_by_key", false, (test_callback_fn*)decrement_by_key_test }, | 80 | {"decrement_by_key", false, (test_callback_fn*)decrement_by_key_test }, |
1132 | 79 | 81 | ||
1133 | === modified file 'tests/libmemcached-1.0/mem_functions.cc' | |||
1134 | --- tests/libmemcached-1.0/mem_functions.cc 2013-04-20 09:55:24 +0000 | |||
1135 | +++ tests/libmemcached-1.0/mem_functions.cc 2013-10-11 12:20:38 +0000 | |||
1136 | @@ -994,6 +994,7 @@ | |||
1137 | 994 | test_compare(MEMCACHED_SUCCESS, | 994 | test_compare(MEMCACHED_SUCCESS, |
1138 | 995 | memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, true)); | 995 | memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, true)); |
1139 | 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() |
1140 | 997 | ASSERT_TRUE(memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY)); | ||
1141 | 997 | 998 | ||
1142 | 998 | /* All keys are valid in the binary protocol (except for length) */ | 999 | /* All keys are valid in the binary protocol (except for length) */ |
1143 | 999 | if (memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == false) | 1000 | if (memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == false) |
1144 | @@ -1295,24 +1296,39 @@ | |||
1145 | 1295 | return TEST_SUCCESS; | 1296 | return TEST_SUCCESS; |
1146 | 1296 | } | 1297 | } |
1147 | 1297 | 1298 | ||
1148 | 1299 | static test_return_t __increment_with_initial_test(memcached_st *memc, uint64_t initial) | ||
1149 | 1300 | { | ||
1150 | 1301 | uint64_t new_number; | ||
1151 | 1302 | |||
1152 | 1303 | test_compare(MEMCACHED_SUCCESS, memcached_flush_buffers(memc)); | ||
1153 | 1304 | |||
1154 | 1305 | if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL)) | ||
1155 | 1306 | { | ||
1156 | 1307 | test_compare(MEMCACHED_SUCCESS, | ||
1157 | 1308 | memcached_increment_with_initial(memc, test_literal_param("number"), 1, initial, 0, &new_number)); | ||
1158 | 1309 | test_compare(new_number, initial); | ||
1159 | 1310 | |||
1160 | 1311 | test_compare(MEMCACHED_SUCCESS, | ||
1161 | 1312 | memcached_increment_with_initial(memc, test_literal_param("number"), 1, initial, 0, &new_number)); | ||
1162 | 1313 | test_compare(new_number, (initial +1)); | ||
1163 | 1314 | } | ||
1164 | 1315 | else | ||
1165 | 1316 | { | ||
1166 | 1317 | test_compare(MEMCACHED_INVALID_ARGUMENTS, | ||
1167 | 1318 | memcached_increment_with_initial(memc, test_literal_param("number"), 1, initial, 0, &new_number)); | ||
1168 | 1319 | } | ||
1169 | 1320 | |||
1170 | 1321 | return TEST_SUCCESS; | ||
1171 | 1322 | } | ||
1172 | 1323 | |||
1173 | 1298 | test_return_t increment_with_initial_test(memcached_st *memc) | 1324 | test_return_t increment_with_initial_test(memcached_st *memc) |
1174 | 1299 | { | 1325 | { |
1191 | 1300 | test_skip(true, memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL)); | 1326 | return __increment_with_initial_test(memc, 0); |
1192 | 1301 | 1327 | } | |
1193 | 1302 | uint64_t new_number; | 1328 | |
1194 | 1303 | uint64_t initial= 0; | 1329 | test_return_t increment_with_initial_999_test(memcached_st *memc) |
1195 | 1304 | 1330 | { | |
1196 | 1305 | test_compare(MEMCACHED_SUCCESS, memcached_flush_buffers(memc)); | 1331 | return __increment_with_initial_test(memc, 999); |
1181 | 1306 | |||
1182 | 1307 | test_compare(MEMCACHED_SUCCESS, | ||
1183 | 1308 | memcached_increment_with_initial(memc, test_literal_param("number"), 1, initial, 0, &new_number)); | ||
1184 | 1309 | test_compare(new_number, initial); | ||
1185 | 1310 | |||
1186 | 1311 | test_compare(MEMCACHED_SUCCESS, | ||
1187 | 1312 | memcached_increment_with_initial(memc, test_literal_param("number"), 1, initial, 0, &new_number)); | ||
1188 | 1313 | test_compare(new_number, (initial +1)); | ||
1189 | 1314 | |||
1190 | 1315 | return TEST_SUCCESS; | ||
1197 | 1316 | } | 1332 | } |
1198 | 1317 | 1333 | ||
1199 | 1318 | test_return_t decrement_test(memcached_st *memc) | 1334 | test_return_t decrement_test(memcached_st *memc) |
1200 | @@ -1342,30 +1358,38 @@ | |||
1201 | 1342 | return TEST_SUCCESS; | 1358 | return TEST_SUCCESS; |
1202 | 1343 | } | 1359 | } |
1203 | 1344 | 1360 | ||
1204 | 1361 | static test_return_t __decrement_with_initial_test(memcached_st *memc, uint64_t initial) | ||
1205 | 1362 | { | ||
1206 | 1363 | test_skip(true, memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL)); | ||
1207 | 1364 | |||
1208 | 1365 | test_compare(MEMCACHED_SUCCESS, memcached_flush_buffers(memc)); | ||
1209 | 1366 | |||
1210 | 1367 | uint64_t new_number; | ||
1211 | 1368 | test_compare(MEMCACHED_SUCCESS, | ||
1212 | 1369 | memcached_decrement_with_initial(memc, | ||
1213 | 1370 | test_literal_param(__func__), | ||
1214 | 1371 | 1, initial, | ||
1215 | 1372 | 0, &new_number)); | ||
1216 | 1373 | test_compare(new_number, initial); | ||
1217 | 1374 | |||
1218 | 1375 | test_compare(MEMCACHED_SUCCESS, | ||
1219 | 1376 | memcached_decrement_with_initial(memc, | ||
1220 | 1377 | test_literal_param(__func__), | ||
1221 | 1378 | 1, initial, | ||
1222 | 1379 | 0, &new_number)); | ||
1223 | 1380 | test_compare(new_number, (initial - 1)); | ||
1224 | 1381 | |||
1225 | 1382 | return TEST_SUCCESS; | ||
1226 | 1383 | } | ||
1227 | 1384 | |||
1228 | 1345 | test_return_t decrement_with_initial_test(memcached_st *memc) | 1385 | test_return_t decrement_with_initial_test(memcached_st *memc) |
1229 | 1346 | { | 1386 | { |
1252 | 1347 | test_skip(true, memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL)); | 1387 | return __decrement_with_initial_test(memc, 3); |
1253 | 1348 | 1388 | } | |
1254 | 1349 | uint64_t initial= 3; | 1389 | |
1255 | 1350 | 1390 | test_return_t decrement_with_initial_999_test(memcached_st *memc) | |
1256 | 1351 | test_compare(MEMCACHED_SUCCESS, memcached_flush_buffers(memc)); | 1391 | { |
1257 | 1352 | 1392 | return __decrement_with_initial_test(memc, 999); | |
1236 | 1353 | uint64_t new_number; | ||
1237 | 1354 | test_compare(MEMCACHED_SUCCESS, | ||
1238 | 1355 | memcached_decrement_with_initial(memc, | ||
1239 | 1356 | test_literal_param(__func__), | ||
1240 | 1357 | 1, initial, | ||
1241 | 1358 | 0, &new_number)); | ||
1242 | 1359 | test_compare(new_number, initial); | ||
1243 | 1360 | |||
1244 | 1361 | test_compare(MEMCACHED_SUCCESS, | ||
1245 | 1362 | memcached_decrement_with_initial(memc, | ||
1246 | 1363 | test_literal_param(__func__), | ||
1247 | 1364 | 1, initial, | ||
1248 | 1365 | 0, &new_number)); | ||
1249 | 1366 | test_compare(new_number, (initial - 1)); | ||
1250 | 1367 | |||
1251 | 1368 | return TEST_SUCCESS; | ||
1258 | 1369 | } | 1393 | } |
1259 | 1370 | 1394 | ||
1260 | 1371 | test_return_t increment_by_key_test(memcached_st *memc) | 1395 | test_return_t increment_by_key_test(memcached_st *memc) |
1261 | @@ -1399,24 +1423,32 @@ | |||
1262 | 1399 | 1423 | ||
1263 | 1400 | test_return_t increment_with_initial_by_key_test(memcached_st *memc) | 1424 | test_return_t increment_with_initial_by_key_test(memcached_st *memc) |
1264 | 1401 | { | 1425 | { |
1265 | 1402 | test_skip(true, memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL)); | ||
1266 | 1403 | |||
1267 | 1404 | uint64_t new_number; | 1426 | uint64_t new_number; |
1268 | 1405 | const char *master_key= "foo"; | 1427 | const char *master_key= "foo"; |
1269 | 1406 | const char *key= "number"; | 1428 | const char *key= "number"; |
1270 | 1407 | uint64_t initial= 0; | 1429 | uint64_t initial= 0; |
1271 | 1408 | 1430 | ||
1277 | 1409 | test_compare(MEMCACHED_SUCCESS, | 1431 | if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL)) |
1278 | 1410 | memcached_increment_with_initial_by_key(memc, master_key, strlen(master_key), | 1432 | { |
1279 | 1411 | key, strlen(key), | 1433 | test_compare(MEMCACHED_SUCCESS, |
1280 | 1412 | 1, initial, 0, &new_number)); | 1434 | memcached_increment_with_initial_by_key(memc, master_key, strlen(master_key), |
1281 | 1413 | test_compare(new_number, initial); | 1435 | key, strlen(key), |
1282 | 1436 | 1, initial, 0, &new_number)); | ||
1283 | 1437 | test_compare(new_number, initial); | ||
1284 | 1414 | 1438 | ||
1290 | 1415 | test_compare(MEMCACHED_SUCCESS, | 1439 | test_compare(MEMCACHED_SUCCESS, |
1291 | 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), |
1292 | 1417 | key, strlen(key), | 1441 | key, strlen(key), |
1293 | 1418 | 1, initial, 0, &new_number)); | 1442 | 1, initial, 0, &new_number)); |
1294 | 1419 | test_compare(new_number, (initial +1)); | 1443 | test_compare(new_number, (initial +1)); |
1295 | 1444 | } | ||
1296 | 1445 | else | ||
1297 | 1446 | { | ||
1298 | 1447 | test_compare(MEMCACHED_INVALID_ARGUMENTS, | ||
1299 | 1448 | memcached_increment_with_initial_by_key(memc, master_key, strlen(master_key), | ||
1300 | 1449 | key, strlen(key), | ||
1301 | 1450 | 1, initial, 0, &new_number)); | ||
1302 | 1451 | } | ||
1303 | 1420 | 1452 | ||
1304 | 1421 | return TEST_SUCCESS; | 1453 | return TEST_SUCCESS; |
1305 | 1422 | } | 1454 | } |
1306 | @@ -1457,19 +1489,30 @@ | |||
1307 | 1457 | uint64_t new_number; | 1489 | uint64_t new_number; |
1308 | 1458 | uint64_t initial= 3; | 1490 | uint64_t initial= 3; |
1309 | 1459 | 1491 | ||
1316 | 1460 | test_compare(MEMCACHED_SUCCESS, | 1492 | if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL)) |
1317 | 1461 | memcached_decrement_with_initial_by_key(memc, | 1493 | { |
1318 | 1462 | test_literal_param("foo"), | 1494 | test_compare(MEMCACHED_SUCCESS, |
1319 | 1463 | test_literal_param("number"), | 1495 | memcached_decrement_with_initial_by_key(memc, |
1320 | 1464 | 1, initial, 0, &new_number)); | 1496 | test_literal_param("foo"), |
1321 | 1465 | test_compare(new_number, initial); | 1497 | test_literal_param("number"), |
1322 | 1498 | 1, initial, 0, &new_number)); | ||
1323 | 1499 | test_compare(new_number, initial); | ||
1324 | 1466 | 1500 | ||
1331 | 1467 | test_compare(MEMCACHED_SUCCESS, | 1501 | test_compare(MEMCACHED_SUCCESS, |
1332 | 1468 | memcached_decrement_with_initial_by_key(memc, | 1502 | memcached_decrement_with_initial_by_key(memc, |
1333 | 1469 | test_literal_param("foo"), | 1503 | test_literal_param("foo"), |
1334 | 1470 | test_literal_param("number"), | 1504 | test_literal_param("number"), |
1335 | 1471 | 1, initial, 0, &new_number)); | 1505 | 1, initial, 0, &new_number)); |
1336 | 1472 | test_compare(new_number, (initial - 1)); | 1506 | test_compare(new_number, (initial - 1)); |
1337 | 1507 | } | ||
1338 | 1508 | else | ||
1339 | 1509 | { | ||
1340 | 1510 | test_compare(MEMCACHED_INVALID_ARGUMENTS, | ||
1341 | 1511 | memcached_decrement_with_initial_by_key(memc, | ||
1342 | 1512 | test_literal_param("foo"), | ||
1343 | 1513 | test_literal_param("number"), | ||
1344 | 1514 | 1, initial, 0, &new_number)); | ||
1345 | 1515 | } | ||
1346 | 1473 | 1516 | ||
1347 | 1474 | return TEST_SUCCESS; | 1517 | return TEST_SUCCESS; |
1348 | 1475 | } | 1518 | } |
1349 | @@ -3040,7 +3083,7 @@ | |||
1350 | 3040 | const char *key= "mine"; | 3083 | const char *key= "mine"; |
1351 | 3041 | char *value; | 3084 | char *value; |
1352 | 3042 | 3085 | ||
1354 | 3043 | /* Make sure be default none exists */ | 3086 | /* Make sure by default none exists */ |
1355 | 3044 | value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); | 3087 | value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); |
1356 | 3045 | test_null(value); | 3088 | test_null(value); |
1357 | 3046 | test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); | 3089 | test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); |
1358 | @@ -3051,7 +3094,7 @@ | |||
1359 | 3051 | 3094 | ||
1360 | 3052 | value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); | 3095 | value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); |
1361 | 3053 | test_true(value); | 3096 | test_true(value); |
1363 | 3054 | test_memcmp(value, key, 4); | 3097 | test_memcmp(value, key, strlen(key)); |
1364 | 3055 | test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); | 3098 | test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); |
1365 | 3056 | 3099 | ||
1366 | 3057 | /* Test that we can turn it off */ | 3100 | /* Test that we can turn it off */ |
1367 | @@ -3069,7 +3112,7 @@ | |||
1368 | 3069 | value= (char *)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); | 3112 | value= (char *)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); |
1369 | 3070 | test_true(value); | 3113 | test_true(value); |
1370 | 3071 | test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); | 3114 | test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); |
1372 | 3072 | test_memcmp(value, key, 4); | 3115 | test_memcmp(value, key, strlen(key)); |
1373 | 3073 | 3116 | ||
1374 | 3074 | /* Set to Zero, and then Set to something too large */ | 3117 | /* Set to Zero, and then Set to something too large */ |
1375 | 3075 | { | 3118 | { |
1376 | @@ -3079,9 +3122,7 @@ | |||
1377 | 3079 | test_compare(MEMCACHED_SUCCESS, | 3122 | test_compare(MEMCACHED_SUCCESS, |
1378 | 3080 | memcached_callback_set(memc, MEMCACHED_CALLBACK_NAMESPACE, NULL)); | 3123 | memcached_callback_set(memc, MEMCACHED_CALLBACK_NAMESPACE, NULL)); |
1379 | 3081 | 3124 | ||
1383 | 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"); |
1381 | 3083 | test_null(value); | ||
1382 | 3084 | test_compare(MEMCACHED_SUCCESS, rc); | ||
1384 | 3085 | 3126 | ||
1385 | 3086 | /* Test a long key for failure */ | 3127 | /* Test a long key for failure */ |
1386 | 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 */ |
1387 | @@ -3109,11 +3150,10 @@ | |||
1388 | 3109 | { | 3150 | { |
1389 | 3110 | memcached_return_t rc; | 3151 | memcached_return_t rc; |
1390 | 3111 | const char *key= "mine"; | 3152 | const char *key= "mine"; |
1391 | 3112 | char *value; | ||
1392 | 3113 | 3153 | ||
1393 | 3114 | // Make sure we default to a null namespace | 3154 | // Make sure we default to a null namespace |
1396 | 3115 | value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); | 3155 | char* value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); |
1397 | 3116 | test_null(value); | 3156 | ASSERT_NULL_(value, "memc had a value for namespace when none should exist"); |
1398 | 3117 | test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); | 3157 | test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); |
1399 | 3118 | 3158 | ||
1400 | 3119 | /* Test a clean set */ | 3159 | /* Test a clean set */ |
1401 | @@ -3121,8 +3161,8 @@ | |||
1402 | 3121 | memcached_callback_set(memc, MEMCACHED_CALLBACK_NAMESPACE, (void *)key)); | 3161 | memcached_callback_set(memc, MEMCACHED_CALLBACK_NAMESPACE, (void *)key)); |
1403 | 3122 | 3162 | ||
1404 | 3123 | value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); | 3163 | value= (char*)memcached_callback_get(memc, MEMCACHED_CALLBACK_NAMESPACE, &rc); |
1407 | 3124 | test_true(value); | 3164 | ASSERT_TRUE(value); |
1408 | 3125 | test_memcmp(value, key, 4); | 3165 | test_memcmp(value, key, strlen(key)); |
1409 | 3126 | test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); | 3166 | test_compare_got(MEMCACHED_SUCCESS, rc, memcached_strerror(NULL, rc)); |
1410 | 3127 | 3167 | ||
1411 | 3128 | return TEST_SUCCESS; | 3168 | return TEST_SUCCESS; |
1412 | 3129 | 3169 | ||
1413 | === modified file 'tests/libmemcached-1.0/mem_functions.h' | |||
1414 | --- tests/libmemcached-1.0/mem_functions.h 2013-02-23 21:43:42 +0000 | |||
1415 | +++ tests/libmemcached-1.0/mem_functions.h 2013-10-11 12:20:38 +0000 | |||
1416 | @@ -67,6 +67,7 @@ | |||
1417 | 67 | test_return_t decrement_test(memcached_st *memc); | 67 | test_return_t decrement_test(memcached_st *memc); |
1418 | 68 | test_return_t decrement_with_initial_by_key_test(memcached_st *memc); | 68 | test_return_t decrement_with_initial_by_key_test(memcached_st *memc); |
1419 | 69 | test_return_t decrement_with_initial_test(memcached_st *memc); | 69 | test_return_t decrement_with_initial_test(memcached_st *memc); |
1420 | 70 | test_return_t decrement_with_initial_999_test(memcached_st *memc); | ||
1421 | 70 | test_return_t delete_test(memcached_st *memc); | 71 | test_return_t delete_test(memcached_st *memc); |
1422 | 71 | test_return_t deprecated_set_memory_alloc(memcached_st *memc); | 72 | test_return_t deprecated_set_memory_alloc(memcached_st *memc); |
1423 | 72 | test_return_t enable_cas(memcached_st *memc); | 73 | test_return_t enable_cas(memcached_st *memc); |
1424 | @@ -88,6 +89,7 @@ | |||
1425 | 88 | test_return_t increment_test(memcached_st *memc); | 89 | test_return_t increment_test(memcached_st *memc); |
1426 | 89 | test_return_t increment_with_initial_by_key_test(memcached_st *memc); | 90 | test_return_t increment_with_initial_by_key_test(memcached_st *memc); |
1427 | 90 | test_return_t increment_with_initial_test(memcached_st *memc); | 91 | test_return_t increment_with_initial_test(memcached_st *memc); |
1428 | 92 | test_return_t increment_with_initial_999_test(memcached_st *memc); | ||
1429 | 91 | test_return_t init_test(memcached_st *not_used); | 93 | test_return_t init_test(memcached_st *not_used); |
1430 | 92 | test_return_t jenkins_run (memcached_st *); | 94 | test_return_t jenkins_run (memcached_st *); |
1431 | 93 | test_return_t key_setup(memcached_st *memc); | 95 | test_return_t key_setup(memcached_st *memc); |
1432 | 94 | 96 | ||
1433 | === modified file 'tests/libmemcached-1.0/plus.cpp' | |||
1434 | --- tests/libmemcached-1.0/plus.cpp 2013-04-03 13:14:23 +0000 | |||
1435 | +++ tests/libmemcached-1.0/plus.cpp 2013-10-11 12:20:38 +0000 | |||
1436 | @@ -181,6 +181,13 @@ | |||
1437 | 181 | vector<char> return_value; | 181 | vector<char> return_value; |
1438 | 182 | 182 | ||
1439 | 183 | /* We need to empty the server before we continue the test */ | 183 | /* We need to empty the server before we continue the test */ |
1440 | 184 | bool flush_res= memc.flush(); | ||
1441 | 185 | if (flush_res == false) | ||
1442 | 186 | { | ||
1443 | 187 | std::string error_string; | ||
1444 | 188 | ASSERT_TRUE(memc.error(error_string)); | ||
1445 | 189 | Error << error_string; | ||
1446 | 190 | } | ||
1447 | 184 | test_true(memc.flush()); | 191 | test_true(memc.flush()); |
1448 | 185 | 192 | ||
1449 | 186 | test_true(memc.mget(keys)); | 193 | test_true(memc.mget(keys)); |
1450 | 187 | 194 | ||
1451 | === modified file 'tests/libmemcached_world.h' | |||
1452 | --- tests/libmemcached_world.h 2013-06-12 07:11:22 +0000 | |||
1453 | +++ tests/libmemcached_world.h 2013-10-11 12:20:38 +0000 | |||
1454 | @@ -87,12 +87,14 @@ | |||
1455 | 87 | static bool world_destroy(void *object) | 87 | static bool world_destroy(void *object) |
1456 | 88 | { | 88 | { |
1457 | 89 | libmemcached_test_container_st *container= (libmemcached_test_container_st *)object; | 89 | libmemcached_test_container_st *container= (libmemcached_test_container_st *)object; |
1458 | 90 | #if 0 | ||
1459 | 90 | #if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT | 91 | #if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT |
1460 | 91 | if (LIBMEMCACHED_WITH_SASL_SUPPORT) | 92 | if (LIBMEMCACHED_WITH_SASL_SUPPORT) |
1461 | 92 | { | 93 | { |
1462 | 93 | sasl_done(); | 94 | sasl_done(); |
1463 | 94 | } | 95 | } |
1464 | 95 | #endif | 96 | #endif |
1465 | 97 | #endif | ||
1466 | 96 | 98 | ||
1467 | 97 | delete container; | 99 | delete container; |
1468 | 98 | 100 | ||
1469 | 99 | 101 | ||
1470 | === modified file 'tests/libmemcached_world_socket.h' | |||
1471 | --- tests/libmemcached_world_socket.h 2013-01-24 11:17:17 +0000 | |||
1472 | +++ tests/libmemcached_world_socket.h 2013-10-11 12:20:38 +0000 | |||
1473 | @@ -75,12 +75,15 @@ | |||
1474 | 75 | static bool world_destroy(void *object) | 75 | static bool world_destroy(void *object) |
1475 | 76 | { | 76 | { |
1476 | 77 | libmemcached_test_container_st *container= (libmemcached_test_container_st *)object; | 77 | libmemcached_test_container_st *container= (libmemcached_test_container_st *)object; |
1477 | 78 | |||
1478 | 79 | #if 0 | ||
1479 | 78 | #if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT | 80 | #if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT |
1480 | 79 | if (LIBMEMCACHED_WITH_SASL_SUPPORT) | 81 | if (LIBMEMCACHED_WITH_SASL_SUPPORT) |
1481 | 80 | { | 82 | { |
1482 | 81 | sasl_done(); | 83 | sasl_done(); |
1483 | 82 | } | 84 | } |
1484 | 83 | #endif | 85 | #endif |
1485 | 86 | #endif | ||
1486 | 84 | 87 | ||
1487 | 85 | delete container; | 88 | delete container; |
1488 | 86 | 89 | ||
1489 | 87 | 90 | ||
1490 | === modified file 'tests/memcat.cc' | |||
1491 | --- tests/memcat.cc 2013-01-28 22:51:05 +0000 | |||
1492 | +++ tests/memcat.cc 2013-10-11 12:20:38 +0000 | |||
1493 | @@ -64,10 +64,10 @@ | |||
1494 | 64 | static test_return_t cat_test(void *) | 64 | static test_return_t cat_test(void *) |
1495 | 65 | { | 65 | { |
1496 | 66 | char buffer[1024]; | 66 | char buffer[1024]; |
1498 | 67 | snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); | 67 | int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); |
1499 | 68 | const char *args[]= { buffer, "foo", 0 }; | 68 | const char *args[]= { buffer, "foo", 0 }; |
1500 | 69 | 69 | ||
1502 | 70 | memcached_st *memc= memcached(buffer, strlen(buffer)); | 70 | memcached_st *memc= memcached(buffer, length); |
1503 | 71 | test_true(memc); | 71 | test_true(memc); |
1504 | 72 | 72 | ||
1505 | 73 | test_compare(MEMCACHED_SUCCESS, | 73 | test_compare(MEMCACHED_SUCCESS, |
1506 | @@ -77,6 +77,7 @@ | |||
1507 | 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)); |
1508 | 78 | test_compare(MEMCACHED_SUCCESS, rc); | 78 | test_compare(MEMCACHED_SUCCESS, rc); |
1509 | 79 | 79 | ||
1510 | 80 | snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port())); | ||
1511 | 80 | test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true)); | 81 | test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true)); |
1512 | 81 | 82 | ||
1513 | 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)); |
1514 | @@ -90,11 +91,11 @@ | |||
1515 | 90 | static test_return_t NOT_FOUND_test(void *) | 91 | static test_return_t NOT_FOUND_test(void *) |
1516 | 91 | { | 92 | { |
1517 | 92 | char buffer[1024]; | 93 | char buffer[1024]; |
1519 | 93 | snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); | 94 | int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); |
1520 | 94 | const char *args[]= { buffer, "foo", 0 }; | 95 | const char *args[]= { buffer, "foo", 0 }; |
1521 | 95 | 96 | ||
1524 | 96 | memcached_st *memc= memcached(buffer, strlen(buffer)); | 97 | memcached_st *memc= memcached(buffer, length); |
1525 | 97 | test_true(memc); | 98 | ASSERT_TRUE(memc); |
1526 | 98 | 99 | ||
1527 | 99 | test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0)); | 100 | test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0)); |
1528 | 100 | 101 | ||
1529 | @@ -102,6 +103,7 @@ | |||
1530 | 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)); |
1531 | 103 | test_compare(MEMCACHED_NOTFOUND, rc); | 104 | test_compare(MEMCACHED_NOTFOUND, rc); |
1532 | 104 | 105 | ||
1533 | 106 | snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port())); | ||
1534 | 105 | test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true)); | 107 | test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true)); |
1535 | 106 | 108 | ||
1536 | 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)); |
1537 | 108 | 110 | ||
1538 | === modified file 'tests/memcp.cc' | |||
1539 | --- tests/memcp.cc 2013-06-12 07:11:22 +0000 | |||
1540 | +++ tests/memcp.cc 2013-10-11 12:20:38 +0000 | |||
1541 | @@ -63,6 +63,7 @@ | |||
1542 | 63 | return TEST_SUCCESS; | 63 | return TEST_SUCCESS; |
1543 | 64 | } | 64 | } |
1544 | 65 | 65 | ||
1545 | 66 | #if 0 | ||
1546 | 66 | static test_return_t server_test(void *) | 67 | static test_return_t server_test(void *) |
1547 | 67 | { | 68 | { |
1548 | 68 | int fd; | 69 | int fd; |
1549 | @@ -82,10 +83,13 @@ | |||
1550 | 82 | 83 | ||
1551 | 83 | return TEST_SUCCESS; | 84 | return TEST_SUCCESS; |
1552 | 84 | } | 85 | } |
1553 | 86 | #endif | ||
1554 | 85 | 87 | ||
1555 | 86 | test_st memcp_tests[] ={ | 88 | test_st memcp_tests[] ={ |
1556 | 87 | {"--help", true, help_test }, | 89 | {"--help", true, help_test }, |
1557 | 90 | #if 0 | ||
1558 | 88 | {"--server_test", true, server_test }, | 91 | {"--server_test", true, server_test }, |
1559 | 92 | #endif | ||
1560 | 89 | {0, 0, 0} | 93 | {0, 0, 0} |
1561 | 90 | }; | 94 | }; |
1562 | 91 | 95 | ||
1563 | 92 | 96 | ||
1564 | === modified file 'tests/memdump.cc' | |||
1565 | --- tests/memdump.cc 2013-01-28 22:51:05 +0000 | |||
1566 | +++ tests/memdump.cc 2013-10-11 12:20:38 +0000 | |||
1567 | @@ -75,10 +75,10 @@ | |||
1568 | 75 | static test_return_t FOUND_test(void *) | 75 | static test_return_t FOUND_test(void *) |
1569 | 76 | { | 76 | { |
1570 | 77 | char buffer[1024]; | 77 | char buffer[1024]; |
1572 | 78 | snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); | 78 | int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); |
1573 | 79 | const char *args[]= { buffer, 0 }; | 79 | const char *args[]= { buffer, 0 }; |
1574 | 80 | 80 | ||
1576 | 81 | memcached_st *memc= memcached(buffer, strlen(buffer)); | 81 | memcached_st *memc= memcached(buffer, length); |
1577 | 82 | test_true(memc); | 82 | test_true(memc); |
1578 | 83 | 83 | ||
1579 | 84 | test_compare(MEMCACHED_SUCCESS, | 84 | test_compare(MEMCACHED_SUCCESS, |
1580 | @@ -91,6 +91,7 @@ | |||
1581 | 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)); |
1582 | 92 | test_compare(MEMCACHED_SUCCESS, rc); | 92 | test_compare(MEMCACHED_SUCCESS, rc); |
1583 | 93 | 93 | ||
1584 | 94 | length= snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port())); | ||
1585 | 94 | test_true(exec_cmdline(executable, args, true) <= EXIT_FAILURE); | 95 | test_true(exec_cmdline(executable, args, true) <= EXIT_FAILURE); |
1586 | 95 | 96 | ||
1587 | 96 | memcached_free(memc); | 97 | memcached_free(memc); |
1588 | @@ -110,19 +111,11 @@ | |||
1589 | 110 | {0, 0, 0, 0} | 111 | {0, 0, 0, 0} |
1590 | 111 | }; | 112 | }; |
1591 | 112 | 113 | ||
1593 | 113 | static void *world_create(server_startup_st& servers, test_return_t& error) | 114 | static void *world_create(server_startup_st& servers, test_return_t&) |
1594 | 114 | { | 115 | { |
1600 | 115 | if (libtest::has_memcached() == false) | 116 | SKIP_UNLESS(libtest::has_memcached()); |
1596 | 116 | { | ||
1597 | 117 | error= TEST_SKIPPED; | ||
1598 | 118 | return NULL; | ||
1599 | 119 | } | ||
1601 | 120 | 117 | ||
1607 | 121 | if (server_startup(servers, "memcached", libtest::default_port(), NULL) == false) | 118 | ASSERT_TRUE(server_startup(servers, "memcached", libtest::default_port(), NULL)); |
1603 | 122 | { | ||
1604 | 123 | error= TEST_FAILURE; | ||
1605 | 124 | return NULL; | ||
1606 | 125 | } | ||
1608 | 126 | 119 | ||
1609 | 127 | return &servers; | 120 | return &servers; |
1610 | 128 | } | 121 | } |
1611 | 129 | 122 | ||
1612 | === modified file 'tests/memexist.cc' | |||
1613 | --- tests/memexist.cc 2013-01-28 22:51:05 +0000 | |||
1614 | +++ tests/memexist.cc 2013-10-11 12:20:38 +0000 | |||
1615 | @@ -64,10 +64,10 @@ | |||
1616 | 64 | static test_return_t exist_test(void *) | 64 | static test_return_t exist_test(void *) |
1617 | 65 | { | 65 | { |
1618 | 66 | char buffer[1024]; | 66 | char buffer[1024]; |
1620 | 67 | snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); | 67 | int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); |
1621 | 68 | const char *args[]= { buffer, "foo", 0 }; | 68 | const char *args[]= { buffer, "foo", 0 }; |
1622 | 69 | 69 | ||
1624 | 70 | memcached_st *memc= memcached(buffer, strlen(buffer)); | 70 | memcached_st *memc= memcached(buffer, length); |
1625 | 71 | test_true(memc); | 71 | test_true(memc); |
1626 | 72 | 72 | ||
1627 | 73 | test_compare(MEMCACHED_SUCCESS, | 73 | test_compare(MEMCACHED_SUCCESS, |
1628 | @@ -90,11 +90,11 @@ | |||
1629 | 90 | static test_return_t NOT_FOUND_test(void *) | 90 | static test_return_t NOT_FOUND_test(void *) |
1630 | 91 | { | 91 | { |
1631 | 92 | char buffer[1024]; | 92 | char buffer[1024]; |
1633 | 93 | snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); | 93 | int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); |
1634 | 94 | const char *args[]= { buffer, "foo", 0 }; | 94 | const char *args[]= { buffer, "foo", 0 }; |
1635 | 95 | 95 | ||
1638 | 96 | memcached_st *memc= memcached(buffer, strlen(buffer)); | 96 | memcached_st *memc= memcached(buffer, length); |
1639 | 97 | test_true(memc); | 97 | ASSERT_TRUE(memc); |
1640 | 98 | 98 | ||
1641 | 99 | test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0)); | 99 | test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0)); |
1642 | 100 | 100 | ||
1643 | @@ -115,9 +115,9 @@ | |||
1644 | 115 | static test_return_t check_version(void*) | 115 | static test_return_t check_version(void*) |
1645 | 116 | { | 116 | { |
1646 | 117 | char buffer[1024]; | 117 | char buffer[1024]; |
1650 | 118 | snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); | 118 | int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); |
1651 | 119 | memcached_st *memc= memcached(buffer, strlen(buffer)); | 119 | memcached_st *memc= memcached(buffer, length); |
1652 | 120 | test_true(memc); | 120 | ASSERT_TRUE(memc); |
1653 | 121 | 121 | ||
1654 | 122 | test_return_t result= TEST_SUCCESS; | 122 | test_return_t result= TEST_SUCCESS; |
1655 | 123 | if (libmemcached_util_version_check(memc, 1, 4, 8) == false) | 123 | if (libmemcached_util_version_check(memc, 1, 4, 8) == false) |
1656 | 124 | 124 | ||
1657 | === modified file 'tests/memping.cc' | |||
1658 | --- tests/memping.cc 2013-04-03 13:14:23 +0000 | |||
1659 | +++ tests/memping.cc 2013-10-11 12:20:38 +0000 | |||
1660 | @@ -64,7 +64,7 @@ | |||
1661 | 64 | static test_return_t ping_TEST(void *) | 64 | static test_return_t ping_TEST(void *) |
1662 | 65 | { | 65 | { |
1663 | 66 | char buffer[1024]; | 66 | char buffer[1024]; |
1665 | 67 | snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); | 67 | snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port())); |
1666 | 68 | const char *args[]= { buffer, 0 }; | 68 | const char *args[]= { buffer, 0 }; |
1667 | 69 | 69 | ||
1668 | 70 | test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true)); | 70 | test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true)); |
1669 | @@ -75,7 +75,7 @@ | |||
1670 | 75 | static test_return_t NOT_FOUND_TEST(void *) | 75 | static test_return_t NOT_FOUND_TEST(void *) |
1671 | 76 | { | 76 | { |
1672 | 77 | char buffer[1024]; | 77 | char buffer[1024]; |
1674 | 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())); |
1675 | 79 | const char *args[]= { buffer, 0 }; | 79 | const char *args[]= { buffer, 0 }; |
1676 | 80 | 80 | ||
1677 | 81 | test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true)); | 81 | test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true)); |
1678 | 82 | 82 | ||
1679 | === modified file 'tests/memrm.cc' | |||
1680 | --- tests/memrm.cc 2013-01-28 22:51:05 +0000 | |||
1681 | +++ tests/memrm.cc 2013-10-11 12:20:38 +0000 | |||
1682 | @@ -84,6 +84,8 @@ | |||
1683 | 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)); |
1684 | 85 | test_compare(MEMCACHED_SUCCESS, rc); | 85 | test_compare(MEMCACHED_SUCCESS, rc); |
1685 | 86 | 86 | ||
1686 | 87 | char memrm_buffer[1024]; | ||
1687 | 88 | snprintf(memrm_buffer, sizeof(memrm_buffer), "--servers=localhost:%d", int(default_port())); | ||
1688 | 87 | const char *args[]= { buffer, "foo", 0 }; | 89 | const char *args[]= { buffer, "foo", 0 }; |
1689 | 88 | test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true)); | 90 | test_compare(EXIT_SUCCESS, exec_cmdline(executable, args, true)); |
1690 | 89 | 91 | ||
1691 | @@ -121,7 +123,7 @@ | |||
1692 | 121 | static test_return_t multiple_NOT_FOUND_TEST(void *) | 123 | static test_return_t multiple_NOT_FOUND_TEST(void *) |
1693 | 122 | { | 124 | { |
1694 | 123 | char buffer[1024]; | 125 | char buffer[1024]; |
1696 | 124 | snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); | 126 | snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port())); |
1697 | 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", |
1698 | 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 }; |
1699 | 127 | 129 | ||
1700 | 128 | 130 | ||
1701 | === modified file 'tests/memtouch.cc' | |||
1702 | --- tests/memtouch.cc 2013-01-28 22:51:05 +0000 | |||
1703 | +++ tests/memtouch.cc 2013-10-11 12:20:38 +0000 | |||
1704 | @@ -65,9 +65,9 @@ | |||
1705 | 65 | static test_return_t touch_test(void *) | 65 | static test_return_t touch_test(void *) |
1706 | 66 | { | 66 | { |
1707 | 67 | char buffer[1024]; | 67 | char buffer[1024]; |
1709 | 68 | snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); | 68 | int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); |
1710 | 69 | 69 | ||
1712 | 70 | memcached_st *memc= memcached(buffer, strlen(buffer)); | 70 | memcached_st *memc= memcached(buffer, length); |
1713 | 71 | test_true(memc); | 71 | test_true(memc); |
1714 | 72 | 72 | ||
1715 | 73 | test_compare(MEMCACHED_SUCCESS, | 73 | test_compare(MEMCACHED_SUCCESS, |
1716 | @@ -89,15 +89,15 @@ | |||
1717 | 89 | static test_return_t NOT_FOUND_test(void *) | 89 | static test_return_t NOT_FOUND_test(void *) |
1718 | 90 | { | 90 | { |
1719 | 91 | char buffer[1024]; | 91 | char buffer[1024]; |
1722 | 92 | snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); | 92 | int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); |
1723 | 93 | memcached_st *memc= memcached(buffer, strlen(buffer)); | 93 | memcached_st *memc= memcached(buffer, length); |
1724 | 94 | test_true(memc); | 94 | test_true(memc); |
1725 | 95 | 95 | ||
1726 | 96 | test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0)); | 96 | test_compare(MEMCACHED_SUCCESS, memcached_flush(memc, 0)); |
1727 | 97 | 97 | ||
1728 | 98 | test_compare(MEMCACHED_NOTFOUND, memcached_exist(memc, test_literal_param("foo"))); | 98 | test_compare(MEMCACHED_NOTFOUND, memcached_exist(memc, test_literal_param("foo"))); |
1729 | 99 | 99 | ||
1731 | 100 | snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port())); | 100 | length= snprintf(buffer, sizeof(buffer), "--servers=localhost:%d", int(default_port())); |
1732 | 101 | const char *args[]= { "--expire=30", buffer, "foo", 0 }; | 101 | const char *args[]= { "--expire=30", buffer, "foo", 0 }; |
1733 | 102 | test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true)); | 102 | test_compare(EXIT_FAILURE, exec_cmdline(executable, args, true)); |
1734 | 103 | 103 | ||
1735 | @@ -111,8 +111,8 @@ | |||
1736 | 111 | static test_return_t check_version(void*) | 111 | static test_return_t check_version(void*) |
1737 | 112 | { | 112 | { |
1738 | 113 | char buffer[1024]; | 113 | char buffer[1024]; |
1741 | 114 | snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); | 114 | int length= snprintf(buffer, sizeof(buffer), "--server=localhost:%d", int(default_port())); |
1742 | 115 | memcached_st *memc= memcached(buffer, strlen(buffer)); | 115 | memcached_st *memc= memcached(buffer, length); |
1743 | 116 | test_true(memc); | 116 | test_true(memc); |
1744 | 117 | 117 | ||
1745 | 118 | test_return_t result= TEST_SUCCESS; | 118 | test_return_t result= TEST_SUCCESS; |