632
by Brian Aker
Update for test system. |
1 |
/* libMemcached Functions Test
|
2 |
* Copyright (C) 2006-2009 Brian Aker
|
|
3 |
* All rights reserved.
|
|
4 |
*
|
|
5 |
* Use and distribution licensed under the BSD license. See
|
|
6 |
* the COPYING file in the parent directory for full text.
|
|
7 |
*/
|
|
8 |
||
143
by Brian Aker
Refactored out actual test code from test.c |
9 |
/*
|
10 |
Sample test application.
|
|
11 |
*/
|
|
547.2.1
by Monty Taylor
Rearranged some things and added the visibility.m4 macros. Started to lay the |
12 |
|
863
by Brian Aker
Additional cleanup for config.h |
13 |
#include "config.h" |
510
by Monty Taylor
Turned on more warnings, and fixed the errors. Moved common.h, which includes |
14 |
|
143
by Brian Aker
Refactored out actual test code from test.c |
15 |
#include <assert.h> |
16 |
#include <stdio.h> |
|
863
by Brian Aker
Additional cleanup for config.h |
17 |
#include <stdint.h> |
143
by Brian Aker
Refactored out actual test code from test.c |
18 |
#include <stdlib.h> |
19 |
#include <string.h> |
|
20 |
#include <sys/time.h> |
|
21 |
#include <sys/types.h> |
|
22 |
#include <sys/stat.h> |
|
580.2.1
by Adam Thomason
Add a test for large multiget hang |
23 |
#include <signal.h> |
143
by Brian Aker
Refactored out actual test code from test.c |
24 |
#include <unistd.h> |
25 |
#include <time.h> |
|
863
by Brian Aker
Additional cleanup for config.h |
26 |
|
27 |
#include "libmemcached/common.h" |
|
28 |
||
923
by Brian Aker
Move testing framework out to its own library. |
29 |
#include <libtest/server.h> |
30 |
||
510
by Monty Taylor
Turned on more warnings, and fixed the errors. Moved common.h, which includes |
31 |
#include "clients/generator.h" |
32 |
#include "clients/execute.h" |
|
143
by Brian Aker
Refactored out actual test code from test.c |
33 |
|
863
by Brian Aker
Additional cleanup for config.h |
34 |
#define SMALL_STRING_LEN 1024
|
236
by Brian Aker
Portability patches from Kevin Dalley for Freebsd 4.0. |
35 |
|
923
by Brian Aker
Move testing framework out to its own library. |
36 |
#include <libtest/test.h> |
143
by Brian Aker
Refactored out actual test code from test.c |
37 |
|
863
by Brian Aker
Additional cleanup for config.h |
38 |
|
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
39 |
#ifdef HAVE_LIBMEMCACHEDUTIL
|
40 |
#include <pthread.h> |
|
41 |
#include "libmemcached/memcached_util.h" |
|
42 |
#endif
|
|
43 |
||
632
by Brian Aker
Update for test system. |
44 |
#include "hash_results.h" |
45 |
||
351
by brian@localhost.localdomain
Pushing weighted ketama code. |
46 |
#define GLOBAL_COUNT 10000
|
47 |
#define GLOBAL2_COUNT 100
|
|
48 |
#define SERVERS_TO_CREATE 5
|
|
281
by Brian Aker
Refactor of generate tests. |
49 |
static uint32_t global_count; |
50 |
||
145.1.2
by brian@gir.tangent.org
More tests. |
51 |
static pairs_st *global_pairs; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
52 |
static const char *global_keys[GLOBAL_COUNT]; |
145.1.2
by brian@gir.tangent.org
More tests. |
53 |
static size_t global_keys_length[GLOBAL_COUNT]; |
54 |
||
834
by Brian Aker
Small updates/wins around non-block IO |
55 |
// Prototype
|
56 |
static test_return_t pre_binary(memcached_st *memc); |
|
57 |
||
58 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
59 |
static test_return_t init_test(memcached_st *not_used) |
143
by Brian Aker
Refactored out actual test code from test.c |
60 |
{
|
61 |
memcached_st memc; |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
62 |
(void)not_used; |
143
by Brian Aker
Refactored out actual test code from test.c |
63 |
|
64 |
(void)memcached_create(&memc); |
|
65 |
memcached_free(&memc); |
|
147
by Brian Aker
Updating test cases to return true/false |
66 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
67 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
68 |
}
|
69 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
70 |
static test_return_t server_list_null_test(memcached_st *ptr) |
239
by Brian Aker
Fixed error in lack of pointer found (Tim Bunce discovered) |
71 |
{
|
72 |
memcached_server_st *server_list; |
|
630
by Brian Aker
Style cleanup |
73 |
memcached_return_t rc; |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
74 |
(void)ptr; |
239
by Brian Aker
Fixed error in lack of pointer found (Tim Bunce discovered) |
75 |
|
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
76 |
server_list= memcached_server_list_append_with_weight(NULL, NULL, 0, 0, NULL); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
77 |
test_true(server_list == NULL); |
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
78 |
|
79 |
server_list= memcached_server_list_append_with_weight(NULL, "localhost", 0, 0, NULL); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
80 |
test_true(server_list == NULL); |
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
81 |
|
82 |
server_list= memcached_server_list_append_with_weight(NULL, NULL, 0, 0, &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
83 |
test_true(server_list == NULL); |
239
by Brian Aker
Fixed error in lack of pointer found (Tim Bunce discovered) |
84 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
85 |
return TEST_SUCCESS; |
239
by Brian Aker
Fixed error in lack of pointer found (Tim Bunce discovered) |
86 |
}
|
87 |
||
317.1.28
by brian@gir-2.local
Extended server_sort_test() test. |
88 |
#define TEST_PORT_COUNT 7
|
691.2.2
by Stewart Smith
be strict about port numbers being in in_port_t not uint32_t |
89 |
in_port_t test_ports[TEST_PORT_COUNT]; |
317.1.28
by brian@gir-2.local
Extended server_sort_test() test. |
90 |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
91 |
static memcached_return_t server_display_function(const memcached_st *ptr, |
792
by Brian Aker
Lots of compiler fixes. |
92 |
const memcached_server_st *server, |
93 |
void *context) |
|
317.1.28
by brian@gir-2.local
Extended server_sort_test() test. |
94 |
{
|
95 |
/* Do Nothing */
|
|
718
by Brian Aker
32/64 bit cleanup issue in tests. |
96 |
size_t bigger= *((size_t *)(context)); |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
97 |
(void)ptr; |
792
by Brian Aker
Lots of compiler fixes. |
98 |
assert(bigger <= memcached_server_port(server)); |
99 |
*((size_t *)(context))= memcached_server_port(server); |
|
317.1.28
by brian@gir-2.local
Extended server_sort_test() test. |
100 |
|
101 |
return MEMCACHED_SUCCESS; |
|
102 |
}
|
|
103 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
104 |
static memcached_return_t dump_server_information(const memcached_st *ptr, |
903.1.3
by Brian Aker
Fix/debug for FreeBSD failures. |
105 |
const memcached_server_st *instance, |
106 |
void *context) |
|
107 |
{
|
|
108 |
/* Do Nothing */
|
|
109 |
FILE *stream= (FILE *)context; |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
110 |
(void)ptr; |
903.1.3
by Brian Aker
Fix/debug for FreeBSD failures. |
111 |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
112 |
fprintf(stream, "Memcached Server: %s %u Version %u.%u.%u\n", |
903.1.3
by Brian Aker
Fix/debug for FreeBSD failures. |
113 |
memcached_server_name(instance), |
114 |
memcached_server_port(instance), |
|
115 |
instance->major_version, |
|
116 |
instance->minor_version, |
|
117 |
instance->micro_version); |
|
118 |
||
119 |
return MEMCACHED_SUCCESS; |
|
120 |
}
|
|
121 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
122 |
static test_return_t server_sort_test(memcached_st *ptr) |
302
by brian@gir-2.local
We now sort servers to make sure the client applications will always have the |
123 |
{
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
124 |
size_t bigger= 0; /* Prime the value for the test_true in server_display_function */ |
718
by Brian Aker
32/64 bit cleanup issue in tests. |
125 |
|
630
by Brian Aker
Style cleanup |
126 |
memcached_return_t rc; |
127 |
memcached_server_fn callbacks[1]; |
|
317.1.28
by brian@gir-2.local
Extended server_sort_test() test. |
128 |
memcached_st *local_memc; |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
129 |
(void)ptr; |
317.1.28
by brian@gir-2.local
Extended server_sort_test() test. |
130 |
|
131 |
local_memc= memcached_create(NULL); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
132 |
test_true(local_memc); |
317.1.28
by brian@gir-2.local
Extended server_sort_test() test. |
133 |
memcached_behavior_set(local_memc, MEMCACHED_BEHAVIOR_SORT_HOSTS, 1); |
134 |
||
718
by Brian Aker
32/64 bit cleanup issue in tests. |
135 |
for (size_t x= 0; x < TEST_PORT_COUNT; x++) |
317.1.28
by brian@gir-2.local
Extended server_sort_test() test. |
136 |
{
|
691.2.2
by Stewart Smith
be strict about port numbers being in in_port_t not uint32_t |
137 |
test_ports[x]= (in_port_t)random() % 64000; |
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
138 |
rc= memcached_server_add_with_weight(local_memc, "localhost", test_ports[x], 0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
139 |
test_true(memcached_server_count(local_memc) == x + 1); |
796
by Brian Aker
A number of fixes/etc. |
140 |
#if 0 // Rewrite |
792
by Brian Aker
Lots of compiler fixes. |
141 |
test_true(memcached_server_list_count(memcached_server_list(local_memc)) == x+1);
|
796
by Brian Aker
A number of fixes/etc. |
142 |
#endif
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
143 |
test_true(rc == MEMCACHED_SUCCESS); |
317.1.28
by brian@gir-2.local
Extended server_sort_test() test. |
144 |
}
|
145 |
||
146 |
callbacks[0]= server_display_function; |
|
147 |
memcached_server_cursor(local_memc, callbacks, (void *)&bigger, 1); |
|
148 |
||
149 |
||
150 |
memcached_free(local_memc); |
|
302
by brian@gir-2.local
We now sort servers to make sure the client applications will always have the |
151 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
152 |
return TEST_SUCCESS; |
302
by brian@gir-2.local
We now sort servers to make sure the client applications will always have the |
153 |
}
|
154 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
155 |
static test_return_t server_sort2_test(memcached_st *ptr) |
343
by brian@gir-3.local
More tests for Key prefix |
156 |
{
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
157 |
size_t bigger= 0; /* Prime the value for the test_true in server_display_function */ |
630
by Brian Aker
Style cleanup |
158 |
memcached_return_t rc; |
159 |
memcached_server_fn callbacks[1]; |
|
343
by brian@gir-3.local
More tests for Key prefix |
160 |
memcached_st *local_memc; |
794
by Brian Aker
Updating memcached_server_instance_st structure. |
161 |
memcached_server_instance_st instance; |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
162 |
(void)ptr; |
343
by brian@gir-3.local
More tests for Key prefix |
163 |
|
164 |
local_memc= memcached_create(NULL); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
165 |
test_true(local_memc); |
343
by brian@gir-3.local
More tests for Key prefix |
166 |
rc= memcached_behavior_set(local_memc, MEMCACHED_BEHAVIOR_SORT_HOSTS, 1); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
167 |
test_true(rc == MEMCACHED_SUCCESS); |
343
by brian@gir-3.local
More tests for Key prefix |
168 |
|
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
169 |
rc= memcached_server_add_with_weight(local_memc, "MEMCACHED_BEHAVIOR_SORT_HOSTS", 43043, 0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
170 |
test_true(rc == MEMCACHED_SUCCESS); |
792
by Brian Aker
Lots of compiler fixes. |
171 |
instance= memcached_server_instance_by_position(local_memc, 0); |
172 |
test_true(memcached_server_port(instance) == 43043); |
|
343
by brian@gir-3.local
More tests for Key prefix |
173 |
|
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
174 |
rc= memcached_server_add_with_weight(local_memc, "MEMCACHED_BEHAVIOR_SORT_HOSTS", 43042, 0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
175 |
test_true(rc == MEMCACHED_SUCCESS); |
710
by Brian Aker
Fix test cases for encapsulation. |
176 |
|
792
by Brian Aker
Lots of compiler fixes. |
177 |
instance= memcached_server_instance_by_position(local_memc, 0); |
178 |
test_true(memcached_server_port(instance) == 43042); |
|
710
by Brian Aker
Fix test cases for encapsulation. |
179 |
|
792
by Brian Aker
Lots of compiler fixes. |
180 |
instance= memcached_server_instance_by_position(local_memc, 1); |
181 |
test_true(memcached_server_port(instance) == 43043); |
|
343
by brian@gir-3.local
More tests for Key prefix |
182 |
|
183 |
callbacks[0]= server_display_function; |
|
184 |
memcached_server_cursor(local_memc, callbacks, (void *)&bigger, 1); |
|
185 |
||
186 |
||
187 |
memcached_free(local_memc); |
|
188 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
189 |
return TEST_SUCCESS; |
343
by brian@gir-3.local
More tests for Key prefix |
190 |
}
|
191 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
192 |
static memcached_return_t server_print_callback(const memcached_st *ptr, |
792
by Brian Aker
Lots of compiler fixes. |
193 |
const memcached_server_st *server, |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
194 |
void *context) |
792
by Brian Aker
Lots of compiler fixes. |
195 |
{
|
196 |
(void)server; // Just in case we aren't printing. |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
197 |
(void)ptr; |
198 |
(void)context; |
|
792
by Brian Aker
Lots of compiler fixes. |
199 |
|
200 |
#if 0
|
|
201 |
fprintf(stderr, "%s(%d)", memcached_server_name(server), memcached_server_port(server));
|
|
202 |
#endif
|
|
203 |
||
204 |
return MEMCACHED_SUCCESS; |
|
205 |
}
|
|
206 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
207 |
static test_return_t memcached_server_remove_test(memcached_st *ptr) |
792
by Brian Aker
Lots of compiler fixes. |
208 |
{
|
209 |
memcached_return_t rc; |
|
210 |
memcached_st local_memc; |
|
211 |
memcached_st *memc; |
|
212 |
memcached_server_st *servers; |
|
213 |
memcached_server_fn callbacks[1]; |
|
214 |
||
215 |
const char *server_string= "localhost:4444, localhost:4445, localhost:4446, localhost:4447, localhost, memcache1.memcache.bk.sapo.pt:11211, memcache1.memcache.bk.sapo.pt:11212, memcache1.memcache.bk.sapo.pt:11213, memcache1.memcache.bk.sapo.pt:11214, memcache2.memcache.bk.sapo.pt:11211, memcache2.memcache.bk.sapo.pt:11212, memcache2.memcache.bk.sapo.pt:11213, memcache2.memcache.bk.sapo.pt:11214"; |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
216 |
(void)ptr; |
792
by Brian Aker
Lots of compiler fixes. |
217 |
|
218 |
memc= memcached_create(&local_memc); |
|
219 |
||
220 |
servers= memcached_servers_parse(server_string); |
|
221 |
||
222 |
rc= memcached_server_push(memc, servers); |
|
804
by Brian Aker
A couple of valgrind warnings fixes. |
223 |
memcached_server_list_free(servers); |
792
by Brian Aker
Lots of compiler fixes. |
224 |
|
225 |
callbacks[0]= server_print_callback; |
|
226 |
memcached_server_cursor(memc, callbacks, NULL, 1); |
|
227 |
||
228 |
memcached_free(memc); |
|
229 |
||
230 |
return TEST_SUCCESS; |
|
231 |
}
|
|
232 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
233 |
static memcached_return_t server_display_unsort_function(const memcached_st *ptr, |
792
by Brian Aker
Lots of compiler fixes. |
234 |
const memcached_server_st *server, |
235 |
void *context) |
|
317.1.43
by brian@gir.tangent.org
Fix for always sort. |
236 |
{
|
237 |
/* Do Nothing */
|
|
238 |
uint32_t x= *((uint32_t *)(context)); |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
239 |
(void)ptr; |
317.1.43
by brian@gir.tangent.org
Fix for always sort. |
240 |
|
241 |
assert(test_ports[x] == server->port); |
|
242 |
*((uint32_t *)(context))= ++x; |
|
243 |
||
244 |
return MEMCACHED_SUCCESS; |
|
245 |
}
|
|
246 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
247 |
static test_return_t server_unsort_test(memcached_st *ptr) |
317.1.43
by brian@gir.tangent.org
Fix for always sort. |
248 |
{
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
249 |
size_t counter= 0; /* Prime the value for the test_true in server_display_function */ |
250 |
size_t bigger= 0; /* Prime the value for the test_true in server_display_function */ |
|
630
by Brian Aker
Style cleanup |
251 |
memcached_return_t rc; |
252 |
memcached_server_fn callbacks[1]; |
|
317.1.43
by brian@gir.tangent.org
Fix for always sort. |
253 |
memcached_st *local_memc; |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
254 |
(void)ptr; |
317.1.43
by brian@gir.tangent.org
Fix for always sort. |
255 |
|
256 |
local_memc= memcached_create(NULL); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
257 |
test_true(local_memc); |
317.1.43
by brian@gir.tangent.org
Fix for always sort. |
258 |
|
718
by Brian Aker
32/64 bit cleanup issue in tests. |
259 |
for (size_t x= 0; x < TEST_PORT_COUNT; x++) |
317.1.43
by brian@gir.tangent.org
Fix for always sort. |
260 |
{
|
691.2.2
by Stewart Smith
be strict about port numbers being in in_port_t not uint32_t |
261 |
test_ports[x]= (in_port_t)(random() % 64000); |
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
262 |
rc= memcached_server_add_with_weight(local_memc, "localhost", test_ports[x], 0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
263 |
test_true(memcached_server_count(local_memc) == x+1); |
796
by Brian Aker
A number of fixes/etc. |
264 |
#if 0 // Rewrite |
792
by Brian Aker
Lots of compiler fixes. |
265 |
test_true(memcached_server_list_count(memcached_server_list(local_memc)) == x+1);
|
796
by Brian Aker
A number of fixes/etc. |
266 |
#endif
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
267 |
test_true(rc == MEMCACHED_SUCCESS); |
317.1.43
by brian@gir.tangent.org
Fix for always sort. |
268 |
}
|
269 |
||
270 |
callbacks[0]= server_display_unsort_function; |
|
271 |
memcached_server_cursor(local_memc, callbacks, (void *)&counter, 1); |
|
272 |
||
317.1.45
by brian@gir.tangent.org
If you call sort, a quit occurs, and the current servers get sorted. |
273 |
/* Now we sort old data! */
|
274 |
memcached_behavior_set(local_memc, MEMCACHED_BEHAVIOR_SORT_HOSTS, 1); |
|
275 |
callbacks[0]= server_display_function; |
|
276 |
memcached_server_cursor(local_memc, callbacks, (void *)&bigger, 1); |
|
277 |
||
317.1.43
by brian@gir.tangent.org
Fix for always sort. |
278 |
|
279 |
memcached_free(local_memc); |
|
280 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
281 |
return TEST_SUCCESS; |
317.1.43
by brian@gir.tangent.org
Fix for always sort. |
282 |
}
|
283 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
284 |
static test_return_t allocation_test(memcached_st *not_used) |
143
by Brian Aker
Refactored out actual test code from test.c |
285 |
{
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
286 |
(void)not_used; |
143
by Brian Aker
Refactored out actual test code from test.c |
287 |
memcached_st *memc; |
288 |
memc= memcached_create(NULL); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
289 |
test_true(memc); |
143
by Brian Aker
Refactored out actual test code from test.c |
290 |
memcached_free(memc); |
147
by Brian Aker
Updating test cases to return true/false |
291 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
292 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
293 |
}
|
294 |
||
736
by Brian Aker
Updates for CORK. |
295 |
static test_return_t clone_test(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
296 |
{
|
297 |
/* All null? */
|
|
298 |
{
|
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
299 |
memcached_st *memc_clone; |
300 |
memc_clone= memcached_clone(NULL, NULL); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
301 |
test_true(memc_clone); |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
302 |
memcached_free(memc_clone); |
143
by Brian Aker
Refactored out actual test code from test.c |
303 |
}
|
304 |
||
305 |
/* Can we init from null? */
|
|
306 |
{
|
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
307 |
memcached_st *memc_clone; |
308 |
memc_clone= memcached_clone(NULL, memc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
309 |
test_true(memc_clone); |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
310 |
|
749
by Brian Aker
New allocator interface. |
311 |
{ // Test allocators |
312 |
test_true(memc_clone->allocators.free == memc->allocators.free); |
|
313 |
test_true(memc_clone->allocators.malloc == memc->allocators.malloc); |
|
314 |
test_true(memc_clone->allocators.realloc == memc->allocators.realloc); |
|
315 |
test_true(memc_clone->allocators.calloc == memc->allocators.calloc); |
|
316 |
}
|
|
317 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
318 |
test_true(memc_clone->connect_timeout == memc->connect_timeout); |
319 |
test_true(memc_clone->delete_trigger == memc->delete_trigger); |
|
320 |
test_true(memc_clone->distribution == memc->distribution); |
|
629
by Brian Aker
Additional flag removal. |
321 |
{ // Test all of the flags |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
322 |
test_true(memc_clone->flags.no_block == memc->flags.no_block); |
323 |
test_true(memc_clone->flags.tcp_nodelay == memc->flags.tcp_nodelay); |
|
324 |
test_true(memc_clone->flags.reuse_memory == memc->flags.reuse_memory); |
|
325 |
test_true(memc_clone->flags.use_cache_lookups == memc->flags.use_cache_lookups); |
|
326 |
test_true(memc_clone->flags.support_cas == memc->flags.support_cas); |
|
327 |
test_true(memc_clone->flags.buffer_requests == memc->flags.buffer_requests); |
|
328 |
test_true(memc_clone->flags.use_sort_hosts == memc->flags.use_sort_hosts); |
|
329 |
test_true(memc_clone->flags.verify_key == memc->flags.verify_key); |
|
330 |
test_true(memc_clone->flags.ketama_weighted == memc->flags.ketama_weighted); |
|
331 |
test_true(memc_clone->flags.binary_protocol == memc->flags.binary_protocol); |
|
332 |
test_true(memc_clone->flags.hash_with_prefix_key == memc->flags.hash_with_prefix_key); |
|
333 |
test_true(memc_clone->flags.no_reply == memc->flags.no_reply); |
|
334 |
test_true(memc_clone->flags.use_udp == memc->flags.use_udp); |
|
335 |
test_true(memc_clone->flags.auto_eject_hosts == memc->flags.auto_eject_hosts); |
|
336 |
test_true(memc_clone->flags.randomize_replica_read == memc->flags.randomize_replica_read); |
|
629
by Brian Aker
Additional flag removal. |
337 |
}
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
338 |
test_true(memc_clone->get_key_failure == memc->get_key_failure); |
761
by Brian Aker
Updates for libmemached to use libhashkit |
339 |
test_true(hashkit_compare(&memc_clone->hashkit, &memc->hashkit)); |
340 |
test_true(hashkit_compare(&memc_clone->distribution_hashkit, &memc->distribution_hashkit)); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
341 |
test_true(memc_clone->io_bytes_watermark == memc->io_bytes_watermark); |
342 |
test_true(memc_clone->io_msg_watermark == memc->io_msg_watermark); |
|
343 |
test_true(memc_clone->io_key_prefetch == memc->io_key_prefetch); |
|
344 |
test_true(memc_clone->on_cleanup == memc->on_cleanup); |
|
345 |
test_true(memc_clone->on_clone == memc->on_clone); |
|
346 |
test_true(memc_clone->poll_timeout == memc->poll_timeout); |
|
347 |
test_true(memc_clone->rcv_timeout == memc->rcv_timeout); |
|
348 |
test_true(memc_clone->recv_size == memc->recv_size); |
|
349 |
test_true(memc_clone->retry_timeout == memc->retry_timeout); |
|
350 |
test_true(memc_clone->send_size == memc->send_size); |
|
351 |
test_true(memc_clone->server_failure_limit == memc->server_failure_limit); |
|
352 |
test_true(memc_clone->snd_timeout == memc->snd_timeout); |
|
353 |
test_true(memc_clone->user_data == memc->user_data); |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
354 |
|
355 |
memcached_free(memc_clone); |
|
356 |
}
|
|
357 |
||
358 |
/* Can we init from struct? */
|
|
359 |
{
|
|
360 |
memcached_st declared_clone; |
|
361 |
memcached_st *memc_clone; |
|
362 |
memset(&declared_clone, 0 , sizeof(memcached_st)); |
|
363 |
memc_clone= memcached_clone(&declared_clone, NULL); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
364 |
test_true(memc_clone); |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
365 |
memcached_free(memc_clone); |
366 |
}
|
|
367 |
||
368 |
/* Can we init from struct? */
|
|
369 |
{
|
|
370 |
memcached_st declared_clone; |
|
371 |
memcached_st *memc_clone; |
|
372 |
memset(&declared_clone, 0 , sizeof(memcached_st)); |
|
373 |
memc_clone= memcached_clone(&declared_clone, memc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
374 |
test_true(memc_clone); |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
375 |
memcached_free(memc_clone); |
143
by Brian Aker
Refactored out actual test code from test.c |
376 |
}
|
147
by Brian Aker
Updating test cases to return true/false |
377 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
378 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
379 |
}
|
380 |
||
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
381 |
static test_return_t userdata_test(memcached_st *memc) |
535.2.4
by Trond Norbye
Add memcached_[gs]et_user_data and updated the doc for memcached_set_memory_allocators to point to the functions |
382 |
{
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
383 |
void* foo= NULL; |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
384 |
test_true(memcached_set_user_data(memc, foo) == NULL); |
385 |
test_true(memcached_get_user_data(memc) == foo); |
|
386 |
test_true(memcached_set_user_data(memc, NULL) == foo); |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
387 |
|
535.2.4
by Trond Norbye
Add memcached_[gs]et_user_data and updated the doc for memcached_set_memory_allocators to point to the functions |
388 |
return TEST_SUCCESS; |
389 |
}
|
|
390 |
||
736
by Brian Aker
Updates for CORK. |
391 |
static test_return_t connection_test(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
392 |
{
|
630
by Brian Aker
Style cleanup |
393 |
memcached_return_t rc; |
143
by Brian Aker
Refactored out actual test code from test.c |
394 |
|
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
395 |
rc= memcached_server_add_with_weight(memc, "localhost", 0, 0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
396 |
test_true(rc == MEMCACHED_SUCCESS); |
147
by Brian Aker
Updating test cases to return true/false |
397 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
398 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
399 |
}
|
400 |
||
736
by Brian Aker
Updates for CORK. |
401 |
static test_return_t error_test(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
402 |
{
|
630
by Brian Aker
Style cleanup |
403 |
memcached_return_t rc; |
590.1.4
by Trond Norbye
Strip trailing whitespaces |
404 |
uint32_t values[] = { 851992627U, 2337886783U, 3196981036U, 4001849190U, |
405 |
982370485U, 1263635348U, 4242906218U, 3829656100U, |
|
406 |
1891735253U, 334139633U, 2257084983U, 3088286104U, |
|
580.1.2
by Trond Norbye
Bug #434484: Binary protocol maps NOT_STORED to wrong error code |
407 |
13199785U, 2542027183U, 1097051614U, 199566778U, |
590.1.4
by Trond Norbye
Strip trailing whitespaces |
408 |
2748246961U, 2465192557U, 1664094137U, 2405439045U, |
580.1.2
by Trond Norbye
Bug #434484: Binary protocol maps NOT_STORED to wrong error code |
409 |
1842224848U, 692413798U, 3479807801U, 919913813U, |
410 |
4269430871U, 610793021U, 527273862U, 1437122909U, |
|
411 |
2300930706U, 2943759320U, 674306647U, 2400528935U, |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
412 |
54481931U, 4186304426U, 1741088401U, 2979625118U, |
800.1.2
by Trond Norbye
Add support for SASL |
413 |
4159057246U, 3425930182U, 2593724503U, 1868899624U, |
414 |
1769812374U, 2302537950U, 1110330676U }; |
|
143
by Brian Aker
Refactored out actual test code from test.c |
415 |
|
580.1.2
by Trond Norbye
Bug #434484: Binary protocol maps NOT_STORED to wrong error code |
416 |
// You have updated the memcache_error messages but not updated docs/tests.
|
800.1.2
by Trond Norbye
Add support for SASL |
417 |
test_true(MEMCACHED_MAXIMUM_RETURN == 43); |
143
by Brian Aker
Refactored out actual test code from test.c |
418 |
for (rc= MEMCACHED_SUCCESS; rc < MEMCACHED_MAXIMUM_RETURN; rc++) |
419 |
{
|
|
561
by Brian Aker
Modified test system so that "make test" should no properly error. |
420 |
uint32_t hash_val; |
580.1.2
by Trond Norbye
Bug #434484: Binary protocol maps NOT_STORED to wrong error code |
421 |
const char *msg= memcached_strerror(memc, rc); |
590.1.4
by Trond Norbye
Strip trailing whitespaces |
422 |
hash_val= memcached_generate_hash_value(msg, strlen(msg), |
580.1.2
by Trond Norbye
Bug #434484: Binary protocol maps NOT_STORED to wrong error code |
423 |
MEMCACHED_HASH_JENKINS); |
751
by Brian Aker
We now check return key size for memcached_fetch() to make sure it is not |
424 |
if (values[rc] != hash_val) |
425 |
{
|
|
426 |
fprintf(stderr, "\n\nYou have updated memcached_return_t without updating the error_test\n"); |
|
427 |
fprintf(stderr, "%u, %s, (%u)\n\n", (uint32_t)rc, memcached_strerror(memc, rc), hash_val); |
|
428 |
}
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
429 |
test_true(values[rc] == hash_val); |
143
by Brian Aker
Refactored out actual test code from test.c |
430 |
}
|
147
by Brian Aker
Updating test cases to return true/false |
431 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
432 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
433 |
}
|
434 |
||
736
by Brian Aker
Updates for CORK. |
435 |
static test_return_t set_test(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
436 |
{
|
630
by Brian Aker
Style cleanup |
437 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
438 |
const char *key= "foo"; |
439 |
const char *value= "when we sanitize"; |
|
143
by Brian Aker
Refactored out actual test code from test.c |
440 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
441 |
rc= memcached_set(memc, key, strlen(key), |
143
by Brian Aker
Refactored out actual test code from test.c |
442 |
value, strlen(value), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
443 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
444 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
147
by Brian Aker
Updating test cases to return true/false |
445 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
446 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
447 |
}
|
448 |
||
736
by Brian Aker
Updates for CORK. |
449 |
static test_return_t append_test(memcached_st *memc) |
162
by Brian Aker
More tests, and new code for append/prepend. |
450 |
{
|
630
by Brian Aker
Style cleanup |
451 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
452 |
const char *key= "fig"; |
453 |
const char *in_value= "we"; |
|
454 |
char *out_value= NULL; |
|
162
by Brian Aker
More tests, and new code for append/prepend. |
455 |
size_t value_length; |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
456 |
uint32_t flags; |
162
by Brian Aker
More tests, and new code for append/prepend. |
457 |
|
458 |
rc= memcached_flush(memc, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
459 |
test_true(rc == MEMCACHED_SUCCESS); |
162
by Brian Aker
More tests, and new code for append/prepend. |
460 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
461 |
rc= memcached_set(memc, key, strlen(key), |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
462 |
in_value, strlen(in_value), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
463 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
464 |
test_true(rc == MEMCACHED_SUCCESS); |
162
by Brian Aker
More tests, and new code for append/prepend. |
465 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
466 |
rc= memcached_append(memc, key, strlen(key), |
162
by Brian Aker
More tests, and new code for append/prepend. |
467 |
" the", strlen(" the"), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
468 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
469 |
test_true(rc == MEMCACHED_SUCCESS); |
162
by Brian Aker
More tests, and new code for append/prepend. |
470 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
471 |
rc= memcached_append(memc, key, strlen(key), |
162
by Brian Aker
More tests, and new code for append/prepend. |
472 |
" people", strlen(" people"), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
473 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
474 |
test_true(rc == MEMCACHED_SUCCESS); |
162
by Brian Aker
More tests, and new code for append/prepend. |
475 |
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
476 |
out_value= memcached_get(memc, key, strlen(key), |
162
by Brian Aker
More tests, and new code for append/prepend. |
477 |
&value_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
478 |
test_true(!memcmp(out_value, "we the people", strlen("we the people"))); |
479 |
test_true(strlen("we the people") == value_length); |
|
480 |
test_true(rc == MEMCACHED_SUCCESS); |
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
481 |
free(out_value); |
162
by Brian Aker
More tests, and new code for append/prepend. |
482 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
483 |
return TEST_SUCCESS; |
162
by Brian Aker
More tests, and new code for append/prepend. |
484 |
}
|
485 |
||
736
by Brian Aker
Updates for CORK. |
486 |
static test_return_t append_binary_test(memcached_st *memc) |
163
by Brian Aker
Added test for binary append (works as an example as well!) |
487 |
{
|
630
by Brian Aker
Style cleanup |
488 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
489 |
const char *key= "numbers"; |
728
by Brian Aker
Small icc repairs. |
490 |
uint32_t store_list[] = { 23, 56, 499, 98, 32847, 0 }; |
491 |
uint32_t *value; |
|
163
by Brian Aker
Added test for binary append (works as an example as well!) |
492 |
size_t value_length; |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
493 |
uint32_t flags; |
728
by Brian Aker
Small icc repairs. |
494 |
uint32_t x; |
163
by Brian Aker
Added test for binary append (works as an example as well!) |
495 |
|
496 |
rc= memcached_flush(memc, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
497 |
test_true(rc == MEMCACHED_SUCCESS); |
163
by Brian Aker
Added test for binary append (works as an example as well!) |
498 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
499 |
rc= memcached_set(memc, |
500 |
key, strlen(key), |
|
163
by Brian Aker
Added test for binary append (works as an example as well!) |
501 |
NULL, 0, |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
502 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
503 |
test_true(rc == MEMCACHED_SUCCESS); |
163
by Brian Aker
Added test for binary append (works as an example as well!) |
504 |
|
505 |
for (x= 0; store_list[x] ; x++) |
|
506 |
{
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
507 |
rc= memcached_append(memc, |
508 |
key, strlen(key), |
|
728
by Brian Aker
Small icc repairs. |
509 |
(char *)&store_list[x], sizeof(uint32_t), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
510 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
511 |
test_true(rc == MEMCACHED_SUCCESS); |
163
by Brian Aker
Added test for binary append (works as an example as well!) |
512 |
}
|
513 |
||
728
by Brian Aker
Small icc repairs. |
514 |
value= (uint32_t *)memcached_get(memc, key, strlen(key), |
163
by Brian Aker
Added test for binary append (works as an example as well!) |
515 |
&value_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
516 |
test_true((value_length == (sizeof(uint32_t) * x))); |
517 |
test_true(rc == MEMCACHED_SUCCESS); |
|
163
by Brian Aker
Added test for binary append (works as an example as well!) |
518 |
|
728
by Brian Aker
Small icc repairs. |
519 |
for (uint32_t counter= x, *ptr= value; counter; counter--) |
163
by Brian Aker
Added test for binary append (works as an example as well!) |
520 |
{
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
521 |
test_true(*ptr == store_list[x - counter]); |
728
by Brian Aker
Small icc repairs. |
522 |
ptr++; |
163
by Brian Aker
Added test for binary append (works as an example as well!) |
523 |
}
|
179
by Brian Aker
Cleanedup test cases (they had some valgrind warnings). |
524 |
free(value); |
163
by Brian Aker
Added test for binary append (works as an example as well!) |
525 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
526 |
return TEST_SUCCESS; |
163
by Brian Aker
Added test for binary append (works as an example as well!) |
527 |
}
|
528 |
||
736
by Brian Aker
Updates for CORK. |
529 |
static test_return_t cas2_test(memcached_st *memc) |
167
by Brian Aker
Full CAS support now enabled in the library. |
530 |
{
|
630
by Brian Aker
Style cleanup |
531 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
532 |
const char *keys[]= {"fudge", "son", "food"}; |
167
by Brian Aker
Full CAS support now enabled in the library. |
533 |
size_t key_length[]= {5, 3, 4}; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
534 |
const char *value= "we the people"; |
167
by Brian Aker
Full CAS support now enabled in the library. |
535 |
size_t value_length= strlen("we the people"); |
536 |
unsigned int x; |
|
537 |
memcached_result_st results_obj; |
|
538 |
memcached_result_st *results; |
|
539 |
unsigned int set= 1; |
|
540 |
||
541 |
rc= memcached_flush(memc, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
542 |
test_true(rc == MEMCACHED_SUCCESS); |
167
by Brian Aker
Full CAS support now enabled in the library. |
543 |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
544 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, set); |
167
by Brian Aker
Full CAS support now enabled in the library. |
545 |
|
546 |
for (x= 0; x < 3; x++) |
|
547 |
{
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
548 |
rc= memcached_set(memc, keys[x], key_length[x], |
167
by Brian Aker
Full CAS support now enabled in the library. |
549 |
keys[x], key_length[x], |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
550 |
(time_t)50, (uint32_t)9); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
551 |
test_true(rc == MEMCACHED_SUCCESS); |
167
by Brian Aker
Full CAS support now enabled in the library. |
552 |
}
|
553 |
||
554 |
rc= memcached_mget(memc, keys, key_length, 3); |
|
555 |
||
556 |
results= memcached_result_create(memc, &results_obj); |
|
557 |
||
558 |
results= memcached_fetch_result(memc, &results_obj, &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
559 |
test_true(results); |
751
by Brian Aker
We now check return key size for memcached_fetch() to make sure it is not |
560 |
test_true(results->item_cas); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
561 |
test_true(rc == MEMCACHED_SUCCESS); |
562 |
test_true(memcached_result_cas(results)); |
|
167
by Brian Aker
Full CAS support now enabled in the library. |
563 |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
564 |
test_true(!memcmp(value, "we the people", strlen("we the people"))); |
565 |
test_true(strlen("we the people") == value_length); |
|
566 |
test_true(rc == MEMCACHED_SUCCESS); |
|
167
by Brian Aker
Full CAS support now enabled in the library. |
567 |
|
568 |
memcached_result_free(&results_obj); |
|
569 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
570 |
return TEST_SUCCESS; |
167
by Brian Aker
Full CAS support now enabled in the library. |
571 |
}
|
572 |
||
736
by Brian Aker
Updates for CORK. |
573 |
static test_return_t cas_test(memcached_st *memc) |
162
by Brian Aker
More tests, and new code for append/prepend. |
574 |
{
|
630
by Brian Aker
Style cleanup |
575 |
memcached_return_t rc; |
419
by Brian Aker
Import new purge work from trond |
576 |
const char *key= "fun"; |
577 |
size_t key_length= strlen(key); |
|
578 |
const char *value= "we the people"; |
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
579 |
const char* keys[2] = { key, NULL }; |
438
by Trond Norbye
Remove compiler warnings from test suite |
580 |
size_t keylengths[2] = { strlen(key), 0 }; |
419
by Brian Aker
Import new purge work from trond |
581 |
size_t value_length= strlen(value); |
582 |
const char *value2= "change the value"; |
|
583 |
size_t value2_length= strlen(value2); |
|
584 |
||
162
by Brian Aker
More tests, and new code for append/prepend. |
585 |
memcached_result_st results_obj; |
586 |
memcached_result_st *results; |
|
167
by Brian Aker
Full CAS support now enabled in the library. |
587 |
unsigned int set= 1; |
162
by Brian Aker
More tests, and new code for append/prepend. |
588 |
|
589 |
rc= memcached_flush(memc, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
590 |
test_true(rc == MEMCACHED_SUCCESS); |
162
by Brian Aker
More tests, and new code for append/prepend. |
591 |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
592 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, set); |
167
by Brian Aker
Full CAS support now enabled in the library. |
593 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
594 |
rc= memcached_set(memc, key, strlen(key), |
162
by Brian Aker
More tests, and new code for append/prepend. |
595 |
value, strlen(value), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
596 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
597 |
test_true(rc == MEMCACHED_SUCCESS); |
162
by Brian Aker
More tests, and new code for append/prepend. |
598 |
|
438
by Trond Norbye
Remove compiler warnings from test suite |
599 |
rc= memcached_mget(memc, keys, keylengths, 1); |
162
by Brian Aker
More tests, and new code for append/prepend. |
600 |
|
601 |
results= memcached_result_create(memc, &results_obj); |
|
602 |
||
603 |
results= memcached_fetch_result(memc, &results_obj, &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
604 |
test_true(results); |
605 |
test_true(rc == MEMCACHED_SUCCESS); |
|
606 |
test_true(memcached_result_cas(results)); |
|
607 |
test_true(!memcmp(value, memcached_result_value(results), value_length)); |
|
608 |
test_true(strlen(memcached_result_value(results)) == value_length); |
|
609 |
test_true(rc == MEMCACHED_SUCCESS); |
|
419
by Brian Aker
Import new purge work from trond |
610 |
uint64_t cas = memcached_result_cas(results); |
611 |
||
792
by Brian Aker
Lots of compiler fixes. |
612 |
#if 0
|
419
by Brian Aker
Import new purge work from trond |
613 |
results= memcached_fetch_result(memc, &results_obj, &rc);
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
614 |
test_true(rc == MEMCACHED_END);
|
615 |
test_true(results == NULL);
|
|
419
by Brian Aker
Import new purge work from trond |
616 |
#endif
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
617 |
|
419
by Brian Aker
Import new purge work from trond |
618 |
rc= memcached_cas(memc, key, key_length, value2, value2_length, 0, 0, cas); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
619 |
test_true(rc == MEMCACHED_SUCCESS); |
419
by Brian Aker
Import new purge work from trond |
620 |
|
621 |
/*
|
|
622 |
* The item will have a new cas value, so try to set it again with the old
|
|
623 |
* value. This should fail!
|
|
624 |
*/
|
|
625 |
rc= memcached_cas(memc, key, key_length, value2, value2_length, 0, 0, cas); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
626 |
test_true(rc == MEMCACHED_DATA_EXISTS); |
307
by brian@gir-2.local
Bug fix for memcached_cas() operator. |
627 |
|
162
by Brian Aker
More tests, and new code for append/prepend. |
628 |
memcached_result_free(&results_obj); |
629 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
630 |
return TEST_SUCCESS; |
162
by Brian Aker
More tests, and new code for append/prepend. |
631 |
}
|
632 |
||
736
by Brian Aker
Updates for CORK. |
633 |
static test_return_t prepend_test(memcached_st *memc) |
162
by Brian Aker
More tests, and new code for append/prepend. |
634 |
{
|
630
by Brian Aker
Style cleanup |
635 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
636 |
const char *key= "fig"; |
637 |
const char *value= "people"; |
|
638 |
char *out_value= NULL; |
|
162
by Brian Aker
More tests, and new code for append/prepend. |
639 |
size_t value_length; |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
640 |
uint32_t flags; |
162
by Brian Aker
More tests, and new code for append/prepend. |
641 |
|
642 |
rc= memcached_flush(memc, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
643 |
test_true(rc == MEMCACHED_SUCCESS); |
162
by Brian Aker
More tests, and new code for append/prepend. |
644 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
645 |
rc= memcached_set(memc, key, strlen(key), |
162
by Brian Aker
More tests, and new code for append/prepend. |
646 |
value, strlen(value), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
647 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
648 |
test_true(rc == MEMCACHED_SUCCESS); |
162
by Brian Aker
More tests, and new code for append/prepend. |
649 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
650 |
rc= memcached_prepend(memc, key, strlen(key), |
162
by Brian Aker
More tests, and new code for append/prepend. |
651 |
"the ", strlen("the "), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
652 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
653 |
test_true(rc == MEMCACHED_SUCCESS); |
162
by Brian Aker
More tests, and new code for append/prepend. |
654 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
655 |
rc= memcached_prepend(memc, key, strlen(key), |
162
by Brian Aker
More tests, and new code for append/prepend. |
656 |
"we ", strlen("we "), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
657 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
658 |
test_true(rc == MEMCACHED_SUCCESS); |
162
by Brian Aker
More tests, and new code for append/prepend. |
659 |
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
660 |
out_value= memcached_get(memc, key, strlen(key), |
162
by Brian Aker
More tests, and new code for append/prepend. |
661 |
&value_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
662 |
test_true(!memcmp(out_value, "we the people", strlen("we the people"))); |
663 |
test_true(strlen("we the people") == value_length); |
|
664 |
test_true(rc == MEMCACHED_SUCCESS); |
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
665 |
free(out_value); |
162
by Brian Aker
More tests, and new code for append/prepend. |
666 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
667 |
return TEST_SUCCESS; |
162
by Brian Aker
More tests, and new code for append/prepend. |
668 |
}
|
669 |
||
590.1.4
by Trond Norbye
Strip trailing whitespaces |
670 |
/*
|
198
by brian@gir.tangent.org
Big fix for async mode to make sure all data has been pushed through socket |
671 |
Set the value, then quit to make sure it is flushed.
|
672 |
Come back in and test that add fails.
|
|
673 |
*/
|
|
736
by Brian Aker
Updates for CORK. |
674 |
static test_return_t add_test(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
675 |
{
|
630
by Brian Aker
Style cleanup |
676 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
677 |
const char *key= "foo"; |
678 |
const char *value= "when we sanitize"; |
|
286
by Brian Aker
Fixed add test failure for OS'es with broken async loopback devices. |
679 |
unsigned long long setting_value; |
680 |
||
681 |
setting_value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
682 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
683 |
rc= memcached_set(memc, key, strlen(key), |
198
by brian@gir.tangent.org
Big fix for async mode to make sure all data has been pushed through socket |
684 |
value, strlen(value), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
685 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
686 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
198
by brian@gir.tangent.org
Big fix for async mode to make sure all data has been pushed through socket |
687 |
memcached_quit(memc); |
590.1.4
by Trond Norbye
Strip trailing whitespaces |
688 |
rc= memcached_add(memc, key, strlen(key), |
143
by Brian Aker
Refactored out actual test code from test.c |
689 |
value, strlen(value), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
690 |
(time_t)0, (uint32_t)0); |
286
by Brian Aker
Fixed add test failure for OS'es with broken async loopback devices. |
691 |
|
692 |
/* Too many broken OS'es have broken loopback in async, so we can't be sure of the result */
|
|
693 |
if (setting_value) |
|
620
by Brian Aker
Updated tests to use new macro (less assert()). |
694 |
{
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
695 |
test_true(rc == MEMCACHED_NOTSTORED || rc == MEMCACHED_STORED); |
620
by Brian Aker
Updated tests to use new macro (less assert()). |
696 |
}
|
286
by Brian Aker
Fixed add test failure for OS'es with broken async loopback devices. |
697 |
else
|
620
by Brian Aker
Updated tests to use new macro (less assert()). |
698 |
{
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
699 |
test_true(rc == MEMCACHED_NOTSTORED || rc == MEMCACHED_DATA_EXISTS); |
620
by Brian Aker
Updated tests to use new macro (less assert()). |
700 |
}
|
147
by Brian Aker
Updating test cases to return true/false |
701 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
702 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
703 |
}
|
704 |
||
472
by Trond Norbye
Lower the number of iterations in add_wrapper |
705 |
/*
|
706 |
** There was a problem of leaking filedescriptors in the initial release
|
|
707 |
** of MacOSX 10.5. This test case triggers the problem. On some Solaris
|
|
708 |
** systems it seems that the kernel is slow on reclaiming the resources
|
|
709 |
** because the connects starts to time out (the test doesn't do much
|
|
710 |
** anyway, so just loop 10 iterations)
|
|
711 |
*/
|
|
736
by Brian Aker
Updates for CORK. |
712 |
static test_return_t add_wrapper(memcached_st *memc) |
220
by Brian Aker
New async test. |
713 |
{
|
472
by Trond Norbye
Lower the number of iterations in add_wrapper |
714 |
unsigned int max= 10000; |
715 |
#ifdef __sun
|
|
716 |
max= 10; |
|
717 |
#endif
|
|
588
by Brian Aker
Pulled fix from Trond |
718 |
#ifdef __APPLE__
|
719 |
max= 10; |
|
720 |
#endif
|
|
220
by Brian Aker
New async test. |
721 |
|
861
by Brian Aker
Fix for version on OSX |
722 |
for (uint32_t x= 0; x < max; x++) |
220
by Brian Aker
New async test. |
723 |
add_test(memc); |
724 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
725 |
return TEST_SUCCESS; |
220
by Brian Aker
New async test. |
726 |
}
|
727 |
||
736
by Brian Aker
Updates for CORK. |
728 |
static test_return_t replace_test(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
729 |
{
|
630
by Brian Aker
Style cleanup |
730 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
731 |
const char *key= "foo"; |
732 |
const char *value= "when we sanitize"; |
|
733 |
const char *original= "first we insert some data"; |
|
287
by Brian Aker
Fix for non-blocking IO error. The refactoring bit broke some cases where |
734 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
735 |
rc= memcached_set(memc, key, strlen(key), |
287
by Brian Aker
Fix for non-blocking IO error. The refactoring bit broke some cases where |
736 |
original, strlen(original), |
737 |
(time_t)0, (uint32_t)0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
738 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
143
by Brian Aker
Refactored out actual test code from test.c |
739 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
740 |
rc= memcached_replace(memc, key, strlen(key), |
143
by Brian Aker
Refactored out actual test code from test.c |
741 |
value, strlen(value), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
742 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
743 |
test_true(rc == MEMCACHED_SUCCESS); |
147
by Brian Aker
Updating test cases to return true/false |
744 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
745 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
746 |
}
|
747 |
||
736
by Brian Aker
Updates for CORK. |
748 |
static test_return_t delete_test(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
749 |
{
|
630
by Brian Aker
Style cleanup |
750 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
751 |
const char *key= "foo"; |
752 |
const char *value= "when we sanitize"; |
|
143
by Brian Aker
Refactored out actual test code from test.c |
753 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
754 |
rc= memcached_set(memc, key, strlen(key), |
143
by Brian Aker
Refactored out actual test code from test.c |
755 |
value, strlen(value), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
756 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
757 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
143
by Brian Aker
Refactored out actual test code from test.c |
758 |
|
759 |
rc= memcached_delete(memc, key, strlen(key), (time_t)0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
760 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
147
by Brian Aker
Updating test cases to return true/false |
761 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
762 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
763 |
}
|
764 |
||
736
by Brian Aker
Updates for CORK. |
765 |
static test_return_t flush_test(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
766 |
{
|
630
by Brian Aker
Style cleanup |
767 |
memcached_return_t rc; |
143
by Brian Aker
Refactored out actual test code from test.c |
768 |
|
769 |
rc= memcached_flush(memc, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
770 |
test_true(rc == MEMCACHED_SUCCESS); |
147
by Brian Aker
Updating test cases to return true/false |
771 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
772 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
773 |
}
|
774 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
775 |
static memcached_return_t server_function(const memcached_st *ptr, |
776 |
const memcached_server_st *server, |
|
777 |
void *context) |
|
315
by brian@gir-2.local
First view of server cursor function. |
778 |
{
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
779 |
(void)ptr; (void)server; (void)context; |
315
by brian@gir-2.local
First view of server cursor function. |
780 |
/* Do Nothing */
|
781 |
||
782 |
return MEMCACHED_SUCCESS; |
|
783 |
}
|
|
784 |
||
736
by Brian Aker
Updates for CORK. |
785 |
static test_return_t memcached_server_cursor_test(memcached_st *memc) |
315
by brian@gir-2.local
First view of server cursor function. |
786 |
{
|
928.1.2
by Brian Aker
Updates for strncpy. |
787 |
char context[10]; |
788 |
strncpy(context, "foo bad", sizeof(context)); |
|
630
by Brian Aker
Style cleanup |
789 |
memcached_server_fn callbacks[1]; |
315
by brian@gir-2.local
First view of server cursor function. |
790 |
|
791 |
callbacks[0]= server_function; |
|
792 |
memcached_server_cursor(memc, callbacks, context, 1); |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
793 |
return TEST_SUCCESS; |
315
by brian@gir-2.local
First view of server cursor function. |
794 |
}
|
795 |
||
736
by Brian Aker
Updates for CORK. |
796 |
static test_return_t bad_key_test(memcached_st *memc) |
303
by brian@gir-2.local
MEMCACHED_BAD_KEY_PROVIDED has been added as an error type. When libmemcached |
797 |
{
|
630
by Brian Aker
Style cleanup |
798 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
799 |
const char *key= "foo bad"; |
303
by brian@gir-2.local
MEMCACHED_BAD_KEY_PROVIDED has been added as an error type. When libmemcached |
800 |
char *string; |
801 |
size_t string_length; |
|
802 |
uint32_t flags; |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
803 |
memcached_st *memc_clone; |
306
by brian@gir-2.local
Added behavior method around testing of keys. |
804 |
unsigned int set= 1; |
426
by Trond Norbye
Deprecate MEMCACHED_NO_KEY_PROVIDED, and fixed key validation tests for the binary protocol |
805 |
size_t max_keylen= 0xffff; |
306
by brian@gir-2.local
Added behavior method around testing of keys. |
806 |
|
637
by Brian Aker
Updating interface. |
807 |
// Just skip if we are in binary mode.
|
808 |
if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL)) |
|
809 |
return TEST_SKIPPED; |
|
810 |
||
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
811 |
memc_clone= memcached_clone(NULL, memc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
812 |
test_true(memc_clone); |
306
by brian@gir-2.local
Added behavior method around testing of keys. |
813 |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
814 |
rc= memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, set); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
815 |
test_true(rc == MEMCACHED_SUCCESS); |
306
by brian@gir-2.local
Added behavior method around testing of keys. |
816 |
|
426
by Trond Norbye
Deprecate MEMCACHED_NO_KEY_PROVIDED, and fixed key validation tests for the binary protocol |
817 |
/* All keys are valid in the binary protocol (except for length) */
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
818 |
if (memcached_behavior_get(memc_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == 0) |
341
by brian@gir-3.local
Fix for bad key on master |
819 |
{
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
820 |
string= memcached_get(memc_clone, key, strlen(key), |
426
by Trond Norbye
Deprecate MEMCACHED_NO_KEY_PROVIDED, and fixed key validation tests for the binary protocol |
821 |
&string_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
822 |
test_true(rc == MEMCACHED_BAD_KEY_PROVIDED); |
823 |
test_true(string_length == 0); |
|
824 |
test_true(!string); |
|
426
by Trond Norbye
Deprecate MEMCACHED_NO_KEY_PROVIDED, and fixed key validation tests for the binary protocol |
825 |
|
826 |
set= 0; |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
827 |
rc= memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, set); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
828 |
test_true(rc == MEMCACHED_SUCCESS); |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
829 |
string= memcached_get(memc_clone, key, strlen(key), |
426
by Trond Norbye
Deprecate MEMCACHED_NO_KEY_PROVIDED, and fixed key validation tests for the binary protocol |
830 |
&string_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
831 |
test_true(rc == MEMCACHED_NOTFOUND); |
832 |
test_true(string_length == 0); |
|
833 |
test_true(!string); |
|
426
by Trond Norbye
Deprecate MEMCACHED_NO_KEY_PROVIDED, and fixed key validation tests for the binary protocol |
834 |
|
835 |
/* Test multi key for bad keys */
|
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
836 |
const char *keys[] = { "GoodKey", "Bad Key", "NotMine" }; |
341
by brian@gir-3.local
Fix for bad key on master |
837 |
size_t key_lengths[] = { 7, 7, 7 }; |
838 |
set= 1; |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
839 |
rc= memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, set); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
840 |
test_true(rc == MEMCACHED_SUCCESS); |
341
by brian@gir-3.local
Fix for bad key on master |
841 |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
842 |
rc= memcached_mget(memc_clone, keys, key_lengths, 3); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
843 |
test_true(rc == MEMCACHED_BAD_KEY_PROVIDED); |
341
by brian@gir-3.local
Fix for bad key on master |
844 |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
845 |
rc= memcached_mget_by_key(memc_clone, "foo daddy", 9, keys, key_lengths, 1); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
846 |
test_true(rc == MEMCACHED_BAD_KEY_PROVIDED); |
426
by Trond Norbye
Deprecate MEMCACHED_NO_KEY_PROVIDED, and fixed key validation tests for the binary protocol |
847 |
|
848 |
max_keylen= 250; |
|
849 |
||
850 |
/* The following test should be moved to the end of this function when the
|
|
851 |
memcached server is updated to allow max size length of the keys in the
|
|
852 |
binary protocol
|
|
853 |
*/
|
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
854 |
rc= memcached_callback_set(memc_clone, MEMCACHED_CALLBACK_PREFIX_KEY, NULL); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
855 |
test_true(rc == MEMCACHED_SUCCESS); |
426
by Trond Norbye
Deprecate MEMCACHED_NO_KEY_PROVIDED, and fixed key validation tests for the binary protocol |
856 |
|
857 |
char *longkey= malloc(max_keylen + 1); |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
858 |
if (longkey != NULL) |
426
by Trond Norbye
Deprecate MEMCACHED_NO_KEY_PROVIDED, and fixed key validation tests for the binary protocol |
859 |
{
|
860 |
memset(longkey, 'a', max_keylen + 1); |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
861 |
string= memcached_get(memc_clone, longkey, max_keylen, |
426
by Trond Norbye
Deprecate MEMCACHED_NO_KEY_PROVIDED, and fixed key validation tests for the binary protocol |
862 |
&string_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
863 |
test_true(rc == MEMCACHED_NOTFOUND); |
864 |
test_true(string_length == 0); |
|
865 |
test_true(!string); |
|
426
by Trond Norbye
Deprecate MEMCACHED_NO_KEY_PROVIDED, and fixed key validation tests for the binary protocol |
866 |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
867 |
string= memcached_get(memc_clone, longkey, max_keylen + 1, |
426
by Trond Norbye
Deprecate MEMCACHED_NO_KEY_PROVIDED, and fixed key validation tests for the binary protocol |
868 |
&string_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
869 |
test_true(rc == MEMCACHED_BAD_KEY_PROVIDED); |
870 |
test_true(string_length == 0); |
|
871 |
test_true(!string); |
|
426
by Trond Norbye
Deprecate MEMCACHED_NO_KEY_PROVIDED, and fixed key validation tests for the binary protocol |
872 |
|
873 |
free(longkey); |
|
874 |
}
|
|
341
by brian@gir-3.local
Fix for bad key on master |
875 |
}
|
876 |
||
353
by brian@localhost.localdomain
Fix for zero length bad key fix. |
877 |
/* Make sure zero length keys are marked as bad */
|
878 |
set= 1; |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
879 |
rc= memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_VERIFY_KEY, set); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
880 |
test_true(rc == MEMCACHED_SUCCESS); |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
881 |
string= memcached_get(memc_clone, key, 0, |
353
by brian@localhost.localdomain
Fix for zero length bad key fix. |
882 |
&string_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
883 |
test_true(rc == MEMCACHED_BAD_KEY_PROVIDED); |
884 |
test_true(string_length == 0); |
|
885 |
test_true(!string); |
|
353
by brian@localhost.localdomain
Fix for zero length bad key fix. |
886 |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
887 |
memcached_free(memc_clone); |
303
by brian@gir-2.local
MEMCACHED_BAD_KEY_PROVIDED has been added as an error type. When libmemcached |
888 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
889 |
return TEST_SUCCESS; |
303
by brian@gir-2.local
MEMCACHED_BAD_KEY_PROVIDED has been added as an error type. When libmemcached |
890 |
}
|
891 |
||
317.1.24
by brian@gir-2.local
Read through caching function. |
892 |
#define READ_THROUGH_VALUE "set for me"
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
893 |
static memcached_return_t read_through_trigger(memcached_st *memc, |
894 |
char *key, |
|
895 |
size_t key_length, |
|
648
by Brian Aker
ICC cleanups |
896 |
memcached_result_st *result) |
317.1.24
by brian@gir-2.local
Read through caching function. |
897 |
{
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
898 |
(void)memc;(void)key;(void)key_length; |
317.1.24
by brian@gir-2.local
Read through caching function. |
899 |
return memcached_result_set_value(result, READ_THROUGH_VALUE, strlen(READ_THROUGH_VALUE)); |
900 |
}
|
|
901 |
||
648
by Brian Aker
ICC cleanups |
902 |
static test_return_t read_through(memcached_st *memc) |
317.1.24
by brian@gir-2.local
Read through caching function. |
903 |
{
|
630
by Brian Aker
Style cleanup |
904 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
905 |
const char *key= "foo"; |
317.1.24
by brian@gir-2.local
Read through caching function. |
906 |
char *string; |
907 |
size_t string_length; |
|
908 |
uint32_t flags; |
|
630
by Brian Aker
Style cleanup |
909 |
memcached_trigger_key_fn cb= (memcached_trigger_key_fn)read_through_trigger; |
317.1.24
by brian@gir-2.local
Read through caching function. |
910 |
|
911 |
string= memcached_get(memc, key, strlen(key), |
|
912 |
&string_length, &flags, &rc); |
|
913 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
914 |
test_true(rc == MEMCACHED_NOTFOUND); |
648
by Brian Aker
ICC cleanups |
915 |
test_false(string_length); |
916 |
test_false(string); |
|
317.1.24
by brian@gir-2.local
Read through caching function. |
917 |
|
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
918 |
rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_GET_FAILURE, |
919 |
*(void **)&cb); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
920 |
test_true(rc == MEMCACHED_SUCCESS); |
317.1.24
by brian@gir-2.local
Read through caching function. |
921 |
|
922 |
string= memcached_get(memc, key, strlen(key), |
|
923 |
&string_length, &flags, &rc); |
|
924 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
925 |
test_true(rc == MEMCACHED_SUCCESS); |
926 |
test_true(string_length == strlen(READ_THROUGH_VALUE)); |
|
648
by Brian Aker
ICC cleanups |
927 |
test_strcmp(READ_THROUGH_VALUE, string); |
317.1.49
by Brian Aker
Removed issue around zero length returns now being valid. Fixed memory leak |
928 |
free(string); |
317.1.24
by brian@gir-2.local
Read through caching function. |
929 |
|
930 |
string= memcached_get(memc, key, strlen(key), |
|
931 |
&string_length, &flags, &rc); |
|
932 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
933 |
test_true(rc == MEMCACHED_SUCCESS); |
934 |
test_true(string_length == strlen(READ_THROUGH_VALUE)); |
|
935 |
test_true(!strcmp(READ_THROUGH_VALUE, string)); |
|
317.1.49
by Brian Aker
Removed issue around zero length returns now being valid. Fixed memory leak |
936 |
free(string); |
317.1.24
by brian@gir-2.local
Read through caching function. |
937 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
938 |
return TEST_SUCCESS; |
317.1.24
by brian@gir-2.local
Read through caching function. |
939 |
}
|
940 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
941 |
static memcached_return_t delete_trigger(memcached_st *ptr, |
653
by Brian Aker
Test cleanup. |
942 |
const char *key, |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
943 |
size_t key_length) |
317.1.30
by brian@gir.tangent.org
Adding support for trigger call on delete of a successful object. |
944 |
{
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
945 |
(void)ptr;(void)key_length; |
317.1.30
by brian@gir.tangent.org
Adding support for trigger call on delete of a successful object. |
946 |
assert(key); |
947 |
||
948 |
return MEMCACHED_SUCCESS; |
|
949 |
}
|
|
950 |
||
736
by Brian Aker
Updates for CORK. |
951 |
static test_return_t delete_through(memcached_st *memc) |
317.1.30
by brian@gir.tangent.org
Adding support for trigger call on delete of a successful object. |
952 |
{
|
630
by Brian Aker
Style cleanup |
953 |
memcached_trigger_delete_key_fn callback; |
954 |
memcached_return_t rc; |
|
317.1.30
by brian@gir.tangent.org
Adding support for trigger call on delete of a successful object. |
955 |
|
630
by Brian Aker
Style cleanup |
956 |
callback= (memcached_trigger_delete_key_fn)delete_trigger; |
317.1.30
by brian@gir.tangent.org
Adding support for trigger call on delete of a successful object. |
957 |
|
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
958 |
rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_DELETE_TRIGGER, *(void**)&callback); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
959 |
test_true(rc == MEMCACHED_SUCCESS); |
317.1.30
by brian@gir.tangent.org
Adding support for trigger call on delete of a successful object. |
960 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
961 |
return TEST_SUCCESS; |
317.1.30
by brian@gir.tangent.org
Adding support for trigger call on delete of a successful object. |
962 |
}
|
963 |
||
736
by Brian Aker
Updates for CORK. |
964 |
static test_return_t get_test(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
965 |
{
|
630
by Brian Aker
Style cleanup |
966 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
967 |
const char *key= "foo"; |
143
by Brian Aker
Refactored out actual test code from test.c |
968 |
char *string; |
969 |
size_t string_length; |
|
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
970 |
uint32_t flags; |
143
by Brian Aker
Refactored out actual test code from test.c |
971 |
|
972 |
rc= memcached_delete(memc, key, strlen(key), (time_t)0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
973 |
test_true(rc == MEMCACHED_BUFFERED || rc == MEMCACHED_NOTFOUND); |
143
by Brian Aker
Refactored out actual test code from test.c |
974 |
|
975 |
string= memcached_get(memc, key, strlen(key), |
|
976 |
&string_length, &flags, &rc); |
|
977 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
978 |
test_true(rc == MEMCACHED_NOTFOUND); |
648
by Brian Aker
ICC cleanups |
979 |
test_false(string_length); |
980 |
test_false(string); |
|
147
by Brian Aker
Updating test cases to return true/false |
981 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
982 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
983 |
}
|
984 |
||
736
by Brian Aker
Updates for CORK. |
985 |
static test_return_t get_test2(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
986 |
{
|
630
by Brian Aker
Style cleanup |
987 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
988 |
const char *key= "foo"; |
989 |
const char *value= "when we sanitize"; |
|
143
by Brian Aker
Refactored out actual test code from test.c |
990 |
char *string; |
991 |
size_t string_length; |
|
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
992 |
uint32_t flags; |
143
by Brian Aker
Refactored out actual test code from test.c |
993 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
994 |
rc= memcached_set(memc, key, strlen(key), |
143
by Brian Aker
Refactored out actual test code from test.c |
995 |
value, strlen(value), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
996 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
997 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
143
by Brian Aker
Refactored out actual test code from test.c |
998 |
|
999 |
string= memcached_get(memc, key, strlen(key), |
|
1000 |
&string_length, &flags, &rc); |
|
1001 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1002 |
test_true(string); |
1003 |
test_true(rc == MEMCACHED_SUCCESS); |
|
1004 |
test_true(string_length == strlen(value)); |
|
1005 |
test_true(!memcmp(string, value, string_length)); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1006 |
|
1007 |
free(string); |
|
147
by Brian Aker
Updating test cases to return true/false |
1008 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1009 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
1010 |
}
|
1011 |
||
736
by Brian Aker
Updates for CORK. |
1012 |
static test_return_t set_test2(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
1013 |
{
|
630
by Brian Aker
Style cleanup |
1014 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
1015 |
const char *key= "foo"; |
1016 |
const char *value= "train in the brain"; |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1017 |
size_t value_length= strlen(value); |
1018 |
unsigned int x; |
|
1019 |
||
1020 |
for (x= 0; x < 10; x++) |
|
1021 |
{
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1022 |
rc= memcached_set(memc, key, strlen(key), |
143
by Brian Aker
Refactored out actual test code from test.c |
1023 |
value, value_length, |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
1024 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1025 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
143
by Brian Aker
Refactored out actual test code from test.c |
1026 |
}
|
147
by Brian Aker
Updating test cases to return true/false |
1027 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1028 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
1029 |
}
|
1030 |
||
736
by Brian Aker
Updates for CORK. |
1031 |
static test_return_t set_test3(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
1032 |
{
|
630
by Brian Aker
Style cleanup |
1033 |
memcached_return_t rc; |
143
by Brian Aker
Refactored out actual test code from test.c |
1034 |
char *value; |
1035 |
size_t value_length= 8191; |
|
1036 |
unsigned int x; |
|
1037 |
||
1038 |
value = (char*)malloc(value_length); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1039 |
test_true(value); |
143
by Brian Aker
Refactored out actual test code from test.c |
1040 |
|
1041 |
for (x= 0; x < value_length; x++) |
|
1042 |
value[x] = (char) (x % 127); |
|
1043 |
||
526
by brian@localhost.localdomain
Added new memcached_dump() command. |
1044 |
/* The dump test relies on there being at least 32 items in memcached */
|
1045 |
for (x= 0; x < 32; x++) |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1046 |
{
|
526
by brian@localhost.localdomain
Added new memcached_dump() command. |
1047 |
char key[16]; |
1048 |
||
904.1.1
by Brian Aker
Remove openbsd warnings. |
1049 |
snprintf(key, sizeof(key), "foo%u", x); |
526
by brian@localhost.localdomain
Added new memcached_dump() command. |
1050 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1051 |
rc= memcached_set(memc, key, strlen(key), |
143
by Brian Aker
Refactored out actual test code from test.c |
1052 |
value, value_length, |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
1053 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1054 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
143
by Brian Aker
Refactored out actual test code from test.c |
1055 |
}
|
1056 |
||
1057 |
free(value); |
|
147
by Brian Aker
Updating test cases to return true/false |
1058 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1059 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
1060 |
}
|
1061 |
||
736
by Brian Aker
Updates for CORK. |
1062 |
static test_return_t get_test3(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
1063 |
{
|
630
by Brian Aker
Style cleanup |
1064 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
1065 |
const char *key= "foo"; |
143
by Brian Aker
Refactored out actual test code from test.c |
1066 |
char *value; |
1067 |
size_t value_length= 8191; |
|
1068 |
char *string; |
|
1069 |
size_t string_length; |
|
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
1070 |
uint32_t flags; |
377
by brian@gir-3.local
Cleanup warnings/found issue in store by key functions. |
1071 |
uint32_t x; |
143
by Brian Aker
Refactored out actual test code from test.c |
1072 |
|
1073 |
value = (char*)malloc(value_length); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1074 |
test_true(value); |
143
by Brian Aker
Refactored out actual test code from test.c |
1075 |
|
1076 |
for (x= 0; x < value_length; x++) |
|
1077 |
value[x] = (char) (x % 127); |
|
1078 |
||
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1079 |
rc= memcached_set(memc, key, strlen(key), |
143
by Brian Aker
Refactored out actual test code from test.c |
1080 |
value, value_length, |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
1081 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1082 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
143
by Brian Aker
Refactored out actual test code from test.c |
1083 |
|
1084 |
string= memcached_get(memc, key, strlen(key), |
|
1085 |
&string_length, &flags, &rc); |
|
1086 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1087 |
test_true(rc == MEMCACHED_SUCCESS); |
1088 |
test_true(string); |
|
1089 |
test_true(string_length == value_length); |
|
1090 |
test_true(!memcmp(string, value, string_length)); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1091 |
|
1092 |
free(string); |
|
1093 |
free(value); |
|
147
by Brian Aker
Updating test cases to return true/false |
1094 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1095 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
1096 |
}
|
1097 |
||
736
by Brian Aker
Updates for CORK. |
1098 |
static test_return_t get_test4(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
1099 |
{
|
630
by Brian Aker
Style cleanup |
1100 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
1101 |
const char *key= "foo"; |
143
by Brian Aker
Refactored out actual test code from test.c |
1102 |
char *value; |
1103 |
size_t value_length= 8191; |
|
1104 |
char *string; |
|
1105 |
size_t string_length; |
|
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
1106 |
uint32_t flags; |
377
by brian@gir-3.local
Cleanup warnings/found issue in store by key functions. |
1107 |
uint32_t x; |
143
by Brian Aker
Refactored out actual test code from test.c |
1108 |
|
1109 |
value = (char*)malloc(value_length); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1110 |
test_true(value); |
143
by Brian Aker
Refactored out actual test code from test.c |
1111 |
|
1112 |
for (x= 0; x < value_length; x++) |
|
1113 |
value[x] = (char) (x % 127); |
|
1114 |
||
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1115 |
rc= memcached_set(memc, key, strlen(key), |
143
by Brian Aker
Refactored out actual test code from test.c |
1116 |
value, value_length, |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
1117 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1118 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
143
by Brian Aker
Refactored out actual test code from test.c |
1119 |
|
1120 |
for (x= 0; x < 10; x++) |
|
1121 |
{
|
|
1122 |
string= memcached_get(memc, key, strlen(key), |
|
1123 |
&string_length, &flags, &rc); |
|
1124 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1125 |
test_true(rc == MEMCACHED_SUCCESS); |
1126 |
test_true(string); |
|
1127 |
test_true(string_length == value_length); |
|
1128 |
test_true(!memcmp(string, value, string_length)); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1129 |
free(string); |
1130 |
}
|
|
1131 |
||
1132 |
free(value); |
|
147
by Brian Aker
Updating test cases to return true/false |
1133 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1134 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
1135 |
}
|
1136 |
||
475
by Trond Norbye
Use ptr->root->result if the caller didn't provide a result structure to memcached_read_one_response |
1137 |
/*
|
1138 |
* This test verifies that memcached_read_one_response doesn't try to
|
|
1139 |
* dereference a NIL-pointer if you issue a multi-get and don't read out all
|
|
1140 |
* responses before you execute a storage command.
|
|
1141 |
*/
|
|
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
1142 |
static test_return_t get_test5(memcached_st *memc) |
475
by Trond Norbye
Use ptr->root->result if the caller didn't provide a result structure to memcached_read_one_response |
1143 |
{
|
1144 |
/*
|
|
1145 |
** Request the same key twice, to ensure that we hash to the same server
|
|
1146 |
** (so that we have multiple response values queued up) ;-)
|
|
1147 |
*/
|
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
1148 |
const char *keys[]= { "key", "key" }; |
475
by Trond Norbye
Use ptr->root->result if the caller didn't provide a result structure to memcached_read_one_response |
1149 |
size_t lengths[]= { 3, 3 }; |
1150 |
uint32_t flags; |
|
1151 |
size_t rlen; |
|
1152 |
||
630
by Brian Aker
Style cleanup |
1153 |
memcached_return_t rc= memcached_set(memc, keys[0], lengths[0], |
475
by Trond Norbye
Use ptr->root->result if the caller didn't provide a result structure to memcached_read_one_response |
1154 |
keys[0], lengths[0], 0, 0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1155 |
test_true(rc == MEMCACHED_SUCCESS); |
475
by Trond Norbye
Use ptr->root->result if the caller didn't provide a result structure to memcached_read_one_response |
1156 |
rc= memcached_mget(memc, keys, lengths, 2); |
1157 |
||
1158 |
memcached_result_st results_obj; |
|
1159 |
memcached_result_st *results; |
|
1160 |
results=memcached_result_create(memc, &results_obj); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1161 |
test_true(results); |
475
by Trond Norbye
Use ptr->root->result if the caller didn't provide a result structure to memcached_read_one_response |
1162 |
results=memcached_fetch_result(memc, &results_obj, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1163 |
test_true(results); |
475
by Trond Norbye
Use ptr->root->result if the caller didn't provide a result structure to memcached_read_one_response |
1164 |
memcached_result_free(&results_obj); |
1165 |
||
1166 |
/* Don't read out the second result, but issue a set instead.. */
|
|
1167 |
rc= memcached_set(memc, keys[0], lengths[0], keys[0], lengths[0], 0, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1168 |
test_true(rc == MEMCACHED_SUCCESS); |
475
by Trond Norbye
Use ptr->root->result if the caller didn't provide a result structure to memcached_read_one_response |
1169 |
|
1170 |
char *val= memcached_get_by_key(memc, keys[0], lengths[0], "yek", 3, |
|
1171 |
&rlen, &flags, &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1172 |
test_true(val == NULL); |
1173 |
test_true(rc == MEMCACHED_NOTFOUND); |
|
475
by Trond Norbye
Use ptr->root->result if the caller didn't provide a result structure to memcached_read_one_response |
1174 |
val= memcached_get(memc, keys[0], lengths[0], &rlen, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1175 |
test_true(val != NULL); |
1176 |
test_true(rc == MEMCACHED_SUCCESS); |
|
475
by Trond Norbye
Use ptr->root->result if the caller didn't provide a result structure to memcached_read_one_response |
1177 |
free(val); |
1178 |
||
1179 |
return TEST_SUCCESS; |
|
1180 |
}
|
|
1181 |
||
736
by Brian Aker
Updates for CORK. |
1182 |
static test_return_t mget_end(memcached_st *memc) |
578.1.1
by Curtis Hawthorne
Fixed binary mget so that it will always issue a NOOP after every |
1183 |
{
|
582
by Brian Aker
Merge fix for binary mget |
1184 |
const char *keys[]= { "foo", "foo2" }; |
1185 |
size_t lengths[]= { 3, 4 }; |
|
1186 |
const char *values[]= { "fjord", "41" }; |
|
578.1.1
by Curtis Hawthorne
Fixed binary mget so that it will always issue a NOOP after every |
1187 |
|
630
by Brian Aker
Style cleanup |
1188 |
memcached_return_t rc; |
578.1.1
by Curtis Hawthorne
Fixed binary mget so that it will always issue a NOOP after every |
1189 |
|
1190 |
// Set foo and foo2
|
|
582
by Brian Aker
Merge fix for binary mget |
1191 |
for (int i= 0; i < 2; i++) |
578.1.1
by Curtis Hawthorne
Fixed binary mget so that it will always issue a NOOP after every |
1192 |
{
|
1193 |
rc= memcached_set(memc, keys[i], lengths[i], values[i], strlen(values[i]), |
|
1194 |
(time_t)0, (uint32_t)0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1195 |
test_true(rc == MEMCACHED_SUCCESS); |
578.1.1
by Curtis Hawthorne
Fixed binary mget so that it will always issue a NOOP after every |
1196 |
}
|
1197 |
||
1198 |
char *string; |
|
1199 |
size_t string_length; |
|
1200 |
uint32_t flags; |
|
1201 |
||
1202 |
// retrieve both via mget
|
|
1203 |
rc= memcached_mget(memc, keys, lengths, 2); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1204 |
test_true(rc == MEMCACHED_SUCCESS); |
578.1.1
by Curtis Hawthorne
Fixed binary mget so that it will always issue a NOOP after every |
1205 |
|
1206 |
char key[MEMCACHED_MAX_KEY]; |
|
1207 |
size_t key_length; |
|
1208 |
||
1209 |
// this should get both
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1210 |
for (int i = 0; i < 2; i++) |
582
by Brian Aker
Merge fix for binary mget |
1211 |
{
|
1212 |
string= memcached_fetch(memc, key, &key_length, &string_length, |
|
1213 |
&flags, &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1214 |
test_true(rc == MEMCACHED_SUCCESS); |
578.1.1
by Curtis Hawthorne
Fixed binary mget so that it will always issue a NOOP after every |
1215 |
int val = 0; |
582
by Brian Aker
Merge fix for binary mget |
1216 |
if (key_length == 4) |
1217 |
val= 1; |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1218 |
test_true(string_length == strlen(values[val])); |
1219 |
test_true(strncmp(values[val], string, string_length) == 0); |
|
578.1.1
by Curtis Hawthorne
Fixed binary mget so that it will always issue a NOOP after every |
1220 |
free(string); |
1221 |
}
|
|
1222 |
||
1223 |
// this should indicate end
|
|
582
by Brian Aker
Merge fix for binary mget |
1224 |
string= memcached_fetch(memc, key, &key_length, &string_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1225 |
test_true(rc == MEMCACHED_END); |
578.1.1
by Curtis Hawthorne
Fixed binary mget so that it will always issue a NOOP after every |
1226 |
|
1227 |
// now get just one
|
|
1228 |
rc= memcached_mget(memc, keys, lengths, 1); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1229 |
test_true(rc == MEMCACHED_SUCCESS); |
578.1.1
by Curtis Hawthorne
Fixed binary mget so that it will always issue a NOOP after every |
1230 |
|
582
by Brian Aker
Merge fix for binary mget |
1231 |
string= memcached_fetch(memc, key, &key_length, &string_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1232 |
test_true(key_length == lengths[0]); |
1233 |
test_true(strncmp(keys[0], key, key_length) == 0); |
|
1234 |
test_true(string_length == strlen(values[0])); |
|
1235 |
test_true(strncmp(values[0], string, string_length) == 0); |
|
1236 |
test_true(rc == MEMCACHED_SUCCESS); |
|
578.1.1
by Curtis Hawthorne
Fixed binary mget so that it will always issue a NOOP after every |
1237 |
free(string); |
1238 |
||
1239 |
// this should indicate end
|
|
582
by Brian Aker
Merge fix for binary mget |
1240 |
string= memcached_fetch(memc, key, &key_length, &string_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1241 |
test_true(rc == MEMCACHED_END); |
578.1.1
by Curtis Hawthorne
Fixed binary mget so that it will always issue a NOOP after every |
1242 |
|
1243 |
return TEST_SUCCESS; |
|
1244 |
}
|
|
1245 |
||
181
by Brian Aker
Extended tests so that memcached starts up its own tests |
1246 |
/* Do not copy the style of this code, I just access hosts to testthis function */
|
736
by Brian Aker
Updates for CORK. |
1247 |
static test_return_t stats_servername_test(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
1248 |
{
|
630
by Brian Aker
Style cleanup |
1249 |
memcached_return_t rc; |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
1250 |
memcached_stat_st memc_stat; |
794
by Brian Aker
Updating memcached_server_instance_st structure. |
1251 |
memcached_server_instance_st instance= |
792
by Brian Aker
Lots of compiler fixes. |
1252 |
memcached_server_instance_by_position(memc, 0); |
710
by Brian Aker
Fix test cases for encapsulation. |
1253 |
|
800.1.2
by Trond Norbye
Add support for SASL |
1254 |
#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
|
1255 |
if (memcached_get_sasl_callbacks(memc) != NULL) |
|
1256 |
return TEST_SKIPPED; |
|
1257 |
#endif
|
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
1258 |
rc= memcached_stat_servername(&memc_stat, NULL, |
792
by Brian Aker
Lots of compiler fixes. |
1259 |
memcached_server_name(instance), |
1260 |
memcached_server_port(instance)); |
|
147
by Brian Aker
Updating test cases to return true/false |
1261 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1262 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
1263 |
}
|
1264 |
||
736
by Brian Aker
Updates for CORK. |
1265 |
static test_return_t increment_test(memcached_st *memc) |
1266 |
{
|
|
1267 |
uint64_t new_number; |
|
1268 |
memcached_return_t rc; |
|
1269 |
const char *key= "number"; |
|
1270 |
const char *value= "0"; |
|
1271 |
||
1272 |
rc= memcached_set(memc, key, strlen(key), |
|
1273 |
value, strlen(value), |
|
1274 |
(time_t)0, (uint32_t)0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1275 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
1276 |
||
1277 |
rc= memcached_increment(memc, key, strlen(key), |
|
1278 |
1, &new_number); |
|
1279 |
test_true(rc == MEMCACHED_SUCCESS); |
|
1280 |
test_true(new_number == 1); |
|
1281 |
||
1282 |
rc= memcached_increment(memc, key, strlen(key), |
|
1283 |
1, &new_number); |
|
1284 |
test_true(rc == MEMCACHED_SUCCESS); |
|
1285 |
test_true(new_number == 2); |
|
736
by Brian Aker
Updates for CORK. |
1286 |
|
1287 |
return TEST_SUCCESS; |
|
1288 |
}
|
|
1289 |
||
1290 |
static test_return_t increment_with_initial_test(memcached_st *memc) |
|
1291 |
{
|
|
1292 |
if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) != 0) |
|
1293 |
{
|
|
1294 |
uint64_t new_number; |
|
1295 |
memcached_return_t rc; |
|
1296 |
const char *key= "number"; |
|
1297 |
uint64_t initial= 0; |
|
1298 |
||
1299 |
rc= memcached_increment_with_initial(memc, key, strlen(key), |
|
1300 |
1, initial, 0, &new_number); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1301 |
test_true(rc == MEMCACHED_SUCCESS); |
1302 |
test_true(new_number == initial); |
|
736
by Brian Aker
Updates for CORK. |
1303 |
|
1304 |
rc= memcached_increment_with_initial(memc, key, strlen(key), |
|
1305 |
1, initial, 0, &new_number); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1306 |
test_true(rc == MEMCACHED_SUCCESS); |
1307 |
test_true(new_number == (initial + 1)); |
|
736
by Brian Aker
Updates for CORK. |
1308 |
}
|
1309 |
return TEST_SUCCESS; |
|
1310 |
}
|
|
1311 |
||
1312 |
static test_return_t decrement_test(memcached_st *memc) |
|
1313 |
{
|
|
1314 |
uint64_t new_number; |
|
1315 |
memcached_return_t rc; |
|
1316 |
const char *key= "number"; |
|
1317 |
const char *value= "3"; |
|
1318 |
||
1319 |
rc= memcached_set(memc, key, strlen(key), |
|
1320 |
value, strlen(value), |
|
1321 |
(time_t)0, (uint32_t)0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1322 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
1323 |
||
1324 |
rc= memcached_decrement(memc, key, strlen(key), |
|
1325 |
1, &new_number); |
|
1326 |
test_true(rc == MEMCACHED_SUCCESS); |
|
1327 |
test_true(new_number == 2); |
|
1328 |
||
1329 |
rc= memcached_decrement(memc, key, strlen(key), |
|
1330 |
1, &new_number); |
|
1331 |
test_true(rc == MEMCACHED_SUCCESS); |
|
1332 |
test_true(new_number == 1); |
|
736
by Brian Aker
Updates for CORK. |
1333 |
|
1334 |
return TEST_SUCCESS; |
|
1335 |
}
|
|
1336 |
||
1337 |
static test_return_t decrement_with_initial_test(memcached_st *memc) |
|
1338 |
{
|
|
1339 |
if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) != 0) |
|
1340 |
{
|
|
1341 |
uint64_t new_number; |
|
1342 |
memcached_return_t rc; |
|
1343 |
const char *key= "number"; |
|
1344 |
uint64_t initial= 3; |
|
1345 |
||
1346 |
rc= memcached_decrement_with_initial(memc, key, strlen(key), |
|
1347 |
1, initial, 0, &new_number); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1348 |
test_true(rc == MEMCACHED_SUCCESS); |
1349 |
test_true(new_number == initial); |
|
736
by Brian Aker
Updates for CORK. |
1350 |
|
1351 |
rc= memcached_decrement_with_initial(memc, key, strlen(key), |
|
1352 |
1, initial, 0, &new_number); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1353 |
test_true(rc == MEMCACHED_SUCCESS); |
1354 |
test_true(new_number == (initial - 1)); |
|
736
by Brian Aker
Updates for CORK. |
1355 |
}
|
1356 |
return TEST_SUCCESS; |
|
1357 |
}
|
|
1358 |
||
1359 |
static test_return_t increment_by_key_test(memcached_st *memc) |
|
1360 |
{
|
|
1361 |
uint64_t new_number; |
|
1362 |
memcached_return_t rc; |
|
1363 |
const char *master_key= "foo"; |
|
1364 |
const char *key= "number"; |
|
1365 |
const char *value= "0"; |
|
1366 |
||
1367 |
rc= memcached_set_by_key(memc, master_key, strlen(master_key), |
|
1368 |
key, strlen(key), |
|
1369 |
value, strlen(value), |
|
1370 |
(time_t)0, (uint32_t)0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1371 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
1372 |
||
1373 |
rc= memcached_increment_by_key(memc, master_key, strlen(master_key), key, strlen(key), |
|
1374 |
1, &new_number); |
|
1375 |
test_true(rc == MEMCACHED_SUCCESS); |
|
1376 |
test_true(new_number == 1); |
|
1377 |
||
1378 |
rc= memcached_increment_by_key(memc, master_key, strlen(master_key), key, strlen(key), |
|
1379 |
1, &new_number); |
|
1380 |
test_true(rc == MEMCACHED_SUCCESS); |
|
1381 |
test_true(new_number == 2); |
|
736
by Brian Aker
Updates for CORK. |
1382 |
|
1383 |
return TEST_SUCCESS; |
|
1384 |
}
|
|
1385 |
||
1386 |
static test_return_t increment_with_initial_by_key_test(memcached_st *memc) |
|
1387 |
{
|
|
1388 |
if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) != 0) |
|
1389 |
{
|
|
1390 |
uint64_t new_number; |
|
1391 |
memcached_return_t rc; |
|
1392 |
const char *master_key= "foo"; |
|
1393 |
const char *key= "number"; |
|
1394 |
uint64_t initial= 0; |
|
1395 |
||
1396 |
rc= memcached_increment_with_initial_by_key(memc, master_key, strlen(master_key), |
|
1397 |
key, strlen(key), |
|
1398 |
1, initial, 0, &new_number); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1399 |
test_true(rc == MEMCACHED_SUCCESS); |
1400 |
test_true(new_number == initial); |
|
736
by Brian Aker
Updates for CORK. |
1401 |
|
1402 |
rc= memcached_increment_with_initial_by_key(memc, master_key, strlen(master_key), |
|
1403 |
key, strlen(key), |
|
1404 |
1, initial, 0, &new_number); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1405 |
test_true(rc == MEMCACHED_SUCCESS); |
1406 |
test_true(new_number == (initial + 1)); |
|
736
by Brian Aker
Updates for CORK. |
1407 |
}
|
1408 |
return TEST_SUCCESS; |
|
1409 |
}
|
|
1410 |
||
1411 |
static test_return_t decrement_by_key_test(memcached_st *memc) |
|
1412 |
{
|
|
1413 |
uint64_t new_number; |
|
1414 |
memcached_return_t rc; |
|
1415 |
const char *master_key= "foo"; |
|
1416 |
const char *key= "number"; |
|
1417 |
const char *value= "3"; |
|
1418 |
||
1419 |
rc= memcached_set_by_key(memc, master_key, strlen(master_key), |
|
1420 |
key, strlen(key), |
|
1421 |
value, strlen(value), |
|
1422 |
(time_t)0, (uint32_t)0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1423 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
1424 |
||
1425 |
rc= memcached_decrement_by_key(memc, master_key, strlen(master_key), |
|
1426 |
key, strlen(key), |
|
1427 |
1, &new_number); |
|
1428 |
test_true(rc == MEMCACHED_SUCCESS); |
|
1429 |
test_true(new_number == 2); |
|
1430 |
||
1431 |
rc= memcached_decrement_by_key(memc, master_key, strlen(master_key), |
|
1432 |
key, strlen(key), |
|
1433 |
1, &new_number); |
|
1434 |
test_true(rc == MEMCACHED_SUCCESS); |
|
1435 |
test_true(new_number == 1); |
|
736
by Brian Aker
Updates for CORK. |
1436 |
|
1437 |
return TEST_SUCCESS; |
|
1438 |
}
|
|
1439 |
||
1440 |
static test_return_t decrement_with_initial_by_key_test(memcached_st *memc) |
|
1441 |
{
|
|
1442 |
if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) != 0) |
|
1443 |
{
|
|
1444 |
uint64_t new_number; |
|
1445 |
memcached_return_t rc; |
|
1446 |
const char *master_key= "foo"; |
|
1447 |
const char *key= "number"; |
|
1448 |
uint64_t initial= 3; |
|
1449 |
||
1450 |
rc= memcached_decrement_with_initial_by_key(memc, master_key, strlen(master_key), |
|
1451 |
key, strlen(key), |
|
1452 |
1, initial, 0, &new_number); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1453 |
test_true(rc == MEMCACHED_SUCCESS); |
1454 |
test_true(new_number == initial); |
|
736
by Brian Aker
Updates for CORK. |
1455 |
|
1456 |
rc= memcached_decrement_with_initial_by_key(memc, master_key, strlen(master_key), |
|
1457 |
key, strlen(key), |
|
1458 |
1, initial, 0, &new_number); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1459 |
test_true(rc == MEMCACHED_SUCCESS); |
1460 |
test_true(new_number == (initial - 1)); |
|
736
by Brian Aker
Updates for CORK. |
1461 |
}
|
1462 |
return TEST_SUCCESS; |
|
1463 |
}
|
|
1464 |
||
1465 |
static test_return_t quit_test(memcached_st *memc) |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1466 |
{
|
630
by Brian Aker
Style cleanup |
1467 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
1468 |
const char *key= "fudge"; |
1469 |
const char *value= "sanford and sun"; |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1470 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1471 |
rc= memcached_set(memc, key, strlen(key), |
143
by Brian Aker
Refactored out actual test code from test.c |
1472 |
value, strlen(value), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
1473 |
(time_t)10, (uint32_t)3); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1474 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
143
by Brian Aker
Refactored out actual test code from test.c |
1475 |
memcached_quit(memc); |
1476 |
||
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1477 |
rc= memcached_set(memc, key, strlen(key), |
143
by Brian Aker
Refactored out actual test code from test.c |
1478 |
value, strlen(value), |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
1479 |
(time_t)50, (uint32_t)9); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1480 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
147
by Brian Aker
Updating test cases to return true/false |
1481 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1482 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
1483 |
}
|
1484 |
||
736
by Brian Aker
Updates for CORK. |
1485 |
static test_return_t mget_result_test(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
1486 |
{
|
630
by Brian Aker
Style cleanup |
1487 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
1488 |
const char *keys[]= {"fudge", "son", "food"}; |
143
by Brian Aker
Refactored out actual test code from test.c |
1489 |
size_t key_length[]= {5, 3, 4}; |
1490 |
unsigned int x; |
|
1491 |
||
1492 |
memcached_result_st results_obj; |
|
1493 |
memcached_result_st *results; |
|
1494 |
||
1495 |
results= memcached_result_create(memc, &results_obj); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1496 |
test_true(results); |
1497 |
test_true(&results_obj == results); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1498 |
|
1499 |
/* We need to empty the server before continueing test */
|
|
1500 |
rc= memcached_flush(memc, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1501 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
1502 |
|
1503 |
rc= memcached_mget(memc, keys, key_length, 3); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1504 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
1505 |
|
1506 |
while ((results= memcached_fetch_result(memc, &results_obj, &rc)) != NULL) |
|
1507 |
{
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1508 |
test_true(results); |
143
by Brian Aker
Refactored out actual test code from test.c |
1509 |
}
|
178
by Brian Aker
Bugfix for memcached_connect() so that it will not always start up servers. |
1510 |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1511 |
while ((results= memcached_fetch_result(memc, &results_obj, &rc)) != NULL) |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1512 |
test_true(!results); |
1513 |
test_true(rc == MEMCACHED_END); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1514 |
|
1515 |
for (x= 0; x < 3; x++) |
|
1516 |
{
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1517 |
rc= memcached_set(memc, keys[x], key_length[x], |
143
by Brian Aker
Refactored out actual test code from test.c |
1518 |
keys[x], key_length[x], |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
1519 |
(time_t)50, (uint32_t)9); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1520 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
143
by Brian Aker
Refactored out actual test code from test.c |
1521 |
}
|
1522 |
||
1523 |
rc= memcached_mget(memc, keys, key_length, 3); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1524 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
1525 |
|
1526 |
while ((results= memcached_fetch_result(memc, &results_obj, &rc))) |
|
1527 |
{
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1528 |
test_true(results); |
1529 |
test_true(&results_obj == results); |
|
1530 |
test_true(rc == MEMCACHED_SUCCESS); |
|
1531 |
test_true(memcached_result_key_length(results) == memcached_result_length(results)); |
|
1532 |
test_true(!memcmp(memcached_result_key_value(results), |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1533 |
memcached_result_value(results), |
143
by Brian Aker
Refactored out actual test code from test.c |
1534 |
memcached_result_length(results))); |
1535 |
}
|
|
1536 |
||
1537 |
memcached_result_free(&results_obj); |
|
147
by Brian Aker
Updating test cases to return true/false |
1538 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1539 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
1540 |
}
|
1541 |
||
736
by Brian Aker
Updates for CORK. |
1542 |
static test_return_t mget_result_alloc_test(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
1543 |
{
|
630
by Brian Aker
Style cleanup |
1544 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
1545 |
const char *keys[]= {"fudge", "son", "food"}; |
143
by Brian Aker
Refactored out actual test code from test.c |
1546 |
size_t key_length[]= {5, 3, 4}; |
1547 |
unsigned int x; |
|
1548 |
||
1549 |
memcached_result_st *results; |
|
1550 |
||
1551 |
/* We need to empty the server before continueing test */
|
|
1552 |
rc= memcached_flush(memc, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1553 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
1554 |
|
1555 |
rc= memcached_mget(memc, keys, key_length, 3); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1556 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
1557 |
|
1558 |
while ((results= memcached_fetch_result(memc, NULL, &rc)) != NULL) |
|
1559 |
{
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1560 |
test_true(results); |
143
by Brian Aker
Refactored out actual test code from test.c |
1561 |
}
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1562 |
test_true(!results); |
1563 |
test_true(rc == MEMCACHED_END); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1564 |
|
1565 |
for (x= 0; x < 3; x++) |
|
1566 |
{
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1567 |
rc= memcached_set(memc, keys[x], key_length[x], |
143
by Brian Aker
Refactored out actual test code from test.c |
1568 |
keys[x], key_length[x], |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
1569 |
(time_t)50, (uint32_t)9); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1570 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
143
by Brian Aker
Refactored out actual test code from test.c |
1571 |
}
|
1572 |
||
1573 |
rc= memcached_mget(memc, keys, key_length, 3); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1574 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
1575 |
|
1576 |
x= 0; |
|
1577 |
while ((results= memcached_fetch_result(memc, NULL, &rc))) |
|
1578 |
{
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1579 |
test_true(results); |
1580 |
test_true(rc == MEMCACHED_SUCCESS); |
|
1581 |
test_true(memcached_result_key_length(results) == memcached_result_length(results)); |
|
1582 |
test_true(!memcmp(memcached_result_key_value(results), |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1583 |
memcached_result_value(results), |
143
by Brian Aker
Refactored out actual test code from test.c |
1584 |
memcached_result_length(results))); |
1585 |
memcached_result_free(results); |
|
1586 |
x++; |
|
1587 |
}
|
|
147
by Brian Aker
Updating test cases to return true/false |
1588 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1589 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
1590 |
}
|
1591 |
||
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
1592 |
/* Count the results */
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
1593 |
static memcached_return_t callback_counter(const memcached_st *ptr, |
1594 |
memcached_result_st *result, |
|
632
by Brian Aker
Update for test system. |
1595 |
void *context) |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
1596 |
{
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
1597 |
(void)ptr; (void)result; |
715
by Brian Aker
Fix for bug #15450 |
1598 |
size_t *counter= (size_t *)context; |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
1599 |
|
1600 |
*counter= *counter + 1; |
|
1601 |
||
377
by brian@gir-3.local
Cleanup warnings/found issue in store by key functions. |
1602 |
return MEMCACHED_SUCCESS; |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
1603 |
}
|
1604 |
||
736
by Brian Aker
Updates for CORK. |
1605 |
static test_return_t mget_result_function(memcached_st *memc) |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
1606 |
{
|
630
by Brian Aker
Style cleanup |
1607 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
1608 |
const char *keys[]= {"fudge", "son", "food"}; |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
1609 |
size_t key_length[]= {5, 3, 4}; |
1610 |
unsigned int x; |
|
715
by Brian Aker
Fix for bug #15450 |
1611 |
size_t counter; |
630
by Brian Aker
Style cleanup |
1612 |
memcached_execute_fn callbacks[1]; |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
1613 |
|
1614 |
/* We need to empty the server before continueing test */
|
|
1615 |
rc= memcached_flush(memc, 0); |
|
1616 |
for (x= 0; x < 3; x++) |
|
1617 |
{
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1618 |
rc= memcached_set(memc, keys[x], key_length[x], |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
1619 |
keys[x], key_length[x], |
1620 |
(time_t)50, (uint32_t)9); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1621 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
1622 |
}
|
1623 |
||
1624 |
rc= memcached_mget(memc, keys, key_length, 3); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1625 |
test_true(rc == MEMCACHED_SUCCESS); |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
1626 |
|
1627 |
callbacks[0]= &callback_counter; |
|
1628 |
counter= 0; |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1629 |
rc= memcached_fetch_execute(memc, callbacks, (void *)&counter, 1); |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
1630 |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1631 |
test_true(counter == 3); |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
1632 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1633 |
return TEST_SUCCESS; |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
1634 |
}
|
1635 |
||
736
by Brian Aker
Updates for CORK. |
1636 |
static test_return_t mget_test(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
1637 |
{
|
630
by Brian Aker
Style cleanup |
1638 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
1639 |
const char *keys[]= {"fudge", "son", "food"}; |
143
by Brian Aker
Refactored out actual test code from test.c |
1640 |
size_t key_length[]= {5, 3, 4}; |
1641 |
unsigned int x; |
|
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
1642 |
uint32_t flags; |
143
by Brian Aker
Refactored out actual test code from test.c |
1643 |
|
1644 |
char return_key[MEMCACHED_MAX_KEY]; |
|
1645 |
size_t return_key_length; |
|
1646 |
char *return_value; |
|
1647 |
size_t return_value_length; |
|
1648 |
||
1649 |
/* We need to empty the server before continueing test */
|
|
1650 |
rc= memcached_flush(memc, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1651 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
1652 |
|
1653 |
rc= memcached_mget(memc, keys, key_length, 3); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1654 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
1655 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1656 |
while ((return_value= memcached_fetch(memc, return_key, &return_key_length, |
143
by Brian Aker
Refactored out actual test code from test.c |
1657 |
&return_value_length, &flags, &rc)) != NULL) |
1658 |
{
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1659 |
test_true(return_value); |
143
by Brian Aker
Refactored out actual test code from test.c |
1660 |
}
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1661 |
test_true(!return_value); |
1662 |
test_true(return_value_length == 0); |
|
1663 |
test_true(rc == MEMCACHED_END); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1664 |
|
1665 |
for (x= 0; x < 3; x++) |
|
1666 |
{
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1667 |
rc= memcached_set(memc, keys[x], key_length[x], |
143
by Brian Aker
Refactored out actual test code from test.c |
1668 |
keys[x], key_length[x], |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
1669 |
(time_t)50, (uint32_t)9); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1670 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
143
by Brian Aker
Refactored out actual test code from test.c |
1671 |
}
|
1672 |
||
1673 |
rc= memcached_mget(memc, keys, key_length, 3); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1674 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
1675 |
|
1676 |
x= 0; |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1677 |
while ((return_value= memcached_fetch(memc, return_key, &return_key_length, |
143
by Brian Aker
Refactored out actual test code from test.c |
1678 |
&return_value_length, &flags, &rc))) |
1679 |
{
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1680 |
test_true(return_value); |
1681 |
test_true(rc == MEMCACHED_SUCCESS); |
|
1682 |
test_true(return_key_length == return_value_length); |
|
1683 |
test_true(!memcmp(return_value, return_key, return_value_length)); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1684 |
free(return_value); |
1685 |
x++; |
|
1686 |
}
|
|
147
by Brian Aker
Updating test cases to return true/false |
1687 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1688 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
1689 |
}
|
1690 |
||
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1691 |
static test_return_t mget_execute(memcached_st *memc) |
1692 |
{
|
|
1693 |
bool binary= false; |
|
715
by Brian Aker
Fix for bug #15450 |
1694 |
|
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1695 |
if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) != 0) |
1696 |
binary= true; |
|
1697 |
||
1698 |
/*
|
|
1699 |
* I only want to hit _one_ server so I know the number of requests I'm
|
|
1700 |
* sending in the pipeline.
|
|
1701 |
*/
|
|
1702 |
uint32_t number_of_hosts= memc->number_of_hosts; |
|
1703 |
memc->number_of_hosts= 1; |
|
1704 |
||
834
by Brian Aker
Small updates/wins around non-block IO |
1705 |
size_t max_keys= 20480; |
715
by Brian Aker
Fix for bug #15450 |
1706 |
|
1707 |
||
1708 |
char **keys= calloc(max_keys, sizeof(char*)); |
|
1709 |
size_t *key_length=calloc(max_keys, sizeof(size_t)); |
|
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1710 |
|
1711 |
/* First add all of the items.. */
|
|
1712 |
char blob[1024] = {0}; |
|
630
by Brian Aker
Style cleanup |
1713 |
memcached_return_t rc; |
834
by Brian Aker
Small updates/wins around non-block IO |
1714 |
|
715
by Brian Aker
Fix for bug #15450 |
1715 |
for (size_t x= 0; x < max_keys; ++x) |
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1716 |
{
|
1717 |
char k[251]; |
|
715
by Brian Aker
Fix for bug #15450 |
1718 |
|
903.1.8
by Brian Aker
Cleanup test failures. |
1719 |
key_length[x]= (size_t)snprintf(k, sizeof(k), "0200%lu", (unsigned long)x); |
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1720 |
keys[x]= strdup(k); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1721 |
test_true(keys[x] != NULL); |
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1722 |
rc= memcached_add(memc, keys[x], key_length[x], blob, sizeof(blob), 0, 0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1723 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1724 |
}
|
1725 |
||
1726 |
/* Try to get all of them with a large multiget */
|
|
715
by Brian Aker
Fix for bug #15450 |
1727 |
size_t counter= 0; |
630
by Brian Aker
Style cleanup |
1728 |
memcached_execute_fn callbacks[1]= { [0]= &callback_counter }; |
603.1.7
by Trond Norbye
Refactor: memcached_mget_execute -> memcached_mget_execute_by_key |
1729 |
rc= memcached_mget_execute(memc, (const char**)keys, key_length, |
715
by Brian Aker
Fix for bug #15450 |
1730 |
max_keys, callbacks, &counter, 1); |
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1731 |
|
834
by Brian Aker
Small updates/wins around non-block IO |
1732 |
if (rc == MEMCACHED_SUCCESS) |
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1733 |
{
|
834
by Brian Aker
Small updates/wins around non-block IO |
1734 |
test_true(binary); |
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1735 |
rc= memcached_fetch_execute(memc, callbacks, (void *)&counter, 1); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1736 |
test_true(rc == MEMCACHED_END); |
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1737 |
|
1738 |
/* Verify that we got all of the items */
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1739 |
test_true(counter == max_keys); |
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1740 |
}
|
834
by Brian Aker
Small updates/wins around non-block IO |
1741 |
else if (rc == MEMCACHED_NOT_SUPPORTED) |
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1742 |
{
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1743 |
test_true(counter == 0); |
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1744 |
}
|
834
by Brian Aker
Small updates/wins around non-block IO |
1745 |
else
|
1746 |
{
|
|
1747 |
test_fail("note: this test functions differently when in binary mode"); |
|
1748 |
}
|
|
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1749 |
|
1750 |
/* Release all allocated resources */
|
|
715
by Brian Aker
Fix for bug #15450 |
1751 |
for (size_t x= 0; x < max_keys; ++x) |
1752 |
{
|
|
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1753 |
free(keys[x]); |
715
by Brian Aker
Fix for bug #15450 |
1754 |
}
|
603.1.1
by Trond Norbye
Initial implementation of memcached_mget_execute |
1755 |
free(keys); |
1756 |
free(key_length); |
|
1757 |
||
1758 |
memc->number_of_hosts= number_of_hosts; |
|
1759 |
return TEST_SUCCESS; |
|
1760 |
}
|
|
1761 |
||
834
by Brian Aker
Small updates/wins around non-block IO |
1762 |
#define REGRESSION_BINARY_VS_BLOCK_COUNT 20480
|
1763 |
||
1764 |
static test_return_t key_setup(memcached_st *memc) |
|
1765 |
{
|
|
1766 |
(void)memc; |
|
1767 |
||
1768 |
if (pre_binary(memc) != TEST_SUCCESS) |
|
1769 |
return TEST_SKIPPED; |
|
1770 |
||
1771 |
global_pairs= pairs_generate(REGRESSION_BINARY_VS_BLOCK_COUNT, 0); |
|
1772 |
||
1773 |
return TEST_SUCCESS; |
|
1774 |
}
|
|
1775 |
||
1776 |
static test_return_t key_teardown(memcached_st *memc) |
|
1777 |
{
|
|
1778 |
(void)memc; |
|
1779 |
pairs_free(global_pairs); |
|
1780 |
||
1781 |
return TEST_SUCCESS; |
|
1782 |
}
|
|
1783 |
||
1784 |
static test_return_t block_add_regression(memcached_st *memc) |
|
1785 |
{
|
|
1786 |
/* First add all of the items.. */
|
|
1787 |
for (size_t x= 0; x < REGRESSION_BINARY_VS_BLOCK_COUNT; ++x) |
|
1788 |
{
|
|
1789 |
memcached_return_t rc; |
|
1790 |
char blob[1024] = {0}; |
|
1791 |
||
1792 |
rc= memcached_add_by_key(memc, "bob", 3, global_pairs[x].key, global_pairs[x].key_length, blob, sizeof(blob), 0, 0); |
|
1793 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
|
1794 |
}
|
|
1795 |
||
1796 |
return TEST_SUCCESS; |
|
1797 |
}
|
|
1798 |
||
1799 |
static test_return_t binary_add_regression(memcached_st *memc) |
|
1800 |
{
|
|
1801 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1); |
|
1802 |
test_return_t rc= block_add_regression(memc); |
|
1803 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 0); |
|
1804 |
return rc; |
|
1805 |
}
|
|
1806 |
||
736
by Brian Aker
Updates for CORK. |
1807 |
static test_return_t get_stats_keys(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
1808 |
{
|
632
by Brian Aker
Update for test system. |
1809 |
char **stat_list; |
143
by Brian Aker
Refactored out actual test code from test.c |
1810 |
char **ptr; |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
1811 |
memcached_stat_st memc_stat; |
630
by Brian Aker
Style cleanup |
1812 |
memcached_return_t rc; |
143
by Brian Aker
Refactored out actual test code from test.c |
1813 |
|
632
by Brian Aker
Update for test system. |
1814 |
stat_list= memcached_stat_get_keys(memc, &memc_stat, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1815 |
test_true(rc == MEMCACHED_SUCCESS); |
632
by Brian Aker
Update for test system. |
1816 |
for (ptr= stat_list; *ptr; ptr++) |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1817 |
test_true(*ptr); |
143
by Brian Aker
Refactored out actual test code from test.c |
1818 |
|
632
by Brian Aker
Update for test system. |
1819 |
free(stat_list); |
147
by Brian Aker
Updating test cases to return true/false |
1820 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1821 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
1822 |
}
|
1823 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
1824 |
static test_return_t version_string_test(memcached_st *memc) |
268
by patg@patg.net
Working on getting version patch working |
1825 |
{
|
1826 |
const char *version_string; |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
1827 |
(void)memc; |
267.1.9
by brian@gir.tangent.org
Fixed bug found by Evan Weaver where increment was not returning propper error |
1828 |
|
268
by patg@patg.net
Working on getting version patch working |
1829 |
version_string= memcached_lib_version(); |
267.1.9
by brian@gir.tangent.org
Fixed bug found by Evan Weaver where increment was not returning propper error |
1830 |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1831 |
test_true(!strcmp(version_string, LIBMEMCACHED_VERSION_STRING)); |
267.1.9
by brian@gir.tangent.org
Fixed bug found by Evan Weaver where increment was not returning propper error |
1832 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1833 |
return TEST_SUCCESS; |
268
by patg@patg.net
Working on getting version patch working |
1834 |
}
|
1835 |
||
736
by Brian Aker
Updates for CORK. |
1836 |
static test_return_t get_stats(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
1837 |
{
|
632
by Brian Aker
Update for test system. |
1838 |
char **stat_list; |
143
by Brian Aker
Refactored out actual test code from test.c |
1839 |
char **ptr; |
630
by Brian Aker
Style cleanup |
1840 |
memcached_return_t rc; |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
1841 |
memcached_stat_st *memc_stat; |
1842 |
||
1843 |
memc_stat= memcached_stat(memc, NULL, &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1844 |
test_true(rc == MEMCACHED_SUCCESS); |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
1845 |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1846 |
test_true(rc == MEMCACHED_SUCCESS); |
1847 |
test_true(memc_stat); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1848 |
|
750
by Brian Aker
Fix for issue where stats may not be initialized. |
1849 |
for (uint32_t x= 0; x < memcached_server_count(memc); x++) |
143
by Brian Aker
Refactored out actual test code from test.c |
1850 |
{
|
632
by Brian Aker
Update for test system. |
1851 |
stat_list= memcached_stat_get_keys(memc, memc_stat+x, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1852 |
test_true(rc == MEMCACHED_SUCCESS); |
632
by Brian Aker
Update for test system. |
1853 |
for (ptr= stat_list; *ptr; ptr++); |
143
by Brian Aker
Refactored out actual test code from test.c |
1854 |
|
632
by Brian Aker
Update for test system. |
1855 |
free(stat_list); |
143
by Brian Aker
Refactored out actual test code from test.c |
1856 |
}
|
1857 |
||
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
1858 |
memcached_stat_free(NULL, memc_stat); |
147
by Brian Aker
Updating test cases to return true/false |
1859 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1860 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
1861 |
}
|
1862 |
||
736
by Brian Aker
Updates for CORK. |
1863 |
static test_return_t add_host_test(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
1864 |
{
|
1865 |
unsigned int x; |
|
1866 |
memcached_server_st *servers; |
|
630
by Brian Aker
Style cleanup |
1867 |
memcached_return_t rc; |
143
by Brian Aker
Refactored out actual test code from test.c |
1868 |
char servername[]= "0.example.com"; |
1869 |
||
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
1870 |
servers= memcached_server_list_append_with_weight(NULL, servername, 400, 0, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1871 |
test_true(servers); |
1872 |
test_true(1 == memcached_server_list_count(servers)); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1873 |
|
1874 |
for (x= 2; x < 20; x++) |
|
1875 |
{
|
|
1876 |
char buffer[SMALL_STRING_LEN]; |
|
1877 |
||
1878 |
snprintf(buffer, SMALL_STRING_LEN, "%u.example.com", 400+x); |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
1879 |
servers= memcached_server_list_append_with_weight(servers, buffer, 401, 0, |
143
by Brian Aker
Refactored out actual test code from test.c |
1880 |
&rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1881 |
test_true(rc == MEMCACHED_SUCCESS); |
1882 |
test_true(x == memcached_server_list_count(servers)); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1883 |
}
|
1884 |
||
1885 |
rc= memcached_server_push(memc, servers); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1886 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
1887 |
rc= memcached_server_push(memc, servers); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1888 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
1889 |
|
1890 |
memcached_server_list_free(servers); |
|
147
by Brian Aker
Updating test cases to return true/false |
1891 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1892 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
1893 |
}
|
1894 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
1895 |
static memcached_return_t clone_test_callback(memcached_st *parent, memcached_st *memc_clone) |
377
by brian@gir-3.local
Cleanup warnings/found issue in store by key functions. |
1896 |
{
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
1897 |
(void)parent;(void)memc_clone; |
377
by brian@gir-3.local
Cleanup warnings/found issue in store by key functions. |
1898 |
return MEMCACHED_SUCCESS; |
1899 |
}
|
|
1900 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
1901 |
static memcached_return_t cleanup_test_callback(memcached_st *ptr) |
377
by brian@gir-3.local
Cleanup warnings/found issue in store by key functions. |
1902 |
{
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
1903 |
(void)ptr; |
377
by brian@gir-3.local
Cleanup warnings/found issue in store by key functions. |
1904 |
return MEMCACHED_SUCCESS; |
1905 |
}
|
|
1906 |
||
736
by Brian Aker
Updates for CORK. |
1907 |
static test_return_t callback_test(memcached_st *memc) |
265
by brian@gir.local
This patch includes all of the callback work for setting clone() and cleanup() |
1908 |
{
|
1909 |
/* Test User Data */
|
|
1910 |
{
|
|
1911 |
int x= 5; |
|
1912 |
int *test_ptr; |
|
630
by Brian Aker
Style cleanup |
1913 |
memcached_return_t rc; |
265
by brian@gir.local
This patch includes all of the callback work for setting clone() and cleanup() |
1914 |
|
1915 |
rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_USER_DATA, &x); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1916 |
test_true(rc == MEMCACHED_SUCCESS); |
265
by brian@gir.local
This patch includes all of the callback work for setting clone() and cleanup() |
1917 |
test_ptr= (int *)memcached_callback_get(memc, MEMCACHED_CALLBACK_USER_DATA, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1918 |
test_true(*test_ptr == x); |
265
by brian@gir.local
This patch includes all of the callback work for setting clone() and cleanup() |
1919 |
}
|
1920 |
||
1921 |
/* Test Clone Callback */
|
|
1922 |
{
|
|
630
by Brian Aker
Style cleanup |
1923 |
memcached_clone_fn clone_cb= (memcached_clone_fn)clone_test_callback; |
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
1924 |
void *clone_cb_ptr= *(void **)&clone_cb; |
1925 |
void *temp_function= NULL; |
|
630
by Brian Aker
Style cleanup |
1926 |
memcached_return_t rc; |
265
by brian@gir.local
This patch includes all of the callback work for setting clone() and cleanup() |
1927 |
|
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
1928 |
rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_CLONE_FUNCTION, |
1929 |
clone_cb_ptr); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1930 |
test_true(rc == MEMCACHED_SUCCESS); |
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
1931 |
temp_function= memcached_callback_get(memc, MEMCACHED_CALLBACK_CLONE_FUNCTION, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1932 |
test_true(temp_function == clone_cb_ptr); |
265
by brian@gir.local
This patch includes all of the callback work for setting clone() and cleanup() |
1933 |
}
|
1934 |
||
1935 |
/* Test Cleanup Callback */
|
|
1936 |
{
|
|
630
by Brian Aker
Style cleanup |
1937 |
memcached_cleanup_fn cleanup_cb= |
1938 |
(memcached_cleanup_fn)cleanup_test_callback; |
|
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
1939 |
void *cleanup_cb_ptr= *(void **)&cleanup_cb; |
1940 |
void *temp_function= NULL; |
|
630
by Brian Aker
Style cleanup |
1941 |
memcached_return_t rc; |
265
by brian@gir.local
This patch includes all of the callback work for setting clone() and cleanup() |
1942 |
|
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
1943 |
rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_CLONE_FUNCTION, |
1944 |
cleanup_cb_ptr); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1945 |
test_true(rc == MEMCACHED_SUCCESS); |
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
1946 |
temp_function= memcached_callback_get(memc, MEMCACHED_CALLBACK_CLONE_FUNCTION, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1947 |
test_true(temp_function == cleanup_cb_ptr); |
265
by brian@gir.local
This patch includes all of the callback work for setting clone() and cleanup() |
1948 |
}
|
1949 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
1950 |
return TEST_SUCCESS; |
265
by brian@gir.local
This patch includes all of the callback work for setting clone() and cleanup() |
1951 |
}
|
1952 |
||
143
by Brian Aker
Refactored out actual test code from test.c |
1953 |
/* We don't test the behavior itself, we test the switches */
|
736
by Brian Aker
Updates for CORK. |
1954 |
static test_return_t behavior_test(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
1955 |
{
|
367
by Brian Aker
Fixed udp warnings. |
1956 |
uint64_t value; |
1957 |
uint32_t set= 1; |
|
143
by Brian Aker
Refactored out actual test code from test.c |
1958 |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
1959 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, set); |
143
by Brian Aker
Refactored out actual test code from test.c |
1960 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1961 |
test_true(value == 1); |
143
by Brian Aker
Refactored out actual test code from test.c |
1962 |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
1963 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, set); |
143
by Brian Aker
Refactored out actual test code from test.c |
1964 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1965 |
test_true(value == 1); |
143
by Brian Aker
Refactored out actual test code from test.c |
1966 |
|
1967 |
set= MEMCACHED_HASH_MD5; |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
1968 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, set); |
143
by Brian Aker
Refactored out actual test code from test.c |
1969 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_HASH); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1970 |
test_true(value == MEMCACHED_HASH_MD5); |
143
by Brian Aker
Refactored out actual test code from test.c |
1971 |
|
1972 |
set= 0; |
|
1973 |
||
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
1974 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, set); |
143
by Brian Aker
Refactored out actual test code from test.c |
1975 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NO_BLOCK); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1976 |
test_true(value == 0); |
143
by Brian Aker
Refactored out actual test code from test.c |
1977 |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
1978 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, set); |
143
by Brian Aker
Refactored out actual test code from test.c |
1979 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1980 |
test_true(value == 0); |
143
by Brian Aker
Refactored out actual test code from test.c |
1981 |
|
1982 |
set= MEMCACHED_HASH_DEFAULT; |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
1983 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, set); |
143
by Brian Aker
Refactored out actual test code from test.c |
1984 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_HASH); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1985 |
test_true(value == MEMCACHED_HASH_DEFAULT); |
143
by Brian Aker
Refactored out actual test code from test.c |
1986 |
|
1987 |
set= MEMCACHED_HASH_CRC; |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
1988 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, set); |
143
by Brian Aker
Refactored out actual test code from test.c |
1989 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_HASH); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1990 |
test_true(value == MEMCACHED_HASH_CRC); |
143
by Brian Aker
Refactored out actual test code from test.c |
1991 |
|
1992 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1993 |
test_true(value > 0); |
143
by Brian Aker
Refactored out actual test code from test.c |
1994 |
|
1995 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
1996 |
test_true(value > 0); |
147
by Brian Aker
Updating test cases to return true/false |
1997 |
|
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
1998 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS); |
1999 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, value + 1); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2000 |
test_true((value + 1) == memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS)); |
651
by Brian Aker
ICC and test fix. |
2001 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2002 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
2003 |
}
|
2004 |
||
735
by Brian Aker
Merge Thomason's cork patch. |
2005 |
static test_return_t MEMCACHED_BEHAVIOR_CORK_test(memcached_st *memc) |
2006 |
{
|
|
2007 |
memcached_return_t rc; |
|
2008 |
bool set= true; |
|
2009 |
bool value; |
|
2010 |
||
2011 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_CORK, set); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2012 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_NOT_SUPPORTED); |
735
by Brian Aker
Merge Thomason's cork patch. |
2013 |
|
2014 |
value= (bool)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_CORK); |
|
736
by Brian Aker
Updates for CORK. |
2015 |
|
2016 |
if (rc == MEMCACHED_SUCCESS) |
|
2017 |
{
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2018 |
test_true((bool)value == set); |
736
by Brian Aker
Updates for CORK. |
2019 |
}
|
2020 |
else
|
|
2021 |
{
|
|
2022 |
test_false((bool)value == set); |
|
2023 |
}
|
|
735
by Brian Aker
Merge Thomason's cork patch. |
2024 |
|
2025 |
return TEST_SUCCESS; |
|
2026 |
}
|
|
2027 |
||
821
by Brian Aker
Merge Andre |
2028 |
|
2029 |
static test_return_t MEMCACHED_BEHAVIOR_TCP_KEEPALIVE_test(memcached_st *memc) |
|
2030 |
{
|
|
2031 |
memcached_return_t rc; |
|
2032 |
bool set= true; |
|
2033 |
bool value; |
|
2034 |
||
2035 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_KEEPALIVE, set); |
|
2036 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_NOT_SUPPORTED); |
|
2037 |
||
2038 |
value= (bool)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_TCP_KEEPALIVE); |
|
2039 |
||
2040 |
if (rc == MEMCACHED_SUCCESS) |
|
2041 |
{
|
|
2042 |
test_true((bool)value == set); |
|
2043 |
}
|
|
2044 |
else
|
|
2045 |
{
|
|
2046 |
test_false((bool)value == set); |
|
2047 |
}
|
|
2048 |
||
2049 |
return TEST_SUCCESS; |
|
2050 |
}
|
|
2051 |
||
2052 |
||
2053 |
static test_return_t MEMCACHED_BEHAVIOR_TCP_KEEPIDLE_test(memcached_st *memc) |
|
2054 |
{
|
|
2055 |
memcached_return_t rc; |
|
2056 |
bool set= true; |
|
2057 |
bool value; |
|
2058 |
||
2059 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_KEEPIDLE, set); |
|
2060 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_NOT_SUPPORTED); |
|
2061 |
||
2062 |
value= (bool)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_TCP_KEEPIDLE); |
|
2063 |
||
2064 |
if (rc == MEMCACHED_SUCCESS) |
|
2065 |
{
|
|
2066 |
test_true((bool)value == set); |
|
2067 |
}
|
|
2068 |
else
|
|
2069 |
{
|
|
2070 |
test_false((bool)value == set); |
|
2071 |
}
|
|
2072 |
||
2073 |
return TEST_SUCCESS; |
|
2074 |
}
|
|
2075 |
||
905.1.9
by Brian Aker
Merge in additional checks on tests. |
2076 |
static test_return_t fetch_all_results(memcached_st *memc, size_t *keys_returned) |
596
by Brian Aker
Merge in Adam's bug case. |
2077 |
{
|
630
by Brian Aker
Style cleanup |
2078 |
memcached_return_t rc= MEMCACHED_SUCCESS; |
580.2.4
by Adam Thomason
Factor out fetch-all-requests code marked "Turn this into a help function" into fetch_all_results help function |
2079 |
char return_key[MEMCACHED_MAX_KEY]; |
2080 |
size_t return_key_length; |
|
2081 |
char *return_value; |
|
2082 |
size_t return_value_length; |
|
2083 |
uint32_t flags; |
|
2084 |
||
905.1.9
by Brian Aker
Merge in additional checks on tests. |
2085 |
*keys_returned= 0; |
2086 |
||
598.1.1
by Trond Norbye
Bug #446766: OSX hangs on user_supplied_bug21 |
2087 |
while ((return_value= memcached_fetch(memc, return_key, &return_key_length, |
580.2.4
by Adam Thomason
Factor out fetch-all-requests code marked "Turn this into a help function" into fetch_all_results help function |
2088 |
&return_value_length, &flags, &rc))) |
2089 |
{
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2090 |
test_true(return_value); |
2091 |
test_true(rc == MEMCACHED_SUCCESS); |
|
580.2.4
by Adam Thomason
Factor out fetch-all-requests code marked "Turn this into a help function" into fetch_all_results help function |
2092 |
free(return_value); |
905.1.9
by Brian Aker
Merge in additional checks on tests. |
2093 |
*keys_returned= *keys_returned +1; |
580.2.4
by Adam Thomason
Factor out fetch-all-requests code marked "Turn this into a help function" into fetch_all_results help function |
2094 |
}
|
596
by Brian Aker
Merge in Adam's bug case. |
2095 |
|
903.1.8
by Brian Aker
Cleanup test failures. |
2096 |
test_true_got(rc == MEMCACHED_END || rc == MEMCACHED_SUCCESS, memcached_strerror(NULL, rc)); |
2097 |
||
2098 |
return TEST_SUCCESS; |
|
580.2.4
by Adam Thomason
Factor out fetch-all-requests code marked "Turn this into a help function" into fetch_all_results help function |
2099 |
}
|
2100 |
||
143
by Brian Aker
Refactored out actual test code from test.c |
2101 |
/* Test case provided by Cal Haldenbrand */
|
736
by Brian Aker
Updates for CORK. |
2102 |
static test_return_t user_supplied_bug1(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
2103 |
{
|
2104 |
unsigned int setter= 1; |
|
2105 |
||
2106 |
unsigned long long total= 0; |
|
377
by brian@gir-3.local
Cleanup warnings/found issue in store by key functions. |
2107 |
uint32_t size= 0; |
143
by Brian Aker
Refactored out actual test code from test.c |
2108 |
char key[10]; |
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2109 |
char randomstuff[6 * 1024]; |
630
by Brian Aker
Style cleanup |
2110 |
memcached_return_t rc; |
143
by Brian Aker
Refactored out actual test code from test.c |
2111 |
|
2112 |
memset(randomstuff, 0, 6 * 1024); |
|
2113 |
||
2114 |
/* We just keep looking at the same values over and over */
|
|
2115 |
srandom(10); |
|
2116 |
||
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
2117 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, setter); |
2118 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, setter); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
2119 |
|
2120 |
||
2121 |
/* add key */
|
|
728
by Brian Aker
Small icc repairs. |
2122 |
for (uint32_t x= 0 ; total < 20 * 1024576 ; x++ ) |
143
by Brian Aker
Refactored out actual test code from test.c |
2123 |
{
|
2124 |
unsigned int j= 0; |
|
2125 |
||
537.3.1
by Monty Taylor
Fixed -Wconversion warnings. |
2126 |
size= (uint32_t)(rand() % ( 5 * 1024 ) ) + 400; |
143
by Brian Aker
Refactored out actual test code from test.c |
2127 |
memset(randomstuff, 0, 6 * 1024); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2128 |
test_true(size < 6 * 1024); /* Being safe here */ |
143
by Brian Aker
Refactored out actual test code from test.c |
2129 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2130 |
for (j= 0 ; j < size ;j++) |
537.3.1
by Monty Taylor
Fixed -Wconversion warnings. |
2131 |
randomstuff[j] = (signed char) ((rand() % 26) + 97); |
143
by Brian Aker
Refactored out actual test code from test.c |
2132 |
|
2133 |
total += size; |
|
728
by Brian Aker
Small icc repairs. |
2134 |
snprintf(key, sizeof(key), "%u", x); |
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2135 |
rc = memcached_set(memc, key, strlen(key), |
143
by Brian Aker
Refactored out actual test code from test.c |
2136 |
randomstuff, strlen(randomstuff), 10, 0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2137 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
143
by Brian Aker
Refactored out actual test code from test.c |
2138 |
/* If we fail, lets try again */
|
247
by Brian Aker
Test fixes for new return code on buffered calls. |
2139 |
if (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_BUFFERED) |
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2140 |
rc = memcached_set(memc, key, strlen(key), |
143
by Brian Aker
Refactored out actual test code from test.c |
2141 |
randomstuff, strlen(randomstuff), 10, 0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2142 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
143
by Brian Aker
Refactored out actual test code from test.c |
2143 |
}
|
147
by Brian Aker
Updating test cases to return true/false |
2144 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2145 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
2146 |
}
|
2147 |
||
2148 |
/* Test case provided by Cal Haldenbrand */
|
|
736
by Brian Aker
Updates for CORK. |
2149 |
static test_return_t user_supplied_bug2(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
2150 |
{
|
2151 |
unsigned int setter; |
|
728
by Brian Aker
Small icc repairs. |
2152 |
size_t total= 0; |
143
by Brian Aker
Refactored out actual test code from test.c |
2153 |
|
2154 |
setter= 1; |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
2155 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, setter); |
2156 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, setter); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
2157 |
#ifdef NOT_YET
|
2158 |
setter = 20 * 1024576; |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
2159 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE, setter); |
143
by Brian Aker
Refactored out actual test code from test.c |
2160 |
setter = 20 * 1024576; |
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
2161 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE, setter); |
143
by Brian Aker
Refactored out actual test code from test.c |
2162 |
getter = memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE); |
2163 |
getter = memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE); |
|
2164 |
||
728
by Brian Aker
Small icc repairs. |
2165 |
for (x= 0, errors= 0; total < 20 * 1024576 ; x++) |
143
by Brian Aker
Refactored out actual test code from test.c |
2166 |
#endif
|
2167 |
||
728
by Brian Aker
Small icc repairs. |
2168 |
for (uint32_t x= 0, errors= 0; total < 24576 ; x++) |
143
by Brian Aker
Refactored out actual test code from test.c |
2169 |
{
|
630
by Brian Aker
Style cleanup |
2170 |
memcached_return_t rc= MEMCACHED_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
2171 |
char buffer[SMALL_STRING_LEN]; |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
2172 |
uint32_t flags= 0; |
143
by Brian Aker
Refactored out actual test code from test.c |
2173 |
size_t val_len= 0; |
2174 |
char *getval; |
|
2175 |
||
2176 |
memset(buffer, 0, SMALL_STRING_LEN); |
|
2177 |
||
728
by Brian Aker
Small icc repairs. |
2178 |
snprintf(buffer, sizeof(buffer), "%u", x); |
143
by Brian Aker
Refactored out actual test code from test.c |
2179 |
getval= memcached_get(memc, buffer, strlen(buffer), |
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2180 |
&val_len, &flags, &rc); |
2181 |
if (rc != MEMCACHED_SUCCESS) |
|
143
by Brian Aker
Refactored out actual test code from test.c |
2182 |
{
|
2183 |
if (rc == MEMCACHED_NOTFOUND) |
|
2184 |
errors++; |
|
2185 |
else
|
|
284
by Brian Aker
Kevin's patch bug13 |
2186 |
{
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2187 |
test_true(rc); |
284
by Brian Aker
Kevin's patch bug13 |
2188 |
}
|
143
by Brian Aker
Refactored out actual test code from test.c |
2189 |
|
2190 |
continue; |
|
2191 |
}
|
|
2192 |
total+= val_len; |
|
2193 |
errors= 0; |
|
2194 |
free(getval); |
|
2195 |
}
|
|
147
by Brian Aker
Updating test cases to return true/false |
2196 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2197 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
2198 |
}
|
2199 |
||
2200 |
/* Do a large mget() over all the keys we think exist */
|
|
2201 |
#define KEY_COUNT 3000 // * 1024576 |
|
736
by Brian Aker
Updates for CORK. |
2202 |
static test_return_t user_supplied_bug3(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
2203 |
{
|
630
by Brian Aker
Style cleanup |
2204 |
memcached_return_t rc; |
143
by Brian Aker
Refactored out actual test code from test.c |
2205 |
unsigned int setter; |
2206 |
unsigned int x; |
|
2207 |
char **keys; |
|
2208 |
size_t key_lengths[KEY_COUNT]; |
|
2209 |
||
2210 |
setter= 1; |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
2211 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, setter); |
2212 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, setter); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
2213 |
#ifdef NOT_YET
|
2214 |
setter = 20 * 1024576; |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
2215 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE, setter); |
143
by Brian Aker
Refactored out actual test code from test.c |
2216 |
setter = 20 * 1024576; |
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
2217 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE, setter); |
143
by Brian Aker
Refactored out actual test code from test.c |
2218 |
getter = memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE); |
2219 |
getter = memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE); |
|
2220 |
#endif
|
|
2221 |
||
580.2.2
by Adam Thomason
Address trond's comments |
2222 |
keys= calloc(KEY_COUNT, sizeof(char *)); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2223 |
test_true(keys); |
143
by Brian Aker
Refactored out actual test code from test.c |
2224 |
for (x= 0; x < KEY_COUNT; x++) |
2225 |
{
|
|
2226 |
char buffer[30]; |
|
2227 |
||
2228 |
snprintf(buffer, 30, "%u", x); |
|
2229 |
keys[x]= strdup(buffer); |
|
2230 |
key_lengths[x]= strlen(keys[x]); |
|
2231 |
}
|
|
2232 |
||
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
2233 |
rc= memcached_mget(memc, (const char **)keys, key_lengths, KEY_COUNT); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2234 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
2235 |
|
905.1.9
by Brian Aker
Merge in additional checks on tests. |
2236 |
size_t keys_returned; |
2237 |
test_true(fetch_all_results(memc, &keys_returned) == TEST_SUCCESS); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
2238 |
|
2239 |
for (x= 0; x < KEY_COUNT; x++) |
|
2240 |
free(keys[x]); |
|
2241 |
free(keys); |
|
147
by Brian Aker
Updating test cases to return true/false |
2242 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2243 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
2244 |
}
|
2245 |
||
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2246 |
/* Make sure we behave properly if server list has no values */
|
736
by Brian Aker
Updates for CORK. |
2247 |
static test_return_t user_supplied_bug4(memcached_st *memc) |
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2248 |
{
|
630
by Brian Aker
Style cleanup |
2249 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
2250 |
const char *keys[]= {"fudge", "son", "food"}; |
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2251 |
size_t key_length[]= {5, 3, 4}; |
2252 |
unsigned int x; |
|
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
2253 |
uint32_t flags; |
236
by Brian Aker
Portability patches from Kevin Dalley for Freebsd 4.0. |
2254 |
char return_key[MEMCACHED_MAX_KEY]; |
2255 |
size_t return_key_length; |
|
2256 |
char *return_value; |
|
2257 |
size_t return_value_length; |
|
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2258 |
|
2259 |
/* Here we free everything before running a bunch of mget tests */
|
|
695
by Brian Aker
number_of_hosts <-- encapsulated. |
2260 |
memcached_servers_reset(memc); |
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2261 |
|
2262 |
||
2263 |
/* We need to empty the server before continueing test */
|
|
2264 |
rc= memcached_flush(memc, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2265 |
test_true(rc == MEMCACHED_NO_SERVERS); |
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2266 |
|
2267 |
rc= memcached_mget(memc, keys, key_length, 3); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2268 |
test_true(rc == MEMCACHED_NO_SERVERS); |
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2269 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2270 |
while ((return_value= memcached_fetch(memc, return_key, &return_key_length, |
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2271 |
&return_value_length, &flags, &rc)) != NULL) |
2272 |
{
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2273 |
test_true(return_value); |
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2274 |
}
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2275 |
test_true(!return_value); |
2276 |
test_true(return_value_length == 0); |
|
2277 |
test_true(rc == MEMCACHED_NO_SERVERS); |
|
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2278 |
|
2279 |
for (x= 0; x < 3; x++) |
|
2280 |
{
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2281 |
rc= memcached_set(memc, keys[x], key_length[x], |
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2282 |
keys[x], key_length[x], |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
2283 |
(time_t)50, (uint32_t)9); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2284 |
test_true(rc == MEMCACHED_NO_SERVERS); |
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2285 |
}
|
2286 |
||
2287 |
rc= memcached_mget(memc, keys, key_length, 3); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2288 |
test_true(rc == MEMCACHED_NO_SERVERS); |
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2289 |
|
2290 |
x= 0; |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2291 |
while ((return_value= memcached_fetch(memc, return_key, &return_key_length, |
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2292 |
&return_value_length, &flags, &rc))) |
2293 |
{
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2294 |
test_true(return_value); |
2295 |
test_true(rc == MEMCACHED_SUCCESS); |
|
2296 |
test_true(return_key_length == return_value_length); |
|
2297 |
test_true(!memcmp(return_value, return_key, return_value_length)); |
|
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2298 |
free(return_value); |
2299 |
x++; |
|
2300 |
}
|
|
2301 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2302 |
return TEST_SUCCESS; |
149
by Brian Aker
Fixed bug reported by Stuart Midgley about what happens when there are no |
2303 |
}
|
2304 |
||
156
by Brian Aker
Adding comments to memcached_mget() that you need to call fetch methods |
2305 |
#define VALUE_SIZE_BUG5 1048064
|
736
by Brian Aker
Updates for CORK. |
2306 |
static test_return_t user_supplied_bug5(memcached_st *memc) |
156
by Brian Aker
Adding comments to memcached_mget() that you need to call fetch methods |
2307 |
{
|
630
by Brian Aker
Style cleanup |
2308 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
2309 |
const char *keys[]= {"036790384900", "036790384902", "036790384904", "036790384906"}; |
156
by Brian Aker
Adding comments to memcached_mget() that you need to call fetch methods |
2310 |
size_t key_length[]= {strlen("036790384900"), strlen("036790384902"), strlen("036790384904"), strlen("036790384906")}; |
2311 |
char return_key[MEMCACHED_MAX_KEY]; |
|
2312 |
size_t return_key_length; |
|
2313 |
char *value; |
|
2314 |
size_t value_length; |
|
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
2315 |
uint32_t flags; |
156
by Brian Aker
Adding comments to memcached_mget() that you need to call fetch methods |
2316 |
unsigned int count; |
2317 |
unsigned int x; |
|
2318 |
char insert_data[VALUE_SIZE_BUG5]; |
|
2319 |
||
2320 |
for (x= 0; x < VALUE_SIZE_BUG5; x++) |
|
537.3.1
by Monty Taylor
Fixed -Wconversion warnings. |
2321 |
insert_data[x]= (signed char)rand(); |
156
by Brian Aker
Adding comments to memcached_mget() that you need to call fetch methods |
2322 |
|
2323 |
memcached_flush(memc, 0); |
|
2324 |
value= memcached_get(memc, keys[0], key_length[0], |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2325 |
&value_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2326 |
test_true(value == NULL); |
156
by Brian Aker
Adding comments to memcached_mget() that you need to call fetch methods |
2327 |
rc= memcached_mget(memc, keys, key_length, 4); |
2328 |
||
2329 |
count= 0; |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2330 |
while ((value= memcached_fetch(memc, return_key, &return_key_length, |
156
by Brian Aker
Adding comments to memcached_mget() that you need to call fetch methods |
2331 |
&value_length, &flags, &rc))) |
2332 |
count++; |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2333 |
test_true(count == 0); |
156
by Brian Aker
Adding comments to memcached_mget() that you need to call fetch methods |
2334 |
|
2335 |
for (x= 0; x < 4; x++) |
|
2336 |
{
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2337 |
rc= memcached_set(memc, keys[x], key_length[x], |
156
by Brian Aker
Adding comments to memcached_mget() that you need to call fetch methods |
2338 |
insert_data, VALUE_SIZE_BUG5, |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
2339 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2340 |
test_true(rc == MEMCACHED_SUCCESS); |
156
by Brian Aker
Adding comments to memcached_mget() that you need to call fetch methods |
2341 |
}
|
2342 |
||
2343 |
for (x= 0; x < 10; x++) |
|
2344 |
{
|
|
2345 |
value= memcached_get(memc, keys[0], key_length[0], |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2346 |
&value_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2347 |
test_true(value); |
156
by Brian Aker
Adding comments to memcached_mget() that you need to call fetch methods |
2348 |
free(value); |
2349 |
||
2350 |
rc= memcached_mget(memc, keys, key_length, 4); |
|
2351 |
count= 0; |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2352 |
while ((value= memcached_fetch(memc, return_key, &return_key_length, |
156
by Brian Aker
Adding comments to memcached_mget() that you need to call fetch methods |
2353 |
&value_length, &flags, &rc))) |
2354 |
{
|
|
2355 |
count++; |
|
2356 |
free(value); |
|
2357 |
}
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2358 |
test_true(count == 4); |
156
by Brian Aker
Adding comments to memcached_mget() that you need to call fetch methods |
2359 |
}
|
2360 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2361 |
return TEST_SUCCESS; |
156
by Brian Aker
Adding comments to memcached_mget() that you need to call fetch methods |
2362 |
}
|
2363 |
||
736
by Brian Aker
Updates for CORK. |
2364 |
static test_return_t user_supplied_bug6(memcached_st *memc) |
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2365 |
{
|
630
by Brian Aker
Style cleanup |
2366 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
2367 |
const char *keys[]= {"036790384900", "036790384902", "036790384904", "036790384906"}; |
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2368 |
size_t key_length[]= {strlen("036790384900"), strlen("036790384902"), strlen("036790384904"), strlen("036790384906")}; |
2369 |
char return_key[MEMCACHED_MAX_KEY]; |
|
2370 |
size_t return_key_length; |
|
2371 |
char *value; |
|
2372 |
size_t value_length; |
|
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
2373 |
uint32_t flags; |
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2374 |
unsigned int count; |
2375 |
unsigned int x; |
|
2376 |
char insert_data[VALUE_SIZE_BUG5]; |
|
2377 |
||
2378 |
for (x= 0; x < VALUE_SIZE_BUG5; x++) |
|
537.3.1
by Monty Taylor
Fixed -Wconversion warnings. |
2379 |
insert_data[x]= (signed char)rand(); |
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2380 |
|
2381 |
memcached_flush(memc, 0); |
|
2382 |
value= memcached_get(memc, keys[0], key_length[0], |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2383 |
&value_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2384 |
test_true(value == NULL); |
2385 |
test_true(rc == MEMCACHED_NOTFOUND); |
|
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2386 |
rc= memcached_mget(memc, keys, key_length, 4); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2387 |
test_true(rc == MEMCACHED_SUCCESS); |
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2388 |
|
2389 |
count= 0; |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2390 |
while ((value= memcached_fetch(memc, return_key, &return_key_length, |
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2391 |
&value_length, &flags, &rc))) |
2392 |
count++; |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2393 |
test_true(count == 0); |
2394 |
test_true(rc == MEMCACHED_END); |
|
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2395 |
|
2396 |
for (x= 0; x < 4; x++) |
|
2397 |
{
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2398 |
rc= memcached_set(memc, keys[x], key_length[x], |
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2399 |
insert_data, VALUE_SIZE_BUG5, |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
2400 |
(time_t)0, (uint32_t)0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2401 |
test_true(rc == MEMCACHED_SUCCESS); |
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2402 |
}
|
2403 |
||
200
by Brian Aker
Fix for Linux system for async protocol. |
2404 |
for (x= 0; x < 2; x++) |
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2405 |
{
|
2406 |
value= memcached_get(memc, keys[0], key_length[0], |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2407 |
&value_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2408 |
test_true(value); |
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2409 |
free(value); |
2410 |
||
2411 |
rc= memcached_mget(memc, keys, key_length, 4); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2412 |
test_true(rc == MEMCACHED_SUCCESS); |
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2413 |
count= 3; |
2414 |
/* We test for purge of partial complete fetches */
|
|
2415 |
for (count= 3; count; count--) |
|
2416 |
{
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2417 |
value= memcached_fetch(memc, return_key, &return_key_length, |
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2418 |
&value_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2419 |
test_true(rc == MEMCACHED_SUCCESS); |
2420 |
test_true(!(memcmp(value, insert_data, value_length))); |
|
2421 |
test_true(value_length); |
|
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2422 |
free(value); |
2423 |
}
|
|
2424 |
}
|
|
2425 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2426 |
return TEST_SUCCESS; |
158
by Brian Aker
Testing to make sure that partial reads do not break protocol (aka on active |
2427 |
}
|
2428 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
2429 |
static test_return_t user_supplied_bug8(memcached_st *memc) |
192
by Brian Aker
Longer test case added for server parsing. |
2430 |
{
|
630
by Brian Aker
Style cleanup |
2431 |
memcached_return_t rc; |
192
by Brian Aker
Longer test case added for server parsing. |
2432 |
memcached_st *mine; |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
2433 |
memcached_st *memc_clone; |
192
by Brian Aker
Longer test case added for server parsing. |
2434 |
|
2435 |
memcached_server_st *servers; |
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
2436 |
const char *server_list= "memcache1.memcache.bk.sapo.pt:11211, memcache1.memcache.bk.sapo.pt:11212, memcache1.memcache.bk.sapo.pt:11213, memcache1.memcache.bk.sapo.pt:11214, memcache2.memcache.bk.sapo.pt:11211, memcache2.memcache.bk.sapo.pt:11212, memcache2.memcache.bk.sapo.pt:11213, memcache2.memcache.bk.sapo.pt:11214"; |
192
by Brian Aker
Longer test case added for server parsing. |
2437 |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
2438 |
(void)memc; |
192
by Brian Aker
Longer test case added for server parsing. |
2439 |
servers= memcached_servers_parse(server_list); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2440 |
test_true(servers); |
192
by Brian Aker
Longer test case added for server parsing. |
2441 |
|
2442 |
mine= memcached_create(NULL); |
|
2443 |
rc= memcached_server_push(mine, servers); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2444 |
test_true(rc == MEMCACHED_SUCCESS); |
192
by Brian Aker
Longer test case added for server parsing. |
2445 |
memcached_server_list_free(servers); |
2446 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2447 |
test_true(mine); |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
2448 |
memc_clone= memcached_clone(NULL, mine); |
192
by Brian Aker
Longer test case added for server parsing. |
2449 |
|
2450 |
memcached_quit(mine); |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
2451 |
memcached_quit(memc_clone); |
192
by Brian Aker
Longer test case added for server parsing. |
2452 |
|
2453 |
||
2454 |
memcached_free(mine); |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
2455 |
memcached_free(memc_clone); |
192
by Brian Aker
Longer test case added for server parsing. |
2456 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2457 |
return TEST_SUCCESS; |
192
by Brian Aker
Longer test case added for server parsing. |
2458 |
}
|
2459 |
||
161
by Brian Aker
Flags fix found by Stuart Midgley |
2460 |
/* Test flag store/retrieve */
|
736
by Brian Aker
Updates for CORK. |
2461 |
static test_return_t user_supplied_bug7(memcached_st *memc) |
161
by Brian Aker
Flags fix found by Stuart Midgley |
2462 |
{
|
630
by Brian Aker
Style cleanup |
2463 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
2464 |
const char *keys= "036790384900"; |
2465 |
size_t key_length= strlen(keys); |
|
161
by Brian Aker
Flags fix found by Stuart Midgley |
2466 |
char return_key[MEMCACHED_MAX_KEY]; |
2467 |
size_t return_key_length; |
|
2468 |
char *value; |
|
2469 |
size_t value_length; |
|
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
2470 |
uint32_t flags; |
161
by Brian Aker
Flags fix found by Stuart Midgley |
2471 |
unsigned int x; |
2472 |
char insert_data[VALUE_SIZE_BUG5]; |
|
2473 |
||
2474 |
for (x= 0; x < VALUE_SIZE_BUG5; x++) |
|
537.3.1
by Monty Taylor
Fixed -Wconversion warnings. |
2475 |
insert_data[x]= (signed char)rand(); |
161
by Brian Aker
Flags fix found by Stuart Midgley |
2476 |
|
2477 |
memcached_flush(memc, 0); |
|
2478 |
||
2479 |
flags= 245; |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2480 |
rc= memcached_set(memc, keys, key_length, |
161
by Brian Aker
Flags fix found by Stuart Midgley |
2481 |
insert_data, VALUE_SIZE_BUG5, |
2482 |
(time_t)0, flags); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2483 |
test_true(rc == MEMCACHED_SUCCESS); |
161
by Brian Aker
Flags fix found by Stuart Midgley |
2484 |
|
2485 |
flags= 0; |
|
2486 |
value= memcached_get(memc, keys, key_length, |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2487 |
&value_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2488 |
test_true(flags == 245); |
2489 |
test_true(value); |
|
161
by Brian Aker
Flags fix found by Stuart Midgley |
2490 |
free(value); |
2491 |
||
2492 |
rc= memcached_mget(memc, &keys, &key_length, 1); |
|
2493 |
||
2494 |
flags= 0; |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2495 |
value= memcached_fetch(memc, return_key, &return_key_length, |
161
by Brian Aker
Flags fix found by Stuart Midgley |
2496 |
&value_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2497 |
test_true(flags == 245); |
2498 |
test_true(value); |
|
161
by Brian Aker
Flags fix found by Stuart Midgley |
2499 |
free(value); |
2500 |
||
2501 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2502 |
return TEST_SUCCESS; |
161
by Brian Aker
Flags fix found by Stuart Midgley |
2503 |
}
|
2504 |
||
736
by Brian Aker
Updates for CORK. |
2505 |
static test_return_t user_supplied_bug9(memcached_st *memc) |
204
by brian@h220-215-226-164.catv02.itscom.jp
Fixed problem with out of range character in key. |
2506 |
{
|
630
by Brian Aker
Style cleanup |
2507 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
2508 |
const char *keys[]= {"UDATA:edevil@sapo.pt", "fudge&*@#", "for^#@&$not"}; |
204
by brian@h220-215-226-164.catv02.itscom.jp
Fixed problem with out of range character in key. |
2509 |
size_t key_length[3]; |
2510 |
unsigned int x; |
|
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
2511 |
uint32_t flags; |
204
by brian@h220-215-226-164.catv02.itscom.jp
Fixed problem with out of range character in key. |
2512 |
unsigned count= 0; |
2513 |
||
2514 |
char return_key[MEMCACHED_MAX_KEY]; |
|
2515 |
size_t return_key_length; |
|
2516 |
char *return_value; |
|
2517 |
size_t return_value_length; |
|
2518 |
||
2519 |
||
2520 |
key_length[0]= strlen("UDATA:edevil@sapo.pt"); |
|
2521 |
key_length[1]= strlen("fudge&*@#"); |
|
2522 |
key_length[2]= strlen("for^#@&$not"); |
|
2523 |
||
2524 |
||
2525 |
for (x= 0; x < 3; x++) |
|
2526 |
{
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2527 |
rc= memcached_set(memc, keys[x], key_length[x], |
204
by brian@h220-215-226-164.catv02.itscom.jp
Fixed problem with out of range character in key. |
2528 |
keys[x], key_length[x], |
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
2529 |
(time_t)50, (uint32_t)9); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2530 |
test_true(rc == MEMCACHED_SUCCESS); |
204
by brian@h220-215-226-164.catv02.itscom.jp
Fixed problem with out of range character in key. |
2531 |
}
|
2532 |
||
2533 |
rc= memcached_mget(memc, keys, key_length, 3); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2534 |
test_true(rc == MEMCACHED_SUCCESS); |
204
by brian@h220-215-226-164.catv02.itscom.jp
Fixed problem with out of range character in key. |
2535 |
|
2536 |
/* We need to empty the server before continueing test */
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2537 |
while ((return_value= memcached_fetch(memc, return_key, &return_key_length, |
204
by brian@h220-215-226-164.catv02.itscom.jp
Fixed problem with out of range character in key. |
2538 |
&return_value_length, &flags, &rc)) != NULL) |
2539 |
{
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2540 |
test_true(return_value); |
211
by Brian Aker
Updating to remove memory leak in functions.c (aka test cases). |
2541 |
free(return_value); |
204
by brian@h220-215-226-164.catv02.itscom.jp
Fixed problem with out of range character in key. |
2542 |
count++; |
2543 |
}
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2544 |
test_true(count == 3); |
204
by brian@h220-215-226-164.catv02.itscom.jp
Fixed problem with out of range character in key. |
2545 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2546 |
return TEST_SUCCESS; |
204
by brian@h220-215-226-164.catv02.itscom.jp
Fixed problem with out of range character in key. |
2547 |
}
|
2548 |
||
213
by Brian Aker
Modifying tests to always get failures (aka test that failure logic is |
2549 |
/* We are testing with aggressive timeout to get failures */
|
736
by Brian Aker
Updates for CORK. |
2550 |
static test_return_t user_supplied_bug10(memcached_st *memc) |
205
by brian@gir.local
Fixing failure of socket issue. |
2551 |
{
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
2552 |
const char *key= "foo"; |
205
by brian@gir.local
Fixing failure of socket issue. |
2553 |
char *value; |
2554 |
size_t value_length= 512; |
|
2555 |
unsigned int x; |
|
537.3.1
by Monty Taylor
Fixed -Wconversion warnings. |
2556 |
size_t key_len= 3; |
630
by Brian Aker
Style cleanup |
2557 |
memcached_return_t rc; |
205
by brian@gir.local
Fixing failure of socket issue. |
2558 |
unsigned int set= 1; |
2559 |
memcached_st *mclone= memcached_clone(NULL, memc); |
|
213
by Brian Aker
Modifying tests to always get failures (aka test that failure logic is |
2560 |
int32_t timeout; |
205
by brian@gir.local
Fixing failure of socket issue. |
2561 |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
2562 |
memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_NO_BLOCK, set); |
2563 |
memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_TCP_NODELAY, set); |
|
213
by Brian Aker
Modifying tests to always get failures (aka test that failure logic is |
2564 |
timeout= 2; |
537.3.1
by Monty Taylor
Fixed -Wconversion warnings. |
2565 |
memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, |
2566 |
(uint64_t)timeout); |
|
205
by brian@gir.local
Fixing failure of socket issue. |
2567 |
|
2568 |
value = (char*)malloc(value_length * sizeof(char)); |
|
2569 |
||
2570 |
for (x= 0; x < value_length; x++) |
|
2571 |
value[x]= (char) (x % 127); |
|
2572 |
||
2573 |
for (x= 1; x <= 100000; ++x) |
|
2574 |
{
|
|
2575 |
rc= memcached_set(mclone, key, key_len,value, value_length, 0, 0); |
|
2576 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2577 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_WRITE_FAILURE || |
499
by Trond Norbye
Refactor: memcached_io_read should return memcached_return error codes |
2578 |
rc == MEMCACHED_BUFFERED || rc == MEMCACHED_TIMEOUT); |
205
by brian@gir.local
Fixing failure of socket issue. |
2579 |
|
499
by Trond Norbye
Refactor: memcached_io_read should return memcached_return error codes |
2580 |
if (rc == MEMCACHED_WRITE_FAILURE || rc == MEMCACHED_TIMEOUT) |
205
by brian@gir.local
Fixing failure of socket issue. |
2581 |
x--; |
2582 |
}
|
|
2583 |
||
2584 |
free(value); |
|
2585 |
memcached_free(mclone); |
|
2586 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2587 |
return TEST_SUCCESS; |
205
by brian@gir.local
Fixing failure of socket issue. |
2588 |
}
|
2589 |
||
212
by Brian Aker
Extending tests... |
2590 |
/*
|
2591 |
We are looking failures in the async protocol
|
|
2592 |
*/
|
|
736
by Brian Aker
Updates for CORK. |
2593 |
static test_return_t user_supplied_bug11(memcached_st *memc) |
212
by Brian Aker
Extending tests... |
2594 |
{
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
2595 |
const char *key= "foo"; |
212
by Brian Aker
Extending tests... |
2596 |
char *value; |
2597 |
size_t value_length= 512; |
|
2598 |
unsigned int x; |
|
537.3.1
by Monty Taylor
Fixed -Wconversion warnings. |
2599 |
size_t key_len= 3; |
630
by Brian Aker
Style cleanup |
2600 |
memcached_return_t rc; |
212
by Brian Aker
Extending tests... |
2601 |
unsigned int set= 1; |
2602 |
int32_t timeout; |
|
2603 |
memcached_st *mclone= memcached_clone(NULL, memc); |
|
2604 |
||
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
2605 |
memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_NO_BLOCK, set); |
2606 |
memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_TCP_NODELAY, set); |
|
212
by Brian Aker
Extending tests... |
2607 |
timeout= -1; |
537.3.1
by Monty Taylor
Fixed -Wconversion warnings. |
2608 |
memcached_behavior_set(mclone, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, |
2609 |
(size_t)timeout); |
|
212
by Brian Aker
Extending tests... |
2610 |
|
254
by Brian Aker
More timeout cleanup |
2611 |
timeout= (int32_t)memcached_behavior_get(mclone, MEMCACHED_BEHAVIOR_POLL_TIMEOUT); |
212
by Brian Aker
Extending tests... |
2612 |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2613 |
test_true(timeout == -1); |
212
by Brian Aker
Extending tests... |
2614 |
|
2615 |
value = (char*)malloc(value_length * sizeof(char)); |
|
2616 |
||
2617 |
for (x= 0; x < value_length; x++) |
|
2618 |
value[x]= (char) (x % 127); |
|
2619 |
||
2620 |
for (x= 1; x <= 100000; ++x) |
|
2621 |
{
|
|
2622 |
rc= memcached_set(mclone, key, key_len,value, value_length, 0, 0); |
|
2623 |
}
|
|
2624 |
||
2625 |
free(value); |
|
2626 |
memcached_free(mclone); |
|
2627 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2628 |
return TEST_SUCCESS; |
212
by Brian Aker
Extending tests... |
2629 |
}
|
2630 |
||
267.1.9
by brian@gir.tangent.org
Fixed bug found by Evan Weaver where increment was not returning propper error |
2631 |
/*
|
2632 |
Bug found where incr was not returning MEMCACHED_NOTFOUND when object did not exist.
|
|
2633 |
*/
|
|
736
by Brian Aker
Updates for CORK. |
2634 |
static test_return_t user_supplied_bug12(memcached_st *memc) |
267.1.9
by brian@gir.tangent.org
Fixed bug found by Evan Weaver where increment was not returning propper error |
2635 |
{
|
630
by Brian Aker
Style cleanup |
2636 |
memcached_return_t rc; |
267.1.9
by brian@gir.tangent.org
Fixed bug found by Evan Weaver where increment was not returning propper error |
2637 |
uint32_t flags; |
2638 |
size_t value_length; |
|
2639 |
char *value; |
|
2640 |
uint64_t number_value; |
|
2641 |
||
2642 |
value= memcached_get(memc, "autoincrement", strlen("autoincrement"), |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2643 |
&value_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2644 |
test_true(value == NULL); |
2645 |
test_true(rc == MEMCACHED_NOTFOUND); |
|
267.1.9
by brian@gir.tangent.org
Fixed bug found by Evan Weaver where increment was not returning propper error |
2646 |
|
2647 |
rc= memcached_increment(memc, "autoincrement", strlen("autoincrement"), |
|
2648 |
1, &number_value); |
|
2649 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2650 |
test_true(value == NULL); |
419
by Brian Aker
Import new purge work from trond |
2651 |
/* The binary protocol will set the key if it doesn't exist */
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2652 |
if (memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == 1) |
620
by Brian Aker
Updated tests to use new macro (less assert()). |
2653 |
{
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2654 |
test_true(rc == MEMCACHED_SUCCESS); |
620
by Brian Aker
Updated tests to use new macro (less assert()). |
2655 |
}
|
419
by Brian Aker
Import new purge work from trond |
2656 |
else
|
620
by Brian Aker
Updated tests to use new macro (less assert()). |
2657 |
{
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2658 |
test_true(rc == MEMCACHED_NOTFOUND); |
620
by Brian Aker
Updated tests to use new macro (less assert()). |
2659 |
}
|
267.1.9
by brian@gir.tangent.org
Fixed bug found by Evan Weaver where increment was not returning propper error |
2660 |
|
2661 |
rc= memcached_set(memc, "autoincrement", strlen("autoincrement"), "1", 1, 0, 0); |
|
2662 |
||
2663 |
value= memcached_get(memc, "autoincrement", strlen("autoincrement"), |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2664 |
&value_length, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2665 |
test_true(value); |
2666 |
test_true(rc == MEMCACHED_SUCCESS); |
|
267.1.11
by Brian Aker
Fix lack of free() in bug (quiet valgrind) |
2667 |
free(value); |
267.1.9
by brian@gir.tangent.org
Fixed bug found by Evan Weaver where increment was not returning propper error |
2668 |
|
2669 |
rc= memcached_increment(memc, "autoincrement", strlen("autoincrement"), |
|
2670 |
1, &number_value); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2671 |
test_true(number_value == 2); |
2672 |
test_true(rc == MEMCACHED_SUCCESS); |
|
267.1.9
by brian@gir.tangent.org
Fixed bug found by Evan Weaver where increment was not returning propper error |
2673 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2674 |
return TEST_SUCCESS; |
267.1.9
by brian@gir.tangent.org
Fixed bug found by Evan Weaver where increment was not returning propper error |
2675 |
}
|
2676 |
||
284
by Brian Aker
Kevin's patch bug13 |
2677 |
/*
|
2678 |
Bug found where command total one more than MEMCACHED_MAX_BUFFER
|
|
2679 |
set key34567890 0 0 8169 \r\n is sent followed by buffer of size 8169, followed by 8169
|
|
2680 |
*/
|
|
736
by Brian Aker
Updates for CORK. |
2681 |
static test_return_t user_supplied_bug13(memcached_st *memc) |
284
by Brian Aker
Kevin's patch bug13 |
2682 |
{
|
2683 |
char key[] = "key34567890"; |
|
2684 |
char *overflow; |
|
630
by Brian Aker
Style cleanup |
2685 |
memcached_return_t rc; |
284
by Brian Aker
Kevin's patch bug13 |
2686 |
size_t overflowSize; |
2687 |
||
2688 |
char commandFirst[]= "set key34567890 0 0 "; |
|
2689 |
char commandLast[] = " \r\n"; /* first line of command sent to server */ |
|
2690 |
size_t commandLength; |
|
2691 |
size_t testSize; |
|
2692 |
||
2693 |
commandLength = strlen(commandFirst) + strlen(commandLast) + 4; /* 4 is number of characters in size, probably 8196 */ |
|
2694 |
||
2695 |
overflowSize = MEMCACHED_MAX_BUFFER - commandLength; |
|
2696 |
||
2697 |
for (testSize= overflowSize - 1; testSize < overflowSize + 1; testSize++) |
|
2698 |
{
|
|
2699 |
overflow= malloc(testSize); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2700 |
test_true(overflow != NULL); |
284
by Brian Aker
Kevin's patch bug13 |
2701 |
|
2702 |
memset(overflow, 'x', testSize); |
|
2703 |
rc= memcached_set(memc, key, strlen(key), |
|
2704 |
overflow, testSize, 0, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2705 |
test_true(rc == MEMCACHED_SUCCESS); |
284
by Brian Aker
Kevin's patch bug13 |
2706 |
free(overflow); |
2707 |
}
|
|
2708 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2709 |
return TEST_SUCCESS; |
284
by Brian Aker
Kevin's patch bug13 |
2710 |
}
|
2711 |
||
285
by Brian Aker
Incomming Patch from Kevin |
2712 |
|
2713 |
/*
|
|
2714 |
Test values of many different sizes
|
|
2715 |
Bug found where command total one more than MEMCACHED_MAX_BUFFER
|
|
2716 |
set key34567890 0 0 8169 \r\n
|
|
288
by Brian Aker
Fix test case (in debug mode we toss asserts for NULL inserts) |
2717 |
is sent followed by buffer of size 8169, followed by 8169
|
285
by Brian Aker
Incomming Patch from Kevin |
2718 |
*/
|
736
by Brian Aker
Updates for CORK. |
2719 |
static test_return_t user_supplied_bug14(memcached_st *memc) |
285
by Brian Aker
Incomming Patch from Kevin |
2720 |
{
|
537.3.1
by Monty Taylor
Fixed -Wconversion warnings. |
2721 |
size_t setter= 1; |
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
2722 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, setter); |
630
by Brian Aker
Style cleanup |
2723 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
2724 |
const char *key= "foo"; |
285
by Brian Aker
Incomming Patch from Kevin |
2725 |
char *value; |
2726 |
size_t value_length= 18000; |
|
2727 |
char *string; |
|
2728 |
size_t string_length; |
|
2729 |
uint32_t flags; |
|
2730 |
unsigned int x; |
|
2731 |
size_t current_length; |
|
2732 |
||
2733 |
value = (char*)malloc(value_length); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2734 |
test_true(value); |
285
by Brian Aker
Incomming Patch from Kevin |
2735 |
|
2736 |
for (x= 0; x < value_length; x++) |
|
2737 |
value[x] = (char) (x % 127); |
|
2738 |
||
316
by kevin@laminaria
Test for 0-length data, which works with the server. |
2739 |
for (current_length= 0; current_length < value_length; current_length++) |
285
by Brian Aker
Incomming Patch from Kevin |
2740 |
{
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2741 |
rc= memcached_set(memc, key, strlen(key), |
285
by Brian Aker
Incomming Patch from Kevin |
2742 |
value, current_length, |
2743 |
(time_t)0, (uint32_t)0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2744 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
285
by Brian Aker
Incomming Patch from Kevin |
2745 |
|
2746 |
string= memcached_get(memc, key, strlen(key), |
|
2747 |
&string_length, &flags, &rc); |
|
2748 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2749 |
test_true(rc == MEMCACHED_SUCCESS); |
2750 |
test_true(string_length == current_length); |
|
2751 |
test_true(!memcmp(string, value, string_length)); |
|
285
by Brian Aker
Incomming Patch from Kevin |
2752 |
|
2753 |
free(string); |
|
2754 |
}
|
|
2755 |
||
2756 |
free(value); |
|
2757 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2758 |
return TEST_SUCCESS; |
285
by Brian Aker
Incomming Patch from Kevin |
2759 |
}
|
2760 |
||
317.1.1
by brian@gir-2.local
Fix for zero length values. |
2761 |
/*
|
2762 |
Look for zero length value problems
|
|
2763 |
*/
|
|
736
by Brian Aker
Updates for CORK. |
2764 |
static test_return_t user_supplied_bug15(memcached_st *memc) |
317.1.1
by brian@gir-2.local
Fix for zero length values. |
2765 |
{
|
2766 |
uint32_t x; |
|
630
by Brian Aker
Style cleanup |
2767 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
2768 |
const char *key= "mykey"; |
317.1.1
by brian@gir-2.local
Fix for zero length values. |
2769 |
char *value; |
2770 |
size_t length; |
|
2771 |
uint32_t flags; |
|
2772 |
||
2773 |
for (x= 0; x < 2; x++) |
|
2774 |
{
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2775 |
rc= memcached_set(memc, key, strlen(key), |
317.1.1
by brian@gir-2.local
Fix for zero length values. |
2776 |
NULL, 0, |
2777 |
(time_t)0, (uint32_t)0); |
|
2778 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2779 |
test_true(rc == MEMCACHED_SUCCESS); |
2780 |
||
2781 |
value= memcached_get(memc, key, strlen(key), |
|
2782 |
&length, &flags, &rc); |
|
2783 |
||
2784 |
test_true(rc == MEMCACHED_SUCCESS); |
|
2785 |
test_true(value == NULL); |
|
2786 |
test_true(length == 0); |
|
2787 |
test_true(flags == 0); |
|
2788 |
||
2789 |
value= memcached_get(memc, key, strlen(key), |
|
2790 |
&length, &flags, &rc); |
|
2791 |
||
2792 |
test_true(rc == MEMCACHED_SUCCESS); |
|
2793 |
test_true(value == NULL); |
|
2794 |
test_true(length == 0); |
|
2795 |
test_true(flags == 0); |
|
317.1.1
by brian@gir-2.local
Fix for zero length values. |
2796 |
}
|
2797 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2798 |
return TEST_SUCCESS; |
317.1.1
by brian@gir-2.local
Fix for zero length values. |
2799 |
}
|
2800 |
||
334
by brian@gir-2.local
Fix for flags operation (aka not storing the final bit right). Updated |
2801 |
/* Check the return sizes on FLAGS to make sure it stores 32bit unsigned values correctly */
|
736
by Brian Aker
Updates for CORK. |
2802 |
static test_return_t user_supplied_bug16(memcached_st *memc) |
334
by brian@gir-2.local
Fix for flags operation (aka not storing the final bit right). Updated |
2803 |
{
|
630
by Brian Aker
Style cleanup |
2804 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
2805 |
const char *key= "mykey"; |
334
by brian@gir-2.local
Fix for flags operation (aka not storing the final bit right). Updated |
2806 |
char *value; |
2807 |
size_t length; |
|
2808 |
uint32_t flags; |
|
2809 |
||
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2810 |
rc= memcached_set(memc, key, strlen(key), |
334
by brian@gir-2.local
Fix for flags operation (aka not storing the final bit right). Updated |
2811 |
NULL, 0, |
2812 |
(time_t)0, UINT32_MAX); |
|
2813 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2814 |
test_true(rc == MEMCACHED_SUCCESS); |
334
by brian@gir-2.local
Fix for flags operation (aka not storing the final bit right). Updated |
2815 |
|
2816 |
value= memcached_get(memc, key, strlen(key), |
|
2817 |
&length, &flags, &rc); |
|
2818 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2819 |
test_true(rc == MEMCACHED_SUCCESS); |
2820 |
test_true(value == NULL); |
|
2821 |
test_true(length == 0); |
|
2822 |
test_true(flags == UINT32_MAX); |
|
334
by brian@gir-2.local
Fix for flags operation (aka not storing the final bit right). Updated |
2823 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2824 |
return TEST_SUCCESS; |
334
by brian@gir-2.local
Fix for flags operation (aka not storing the final bit right). Updated |
2825 |
}
|
2826 |
||
883.1.2
by Piotr Sikora
Skip "user_supplied_bug17" (Chinese key) becasue OpenBSD's iscntrl() doesn't support multi-byte characters. |
2827 |
#if !defined(__sun) && !defined(__OpenBSD__)
|
352
by brian@localhost.localdomain
Fix for Chinese character sets. |
2828 |
/* Check the validity of chinese key*/
|
736
by Brian Aker
Updates for CORK. |
2829 |
static test_return_t user_supplied_bug17(memcached_st *memc) |
352
by brian@localhost.localdomain
Fix for Chinese character sets. |
2830 |
{
|
630
by Brian Aker
Style cleanup |
2831 |
memcached_return_t rc; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
2832 |
const char *key= "豆瓣"; |
2833 |
const char *value="我们在炎热抑郁的夏天无法停止豆瓣"; |
|
352
by brian@localhost.localdomain
Fix for Chinese character sets. |
2834 |
char *value2; |
2835 |
size_t length; |
|
2836 |
uint32_t flags; |
|
2837 |
||
2838 |
rc= memcached_set(memc, key, strlen(key), |
|
2839 |
value, strlen(value), |
|
2840 |
(time_t)0, 0); |
|
2841 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2842 |
test_true(rc == MEMCACHED_SUCCESS); |
352
by brian@localhost.localdomain
Fix for Chinese character sets. |
2843 |
|
2844 |
value2= memcached_get(memc, key, strlen(key), |
|
2845 |
&length, &flags, &rc); |
|
2846 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2847 |
test_true(length==strlen(value)); |
2848 |
test_true(rc == MEMCACHED_SUCCESS); |
|
2849 |
test_true(memcmp(value, value2, length)==0); |
|
364
by Brian Aker
Fixed memory leaks in test program. |
2850 |
free(value2); |
352
by brian@localhost.localdomain
Fix for Chinese character sets. |
2851 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2852 |
return TEST_SUCCESS; |
352
by brian@localhost.localdomain
Fix for Chinese character sets. |
2853 |
}
|
569.1.1
by Trond Norbye
Fix problems reported by: -Wsign-conversion from gcc 4.4 on Solaris |
2854 |
#endif
|
352
by brian@localhost.localdomain
Fix for Chinese character sets. |
2855 |
|
414.1.1
by brian@gir.tangent.org
Bug fix for host_reset() |
2856 |
/*
|
2857 |
From Andrei on IRC
|
|
2858 |
*/
|
|
2859 |
||
792
by Brian Aker
Lots of compiler fixes. |
2860 |
static test_return_t user_supplied_bug19(memcached_st *not_used) |
414.1.1
by brian@gir.tangent.org
Bug fix for host_reset() |
2861 |
{
|
792
by Brian Aker
Lots of compiler fixes. |
2862 |
memcached_st *memc; |
2863 |
const memcached_server_st *server; |
|
630
by Brian Aker
Style cleanup |
2864 |
memcached_return_t res; |
414.1.1
by brian@gir.tangent.org
Bug fix for host_reset() |
2865 |
|
792
by Brian Aker
Lots of compiler fixes. |
2866 |
(void)not_used; |
2867 |
||
2868 |
memc= memcached_create(NULL); |
|
2869 |
memcached_server_add_with_weight(memc, "localhost", 11311, 100); |
|
2870 |
memcached_server_add_with_weight(memc, "localhost", 11312, 100); |
|
2871 |
||
2872 |
server= memcached_server_by_key(memc, "a", 1, &res); |
|
417
by Brian Aker
Refactor to remove leak in new framework for clone() of server. |
2873 |
|
804
by Brian Aker
A couple of valgrind warnings fixes. |
2874 |
memcached_free(memc); |
2875 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2876 |
return TEST_SUCCESS; |
414.1.1
by brian@gir.tangent.org
Bug fix for host_reset() |
2877 |
}
|
2878 |
||
419
by Brian Aker
Import new purge work from trond |
2879 |
/* CAS test from Andei */
|
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
2880 |
static test_return_t user_supplied_bug20(memcached_st *memc) |
419
by Brian Aker
Import new purge work from trond |
2881 |
{
|
630
by Brian Aker
Style cleanup |
2882 |
memcached_return_t status; |
419
by Brian Aker
Import new purge work from trond |
2883 |
memcached_result_st *result, result_obj; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
2884 |
const char *key = "abc"; |
419
by Brian Aker
Import new purge work from trond |
2885 |
size_t key_len = strlen("abc"); |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
2886 |
const char *value = "foobar"; |
419
by Brian Aker
Import new purge work from trond |
2887 |
size_t value_len = strlen(value); |
2888 |
||
2889 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, 1); |
|
2890 |
||
2891 |
status = memcached_set(memc, key, key_len, value, value_len, (time_t)0, (uint32_t)0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2892 |
test_true(status == MEMCACHED_SUCCESS); |
419
by Brian Aker
Import new purge work from trond |
2893 |
|
2894 |
status = memcached_mget(memc, &key, &key_len, 1); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2895 |
test_true(status == MEMCACHED_SUCCESS); |
419
by Brian Aker
Import new purge work from trond |
2896 |
|
421
by Brian Aker
Fix for test case to not leak memory. |
2897 |
result= memcached_result_create(memc, &result_obj); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2898 |
test_true(result); |
421
by Brian Aker
Fix for test case to not leak memory. |
2899 |
|
419
by Brian Aker
Import new purge work from trond |
2900 |
memcached_result_create(memc, &result_obj); |
2901 |
result= memcached_fetch_result(memc, &result_obj, &status); |
|
2902 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2903 |
test_true(result); |
2904 |
test_true(status == MEMCACHED_SUCCESS); |
|
419
by Brian Aker
Import new purge work from trond |
2905 |
|
421
by Brian Aker
Fix for test case to not leak memory. |
2906 |
memcached_result_free(result); |
2907 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2908 |
return TEST_SUCCESS; |
419
by Brian Aker
Import new purge work from trond |
2909 |
}
|
2910 |
||
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
2911 |
#include "ketama_test_cases.h" |
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
2912 |
static test_return_t user_supplied_bug18(memcached_st *trash) |
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
2913 |
{
|
630
by Brian Aker
Style cleanup |
2914 |
memcached_return_t rc; |
537.3.1
by Monty Taylor
Fixed -Wconversion warnings. |
2915 |
uint64_t value; |
462
by Trond Norbye
Fix coding style violations |
2916 |
int x; |
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
2917 |
memcached_server_st *server_pool; |
418
by Brian Aker
Fix test case for weighted servers. |
2918 |
memcached_st *memc; |
2919 |
||
2920 |
(void)trash; |
|
2921 |
||
2922 |
memc= memcached_create(NULL); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2923 |
test_true(memc); |
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2924 |
|
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
2925 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED, 1); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2926 |
test_true(rc == MEMCACHED_SUCCESS); |
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
2927 |
|
2928 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2929 |
test_true(value == 1); |
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
2930 |
|
2931 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH, MEMCACHED_HASH_MD5); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2932 |
test_true(rc == MEMCACHED_SUCCESS); |
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
2933 |
|
2934 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2935 |
test_true(value == MEMCACHED_HASH_MD5); |
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
2936 |
|
2937 |
server_pool = memcached_servers_parse("10.0.1.1:11211 600,10.0.1.2:11211 300,10.0.1.3:11211 200,10.0.1.4:11211 350,10.0.1.5:11211 1000,10.0.1.6:11211 800,10.0.1.7:11211 950,10.0.1.8:11211 100"); |
|
2938 |
memcached_server_push(memc, server_pool); |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
2939 |
|
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
2940 |
/* verify that the server list was parsed okay. */
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2941 |
test_true(memcached_server_count(memc) == 8); |
2942 |
test_true(strcmp(server_pool[0].hostname, "10.0.1.1") == 0); |
|
2943 |
test_true(server_pool[0].port == 11211); |
|
2944 |
test_true(server_pool[0].weight == 600); |
|
2945 |
test_true(strcmp(server_pool[2].hostname, "10.0.1.3") == 0); |
|
2946 |
test_true(server_pool[2].port == 11211); |
|
2947 |
test_true(server_pool[2].weight == 200); |
|
2948 |
test_true(strcmp(server_pool[7].hostname, "10.0.1.8") == 0); |
|
2949 |
test_true(server_pool[7].port == 11211); |
|
2950 |
test_true(server_pool[7].weight == 100); |
|
404
by brian@gir-3.local
Patch from evn |
2951 |
|
2952 |
/* VDEAAAAA hashes to fffcd1b5, after the last continuum point, and lets
|
|
2953 |
* us test the boundary wraparound.
|
|
2954 |
*/
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
2955 |
test_true(memcached_generate_hash(memc, (char *)"VDEAAAAA", 8) == memc->continuum[0].index); |
404
by brian@gir-3.local
Patch from evn |
2956 |
|
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
2957 |
/* verify the standard ketama set. */
|
462
by Trond Norbye
Fix coding style violations |
2958 |
for (x= 0; x < 99; x++) |
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
2959 |
{
|
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
2960 |
uint32_t server_idx = memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key)); |
792
by Brian Aker
Lots of compiler fixes. |
2961 |
|
794
by Brian Aker
Updating memcached_server_instance_st structure. |
2962 |
memcached_server_instance_st instance= |
792
by Brian Aker
Lots of compiler fixes. |
2963 |
memcached_server_instance_by_position(memc, server_idx); |
2964 |
||
2965 |
const char *hostname = memcached_server_name(instance); |
|
637
by Brian Aker
Updating interface. |
2966 |
test_strcmp(hostname, ketama_test_cases[x].server); |
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
2967 |
}
|
418
by Brian Aker
Fix test case for weighted servers. |
2968 |
|
2969 |
memcached_server_list_free(server_pool); |
|
2970 |
memcached_free(memc); |
|
2971 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
2972 |
return TEST_SUCCESS; |
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
2973 |
}
|
352
by brian@localhost.localdomain
Fix for Chinese character sets. |
2974 |
|
580.2.1
by Adam Thomason
Add a test for large multiget hang |
2975 |
/* Large mget() of missing keys with binary proto
|
580.2.4
by Adam Thomason
Factor out fetch-all-requests code marked "Turn this into a help function" into fetch_all_results help function |
2976 |
*
|
2977 |
* If many binary quiet commands (such as getq's in an mget) fill the output
|
|
2978 |
* buffer and the server chooses not to respond, memcached_flush hangs. See
|
|
2979 |
* http://lists.tangent.org/pipermail/libmemcached/2009-August/000918.html
|
|
580.2.1
by Adam Thomason
Add a test for large multiget hang |
2980 |
*/
|
2981 |
||
598.1.1
by Trond Norbye
Bug #446766: OSX hangs on user_supplied_bug21 |
2982 |
/* sighandler_t function that always asserts false */
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
2983 |
static void fail(int unused) |
598.1.1
by Trond Norbye
Bug #446766: OSX hangs on user_supplied_bug21 |
2984 |
{
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
2985 |
(void)unused; |
598.1.1
by Trond Norbye
Bug #446766: OSX hangs on user_supplied_bug21 |
2986 |
assert(0); |
2987 |
}
|
|
2988 |
||
580.2.1
by Adam Thomason
Add a test for large multiget hang |
2989 |
|
736
by Brian Aker
Updates for CORK. |
2990 |
static test_return_t _user_supplied_bug21(memcached_st* memc, size_t key_count) |
580.2.1
by Adam Thomason
Add a test for large multiget hang |
2991 |
{
|
882.1.3
by Trond Norbye
Initial support for Windows |
2992 |
#ifdef WIN32
|
2993 |
(void)memc; |
|
2994 |
(void)key_count; |
|
2995 |
return TEST_SKIPPED; |
|
2996 |
#else
|
|
630
by Brian Aker
Style cleanup |
2997 |
memcached_return_t rc; |
580.2.1
by Adam Thomason
Add a test for large multiget hang |
2998 |
unsigned int x; |
2999 |
char **keys; |
|
3000 |
size_t* key_lengths; |
|
3001 |
void (*oldalarm)(int); |
|
580.2.2
by Adam Thomason
Address trond's comments |
3002 |
memcached_st *memc_clone; |
3003 |
||
3004 |
memc_clone= memcached_clone(NULL, memc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3005 |
test_true(memc_clone); |
580.2.1
by Adam Thomason
Add a test for large multiget hang |
3006 |
|
3007 |
/* only binproto uses getq for mget */
|
|
580.2.2
by Adam Thomason
Address trond's comments |
3008 |
memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1); |
580.2.1
by Adam Thomason
Add a test for large multiget hang |
3009 |
|
3010 |
/* empty the cache to ensure misses (hence non-responses) */
|
|
580.2.2
by Adam Thomason
Address trond's comments |
3011 |
rc= memcached_flush(memc_clone, 0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3012 |
test_true(rc == MEMCACHED_SUCCESS); |
580.2.1
by Adam Thomason
Add a test for large multiget hang |
3013 |
|
580.2.2
by Adam Thomason
Address trond's comments |
3014 |
key_lengths= calloc(key_count, sizeof(size_t)); |
3015 |
keys= calloc(key_count, sizeof(char *)); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3016 |
test_true(keys); |
580.2.1
by Adam Thomason
Add a test for large multiget hang |
3017 |
for (x= 0; x < key_count; x++) |
3018 |
{
|
|
3019 |
char buffer[30]; |
|
3020 |
||
3021 |
snprintf(buffer, 30, "%u", x); |
|
3022 |
keys[x]= strdup(buffer); |
|
3023 |
key_lengths[x]= strlen(keys[x]); |
|
3024 |
}
|
|
3025 |
||
580.2.2
by Adam Thomason
Address trond's comments |
3026 |
oldalarm= signal(SIGALRM, fail); |
580.2.1
by Adam Thomason
Add a test for large multiget hang |
3027 |
alarm(5); |
3028 |
||
580.2.2
by Adam Thomason
Address trond's comments |
3029 |
rc= memcached_mget(memc_clone, (const char **)keys, key_lengths, key_count); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3030 |
test_true(rc == MEMCACHED_SUCCESS); |
580.2.1
by Adam Thomason
Add a test for large multiget hang |
3031 |
|
3032 |
alarm(0); |
|
3033 |
signal(SIGALRM, oldalarm); |
|
3034 |
||
905.1.9
by Brian Aker
Merge in additional checks on tests. |
3035 |
size_t keys_returned; |
3036 |
test_true(fetch_all_results(memc, &keys_returned) == TEST_SUCCESS); |
|
580.2.1
by Adam Thomason
Add a test for large multiget hang |
3037 |
|
3038 |
for (x= 0; x < key_count; x++) |
|
3039 |
free(keys[x]); |
|
3040 |
free(keys); |
|
3041 |
free(key_lengths); |
|
3042 |
||
596
by Brian Aker
Merge in Adam's bug case. |
3043 |
memcached_free(memc_clone); |
580.2.2
by Adam Thomason
Address trond's comments |
3044 |
|
580.2.3
by Adam Thomason
Fix return codes |
3045 |
return TEST_SUCCESS; |
882.1.3
by Trond Norbye
Initial support for Windows |
3046 |
#endif
|
580.2.1
by Adam Thomason
Add a test for large multiget hang |
3047 |
}
|
3048 |
||
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
3049 |
static test_return_t user_supplied_bug21(memcached_st *memc) |
580.2.1
by Adam Thomason
Add a test for large multiget hang |
3050 |
{
|
640
by Brian Aker
Fix for replication test. |
3051 |
test_return_t test_rc; |
3052 |
test_rc= pre_binary(memc); |
|
3053 |
||
3054 |
if (test_rc != TEST_SUCCESS) |
|
3055 |
return test_rc; |
|
598.1.1
by Trond Norbye
Bug #446766: OSX hangs on user_supplied_bug21 |
3056 |
|
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
3057 |
test_return_t rc; |
580.2.1
by Adam Thomason
Add a test for large multiget hang |
3058 |
|
3059 |
/* should work as of r580 */
|
|
580.2.2
by Adam Thomason
Address trond's comments |
3060 |
rc= _user_supplied_bug21(memc, 10); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3061 |
test_true(rc == TEST_SUCCESS); |
580.2.1
by Adam Thomason
Add a test for large multiget hang |
3062 |
|
3063 |
/* should fail as of r580 */
|
|
580.2.2
by Adam Thomason
Address trond's comments |
3064 |
rc= _user_supplied_bug21(memc, 1000); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3065 |
test_true(rc == TEST_SUCCESS); |
580.2.1
by Adam Thomason
Add a test for large multiget hang |
3066 |
|
580.2.3
by Adam Thomason
Fix return codes |
3067 |
return TEST_SUCCESS; |
580.2.1
by Adam Thomason
Add a test for large multiget hang |
3068 |
}
|
3069 |
||
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
3070 |
static test_return_t auto_eject_hosts(memcached_st *trash) |
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3071 |
{
|
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
3072 |
(void) trash; |
794
by Brian Aker
Updating memcached_server_instance_st structure. |
3073 |
memcached_server_instance_st instance; |
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
3074 |
|
630
by Brian Aker
Style cleanup |
3075 |
memcached_return_t rc; |
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3076 |
memcached_st *memc= memcached_create(NULL); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3077 |
test_true(memc); |
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3078 |
|
3079 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED, 1); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3080 |
test_true(rc == MEMCACHED_SUCCESS); |
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3081 |
|
3082 |
uint64_t value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3083 |
test_true(value == 1); |
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3084 |
|
3085 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH, MEMCACHED_HASH_MD5); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3086 |
test_true(rc == MEMCACHED_SUCCESS); |
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3087 |
|
3088 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3089 |
test_true(value == MEMCACHED_HASH_MD5); |
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3090 |
|
3091 |
/* server should be removed when in delay */
|
|
3092 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS, 1); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3093 |
test_true(rc == MEMCACHED_SUCCESS); |
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3094 |
|
3095 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3096 |
test_true(value == 1); |
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3097 |
|
3098 |
memcached_server_st *server_pool; |
|
3099 |
server_pool = memcached_servers_parse("10.0.1.1:11211 600,10.0.1.2:11211 300,10.0.1.3:11211 200,10.0.1.4:11211 350,10.0.1.5:11211 1000,10.0.1.6:11211 800,10.0.1.7:11211 950,10.0.1.8:11211 100"); |
|
3100 |
memcached_server_push(memc, server_pool); |
|
3101 |
||
3102 |
/* verify that the server list was parsed okay. */
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3103 |
test_true(memcached_server_count(memc) == 8); |
3104 |
test_true(strcmp(server_pool[0].hostname, "10.0.1.1") == 0); |
|
3105 |
test_true(server_pool[0].port == 11211); |
|
3106 |
test_true(server_pool[0].weight == 600); |
|
3107 |
test_true(strcmp(server_pool[2].hostname, "10.0.1.3") == 0); |
|
3108 |
test_true(server_pool[2].port == 11211); |
|
3109 |
test_true(server_pool[2].weight == 200); |
|
3110 |
test_true(strcmp(server_pool[7].hostname, "10.0.1.8") == 0); |
|
3111 |
test_true(server_pool[7].port == 11211); |
|
3112 |
test_true(server_pool[7].weight == 100); |
|
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3113 |
|
792
by Brian Aker
Lots of compiler fixes. |
3114 |
instance= memcached_server_instance_by_position(memc, 2); |
3115 |
((memcached_server_write_instance_st)instance)->next_retry = time(NULL) + 15; |
|
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3116 |
memc->next_distribution_rebuild= time(NULL) - 1; |
3117 |
||
792
by Brian Aker
Lots of compiler fixes. |
3118 |
/*
|
3119 |
This would not work if there were only two hosts.
|
|
3120 |
*/
|
|
723
by Brian Aker
Remove custom parser/use API for parsing in memslap |
3121 |
for (size_t x= 0; x < 99; x++) |
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3122 |
{
|
792
by Brian Aker
Lots of compiler fixes. |
3123 |
memcached_autoeject(memc); |
823
by Brian Aker
Improve on algo for disabling bad hosts. |
3124 |
uint32_t server_idx= memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key)); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3125 |
test_true(server_idx != 2); |
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3126 |
}
|
3127 |
||
3128 |
/* and re-added when it's back. */
|
|
792
by Brian Aker
Lots of compiler fixes. |
3129 |
((memcached_server_write_instance_st)instance)->next_retry = time(NULL) - 1; |
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3130 |
memc->next_distribution_rebuild= time(NULL) - 1; |
619.2.6
by Monty Taylor
pandora-build v0.75. Also fixed visibility which had accidentally been turned off. |
3131 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, |
3132 |
memc->distribution); |
|
723
by Brian Aker
Remove custom parser/use API for parsing in memslap |
3133 |
for (size_t x= 0; x < 99; x++) |
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3134 |
{
|
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
3135 |
uint32_t server_idx = memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key)); |
710
by Brian Aker
Fix test cases for encapsulation. |
3136 |
// We re-use instance from above.
|
3137 |
instance= |
|
792
by Brian Aker
Lots of compiler fixes. |
3138 |
memcached_server_instance_by_position(memc, server_idx); |
3139 |
const char *hostname = memcached_server_name(instance); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3140 |
test_true(strcmp(hostname, ketama_test_cases[x].server) == 0); |
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
3141 |
}
|
3142 |
||
3143 |
memcached_server_list_free(server_pool); |
|
3144 |
memcached_free(memc); |
|
3145 |
||
3146 |
return TEST_SUCCESS; |
|
3147 |
}
|
|
3148 |
||
608.1.2
by mike tsai
Added a new test called output_ketama_weighted_keys. It prints the hashing result |
3149 |
static test_return_t output_ketama_weighted_keys(memcached_st *trash) |
3150 |
{
|
|
3151 |
(void) trash; |
|
3152 |
||
630
by Brian Aker
Style cleanup |
3153 |
memcached_return_t rc; |
608.1.2
by mike tsai
Added a new test called output_ketama_weighted_keys. It prints the hashing result |
3154 |
memcached_st *memc= memcached_create(NULL); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3155 |
test_true(memc); |
608.1.2
by mike tsai
Added a new test called output_ketama_weighted_keys. It prints the hashing result |
3156 |
|
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
3157 |
|
608.1.2
by mike tsai
Added a new test called output_ketama_weighted_keys. It prints the hashing result |
3158 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED, 1); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3159 |
test_true(rc == MEMCACHED_SUCCESS); |
608.1.2
by mike tsai
Added a new test called output_ketama_weighted_keys. It prints the hashing result |
3160 |
|
3161 |
uint64_t value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3162 |
test_true(value == 1); |
608.1.2
by mike tsai
Added a new test called output_ketama_weighted_keys. It prints the hashing result |
3163 |
|
3164 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH, MEMCACHED_HASH_MD5); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3165 |
test_true(rc == MEMCACHED_SUCCESS); |
608.1.2
by mike tsai
Added a new test called output_ketama_weighted_keys. It prints the hashing result |
3166 |
|
3167 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3168 |
test_true(value == MEMCACHED_HASH_MD5); |
3169 |
||
3170 |
||
3171 |
test_true(memcached_behavior_set_distribution(memc, MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY) == MEMCACHED_SUCCESS); |
|
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
3172 |
|
608.1.2
by mike tsai
Added a new test called output_ketama_weighted_keys. It prints the hashing result |
3173 |
memcached_server_st *server_pool; |
3174 |
server_pool = memcached_servers_parse("10.0.1.1:11211,10.0.1.2:11211,10.0.1.3:11211,10.0.1.4:11211,10.0.1.5:11211,10.0.1.6:11211,10.0.1.7:11211,10.0.1.8:11211,192.168.1.1:11211,192.168.100.1:11211"); |
|
3175 |
memcached_server_push(memc, server_pool); |
|
3176 |
||
632
by Brian Aker
Update for test system. |
3177 |
// @todo this needs to be refactored to actually test something.
|
3178 |
#if 0
|
|
608.1.2
by mike tsai
Added a new test called output_ketama_weighted_keys. It prints the hashing result |
3179 |
FILE *fp;
|
3180 |
if ((fp = fopen("ketama_keys.txt", "w")))
|
|
3181 |
{
|
|
3182 |
// noop
|
|
3183 |
} else {
|
|
3184 |
printf("cannot write to file ketama_keys.txt");
|
|
3185 |
return TEST_FAILURE;
|
|
3186 |
}
|
|
3187 |
||
3188 |
for (int x= 0; x < 10000; x++)
|
|
3189 |
{
|
|
3190 |
char key[10];
|
|
904.1.1
by Brian Aker
Remove openbsd warnings. |
3191 |
snprintf(key, sizeof(key), "%d", x);
|
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
3192 |
|
608.1.2
by mike tsai
Added a new test called output_ketama_weighted_keys. It prints the hashing result |
3193 |
uint32_t server_idx = memcached_generate_hash(memc, key, strlen(key));
|
3194 |
char *hostname = memc->hosts[server_idx].hostname;
|
|
641
by Brian Aker
ICC fixes. |
3195 |
in_port_t port = memc->hosts[server_idx].port;
|
608.1.2
by mike tsai
Added a new test called output_ketama_weighted_keys. It prints the hashing result |
3196 |
fprintf(fp, "key %s is on host /%s:%u\n", key, hostname, port);
|
845
by Brian Aker
Added libmemcached_ping() to memcached utility library. |
3197 |
memcached_server_instance_st instance=
|
3198 |
memcached_server_instance_by_position(memc, host_index);
|
|
608.1.2
by mike tsai
Added a new test called output_ketama_weighted_keys. It prints the hashing result |
3199 |
}
|
3200 |
fclose(fp);
|
|
632
by Brian Aker
Update for test system. |
3201 |
#endif
|
608.1.2
by mike tsai
Added a new test called output_ketama_weighted_keys. It prints the hashing result |
3202 |
memcached_server_list_free(server_pool); |
3203 |
memcached_free(memc); |
|
3204 |
||
3205 |
return TEST_SUCCESS; |
|
3206 |
}
|
|
3207 |
||
3208 |
||
736
by Brian Aker
Updates for CORK. |
3209 |
static test_return_t result_static(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3210 |
{
|
3211 |
memcached_result_st result; |
|
3212 |
memcached_result_st *result_ptr; |
|
3213 |
||
3214 |
result_ptr= memcached_result_create(memc, &result); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3215 |
test_true(result.options.is_allocated == false); |
3216 |
test_true(memcached_is_initialized(&result) == true); |
|
3217 |
test_true(result_ptr); |
|
3218 |
test_true(result_ptr == &result); |
|
628
by Brian Aker
Code change to use struct bitsets. |
3219 |
|
143
by Brian Aker
Refactored out actual test code from test.c |
3220 |
memcached_result_free(&result); |
147
by Brian Aker
Updating test cases to return true/false |
3221 |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3222 |
test_true(result.options.is_allocated == false); |
3223 |
test_true(memcached_is_initialized(&result) == false); |
|
628
by Brian Aker
Code change to use struct bitsets. |
3224 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3225 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3226 |
}
|
3227 |
||
736
by Brian Aker
Updates for CORK. |
3228 |
static test_return_t result_alloc(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3229 |
{
|
628
by Brian Aker
Code change to use struct bitsets. |
3230 |
memcached_result_st *result_ptr; |
143
by Brian Aker
Refactored out actual test code from test.c |
3231 |
|
628
by Brian Aker
Code change to use struct bitsets. |
3232 |
result_ptr= memcached_result_create(memc, NULL); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3233 |
test_true(result_ptr); |
3234 |
test_true(result_ptr->options.is_allocated == true); |
|
3235 |
test_true(memcached_is_initialized(result_ptr) == true); |
|
628
by Brian Aker
Code change to use struct bitsets. |
3236 |
memcached_result_free(result_ptr); |
147
by Brian Aker
Updating test cases to return true/false |
3237 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3238 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3239 |
}
|
3240 |
||
736
by Brian Aker
Updates for CORK. |
3241 |
static test_return_t string_static_null(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3242 |
{
|
3243 |
memcached_string_st string; |
|
3244 |
memcached_string_st *string_ptr; |
|
3245 |
||
3246 |
string_ptr= memcached_string_create(memc, &string, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3247 |
test_true(string.options.is_initialized == true); |
3248 |
test_true(string_ptr); |
|
628
by Brian Aker
Code change to use struct bitsets. |
3249 |
|
3250 |
/* The following two better be the same! */
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3251 |
test_true(memcached_is_allocated(string_ptr) == false); |
3252 |
test_true(memcached_is_allocated(&string) == false); |
|
3253 |
test_true(&string == string_ptr); |
|
628
by Brian Aker
Code change to use struct bitsets. |
3254 |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3255 |
test_true(string.options.is_initialized == true); |
3256 |
test_true(memcached_is_initialized(&string) == true); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
3257 |
memcached_string_free(&string); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3258 |
test_true(memcached_is_initialized(&string) == false); |
147
by Brian Aker
Updating test cases to return true/false |
3259 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3260 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3261 |
}
|
3262 |
||
736
by Brian Aker
Updates for CORK. |
3263 |
static test_return_t string_alloc_null(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3264 |
{
|
3265 |
memcached_string_st *string; |
|
3266 |
||
3267 |
string= memcached_string_create(memc, NULL, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3268 |
test_true(string); |
3269 |
test_true(memcached_is_allocated(string) == true); |
|
3270 |
test_true(memcached_is_initialized(string) == true); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
3271 |
memcached_string_free(string); |
147
by Brian Aker
Updating test cases to return true/false |
3272 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3273 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3274 |
}
|
3275 |
||
736
by Brian Aker
Updates for CORK. |
3276 |
static test_return_t string_alloc_with_size(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3277 |
{
|
3278 |
memcached_string_st *string; |
|
3279 |
||
3280 |
string= memcached_string_create(memc, NULL, 1024); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3281 |
test_true(string); |
3282 |
test_true(memcached_is_allocated(string) == true); |
|
3283 |
test_true(memcached_is_initialized(string) == true); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
3284 |
memcached_string_free(string); |
147
by Brian Aker
Updating test cases to return true/false |
3285 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3286 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3287 |
}
|
3288 |
||
736
by Brian Aker
Updates for CORK. |
3289 |
static test_return_t string_alloc_with_size_toobig(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3290 |
{
|
3291 |
memcached_string_st *string; |
|
3292 |
||
517
by Monty Taylor
A few 32-bit fixes. |
3293 |
string= memcached_string_create(memc, NULL, SIZE_MAX); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3294 |
test_true(string == NULL); |
147
by Brian Aker
Updating test cases to return true/false |
3295 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3296 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3297 |
}
|
3298 |
||
736
by Brian Aker
Updates for CORK. |
3299 |
static test_return_t string_alloc_append(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3300 |
{
|
3301 |
unsigned int x; |
|
3302 |
char buffer[SMALL_STRING_LEN]; |
|
3303 |
memcached_string_st *string; |
|
3304 |
||
3305 |
/* Ring the bell! */
|
|
3306 |
memset(buffer, 6, SMALL_STRING_LEN); |
|
3307 |
||
3308 |
string= memcached_string_create(memc, NULL, 100); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3309 |
test_true(string); |
3310 |
test_true(memcached_is_allocated(string) == true); |
|
3311 |
test_true(memcached_is_initialized(string) == true); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
3312 |
|
3313 |
for (x= 0; x < 1024; x++) |
|
3314 |
{
|
|
630
by Brian Aker
Style cleanup |
3315 |
memcached_return_t rc; |
143
by Brian Aker
Refactored out actual test code from test.c |
3316 |
rc= memcached_string_append(string, buffer, SMALL_STRING_LEN); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3317 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
3318 |
}
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3319 |
test_true(memcached_is_allocated(string) == true); |
143
by Brian Aker
Refactored out actual test code from test.c |
3320 |
memcached_string_free(string); |
147
by Brian Aker
Updating test cases to return true/false |
3321 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3322 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3323 |
}
|
3324 |
||
736
by Brian Aker
Updates for CORK. |
3325 |
static test_return_t string_alloc_append_toobig(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3326 |
{
|
630
by Brian Aker
Style cleanup |
3327 |
memcached_return_t rc; |
143
by Brian Aker
Refactored out actual test code from test.c |
3328 |
unsigned int x; |
3329 |
char buffer[SMALL_STRING_LEN]; |
|
3330 |
memcached_string_st *string; |
|
3331 |
||
3332 |
/* Ring the bell! */
|
|
3333 |
memset(buffer, 6, SMALL_STRING_LEN); |
|
3334 |
||
3335 |
string= memcached_string_create(memc, NULL, 100); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3336 |
test_true(string); |
3337 |
test_true(memcached_is_allocated(string) == true); |
|
3338 |
test_true(memcached_is_initialized(string) == true); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
3339 |
|
3340 |
for (x= 0; x < 1024; x++) |
|
3341 |
{
|
|
3342 |
rc= memcached_string_append(string, buffer, SMALL_STRING_LEN); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3343 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
3344 |
}
|
517
by Monty Taylor
A few 32-bit fixes. |
3345 |
rc= memcached_string_append(string, buffer, SIZE_MAX); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3346 |
test_true(rc == MEMCACHED_MEMORY_ALLOCATION_FAILURE); |
3347 |
test_true(memcached_is_allocated(string) == true); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
3348 |
memcached_string_free(string); |
147
by Brian Aker
Updating test cases to return true/false |
3349 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3350 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3351 |
}
|
3352 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
3353 |
static test_return_t cleanup_pairs(memcached_st *memc) |
179
by Brian Aker
Cleanedup test cases (they had some valgrind warnings). |
3354 |
{
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
3355 |
(void)memc; |
179
by Brian Aker
Cleanedup test cases (they had some valgrind warnings). |
3356 |
pairs_free(global_pairs); |
3357 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3358 |
return TEST_SUCCESS; |
179
by Brian Aker
Cleanedup test cases (they had some valgrind warnings). |
3359 |
}
|
3360 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
3361 |
static test_return_t generate_pairs(memcached_st *memc) |
281
by Brian Aker
Refactor of generate tests. |
3362 |
{
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
3363 |
(void)memc; |
281
by Brian Aker
Refactor of generate tests. |
3364 |
global_pairs= pairs_generate(GLOBAL_COUNT, 400); |
3365 |
global_count= GLOBAL_COUNT; |
|
3366 |
||
719
by Brian Aker
Small cleanup for for() to array. |
3367 |
for (size_t x= 0; x < global_count; x++) |
281
by Brian Aker
Refactor of generate tests. |
3368 |
{
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
3369 |
global_keys[x]= global_pairs[x].key; |
281
by Brian Aker
Refactor of generate tests. |
3370 |
global_keys_length[x]= global_pairs[x].key_length; |
3371 |
}
|
|
3372 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3373 |
return TEST_SUCCESS; |
281
by Brian Aker
Refactor of generate tests. |
3374 |
}
|
3375 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
3376 |
static test_return_t generate_large_pairs(memcached_st *memc) |
281
by Brian Aker
Refactor of generate tests. |
3377 |
{
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
3378 |
(void)memc; |
281
by Brian Aker
Refactor of generate tests. |
3379 |
global_pairs= pairs_generate(GLOBAL2_COUNT, MEMCACHED_MAX_BUFFER+10); |
3380 |
global_count= GLOBAL2_COUNT; |
|
3381 |
||
719
by Brian Aker
Small cleanup for for() to array. |
3382 |
for (size_t x= 0; x < global_count; x++) |
281
by Brian Aker
Refactor of generate tests. |
3383 |
{
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
3384 |
global_keys[x]= global_pairs[x].key; |
281
by Brian Aker
Refactor of generate tests. |
3385 |
global_keys_length[x]= global_pairs[x].key_length; |
3386 |
}
|
|
3387 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3388 |
return TEST_SUCCESS; |
281
by Brian Aker
Refactor of generate tests. |
3389 |
}
|
3390 |
||
736
by Brian Aker
Updates for CORK. |
3391 |
static test_return_t generate_data(memcached_st *memc) |
145.1.2
by brian@gir.tangent.org
More tests. |
3392 |
{
|
905.1.8
by Brian Aker
Better reporting on errors from mget. |
3393 |
unsigned int check_execute= execute_set(memc, global_pairs, global_count); |
3394 |
||
3395 |
test_true(check_execute == global_count); |
|
148
by Brian Aker
Merged in new generate tests. |
3396 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3397 |
return TEST_SUCCESS; |
145.1.2
by brian@gir.tangent.org
More tests. |
3398 |
}
|
3399 |
||
736
by Brian Aker
Updates for CORK. |
3400 |
static test_return_t generate_data_with_stats(memcached_st *memc) |
351
by brian@localhost.localdomain
Pushing weighted ketama code. |
3401 |
{
|
364
by Brian Aker
Fixed memory leaks in test program. |
3402 |
memcached_stat_st *stat_p; |
630
by Brian Aker
Style cleanup |
3403 |
memcached_return_t rc; |
364
by Brian Aker
Fixed memory leaks in test program. |
3404 |
uint32_t host_index= 0; |
905.1.8
by Brian Aker
Better reporting on errors from mget. |
3405 |
unsigned int check_execute= execute_set(memc, global_pairs, global_count); |
3406 |
||
3407 |
test_true(check_execute == global_count); |
|
351
by brian@localhost.localdomain
Pushing weighted ketama code. |
3408 |
|
3409 |
//TODO: hosts used size stats
|
|
364
by Brian Aker
Fixed memory leaks in test program. |
3410 |
stat_p= memcached_stat(memc, NULL, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3411 |
test_true(stat_p); |
364
by Brian Aker
Fixed memory leaks in test program. |
3412 |
|
3413 |
for (host_index= 0; host_index < SERVERS_TO_CREATE; host_index++) |
|
351
by brian@localhost.localdomain
Pushing weighted ketama code. |
3414 |
{
|
534
by Brian Aker
Updating for 0.30 |
3415 |
/* This test was changes so that "make test" would work properlly */
|
3416 |
#ifdef DEBUG
|
|
794
by Brian Aker
Updating memcached_server_instance_st structure. |
3417 |
memcached_server_instance_st instance= |
792
by Brian Aker
Lots of compiler fixes. |
3418 |
memcached_server_instance_by_position(memc, host_index); |
725
by Brian Aker
Fix from --with-debug |
3419 |
|
3420 |
printf("\nserver %u|%s|%u bytes: %llu\n", host_index, instance->hostname, instance->port, (unsigned long long)(stat_p + host_index)->bytes); |
|
534
by Brian Aker
Updating for 0.30 |
3421 |
#endif
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3422 |
test_true((unsigned long long)(stat_p + host_index)->bytes); |
351
by brian@localhost.localdomain
Pushing weighted ketama code. |
3423 |
}
|
3424 |
||
364
by Brian Aker
Fixed memory leaks in test program. |
3425 |
memcached_stat_free(NULL, stat_p); |
3426 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3427 |
return TEST_SUCCESS; |
351
by brian@localhost.localdomain
Pushing weighted ketama code. |
3428 |
}
|
736
by Brian Aker
Updates for CORK. |
3429 |
static test_return_t generate_buffer_data(memcached_st *memc) |
244
by brian@gir.tangent.org
memcached_behavior() causes commands to be buffered until they are flushed to |
3430 |
{
|
537.3.1
by Monty Taylor
Fixed -Wconversion warnings. |
3431 |
size_t latch= 0; |
244
by brian@gir.tangent.org
memcached_behavior() causes commands to be buffered until they are flushed to |
3432 |
|
3433 |
latch= 1; |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
3434 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, latch); |
244
by brian@gir.tangent.org
memcached_behavior() causes commands to be buffered until they are flushed to |
3435 |
generate_data(memc); |
3436 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3437 |
return TEST_SUCCESS; |
244
by brian@gir.tangent.org
memcached_behavior() causes commands to be buffered until they are flushed to |
3438 |
}
|
3439 |
||
736
by Brian Aker
Updates for CORK. |
3440 |
static test_return_t get_read_count(memcached_st *memc) |
317.1.68
by brian@localhost.localdomain
More tests for consistent. |
3441 |
{
|
630
by Brian Aker
Style cleanup |
3442 |
memcached_return_t rc; |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
3443 |
memcached_st *memc_clone; |
3444 |
||
3445 |
memc_clone= memcached_clone(NULL, memc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3446 |
test_true(memc_clone); |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
3447 |
|
3448 |
memcached_server_add_with_weight(memc_clone, "localhost", 6666, 0); |
|
317.1.68
by brian@localhost.localdomain
More tests for consistent. |
3449 |
|
3450 |
{
|
|
3451 |
char *return_value; |
|
3452 |
size_t return_value_length; |
|
3453 |
uint32_t flags; |
|
3454 |
uint32_t count; |
|
3455 |
||
719
by Brian Aker
Small cleanup for for() to array. |
3456 |
for (size_t x= count= 0; x < global_count; x++) |
317.1.68
by brian@localhost.localdomain
More tests for consistent. |
3457 |
{
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
3458 |
return_value= memcached_get(memc_clone, global_keys[x], global_keys_length[x], |
317.1.68
by brian@localhost.localdomain
More tests for consistent. |
3459 |
&return_value_length, &flags, &rc); |
3460 |
if (rc == MEMCACHED_SUCCESS) |
|
3461 |
{
|
|
3462 |
count++; |
|
3463 |
if (return_value) |
|
3464 |
free(return_value); |
|
3465 |
}
|
|
3466 |
}
|
|
3467 |
}
|
|
3468 |
||
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
3469 |
memcached_free(memc_clone); |
317.1.68
by brian@localhost.localdomain
More tests for consistent. |
3470 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3471 |
return TEST_SUCCESS; |
317.1.68
by brian@localhost.localdomain
More tests for consistent. |
3472 |
}
|
3473 |
||
736
by Brian Aker
Updates for CORK. |
3474 |
static test_return_t get_read(memcached_st *memc) |
145.1.2
by brian@gir.tangent.org
More tests. |
3475 |
{
|
630
by Brian Aker
Style cleanup |
3476 |
memcached_return_t rc; |
145.1.2
by brian@gir.tangent.org
More tests. |
3477 |
|
3478 |
{
|
|
3479 |
char *return_value; |
|
3480 |
size_t return_value_length; |
|
226
by brian@wlan-guest-114.corp.yahoo.com
Turns out the protocol docs were in error, and that the size for 1.2 was a |
3481 |
uint32_t flags; |
145.1.2
by brian@gir.tangent.org
More tests. |
3482 |
|
719
by Brian Aker
Small cleanup for for() to array. |
3483 |
for (size_t x= 0; x < global_count; x++) |
145.1.2
by brian@gir.tangent.org
More tests. |
3484 |
{
|
3485 |
return_value= memcached_get(memc, global_keys[x], global_keys_length[x], |
|
3486 |
&return_value_length, &flags, &rc); |
|
3487 |
/*
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3488 |
test_true(return_value);
|
3489 |
test_true(rc == MEMCACHED_SUCCESS);
|
|
145.1.2
by brian@gir.tangent.org
More tests. |
3490 |
*/
|
3491 |
if (rc == MEMCACHED_SUCCESS && return_value) |
|
3492 |
free(return_value); |
|
3493 |
}
|
|
3494 |
}
|
|
148
by Brian Aker
Merged in new generate tests. |
3495 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3496 |
return TEST_SUCCESS; |
145.1.2
by brian@gir.tangent.org
More tests. |
3497 |
}
|
3498 |
||
736
by Brian Aker
Updates for CORK. |
3499 |
static test_return_t mget_read(memcached_st *memc) |
145.1.2
by brian@gir.tangent.org
More tests. |
3500 |
{
|
630
by Brian Aker
Style cleanup |
3501 |
memcached_return_t rc; |
145.1.2
by brian@gir.tangent.org
More tests. |
3502 |
|
905.1.12
by Brian Aker
Servers below 1.4.4 may have issues with this test. |
3503 |
if (! libmemcached_util_version_check(memc, 1, 4, 4)) |
3504 |
return TEST_SKIPPED; |
|
3505 |
||
281
by Brian Aker
Refactor of generate tests. |
3506 |
rc= memcached_mget(memc, global_keys, global_keys_length, global_count); |
905.1.12
by Brian Aker
Servers below 1.4.4 may have issues with this test. |
3507 |
|
3508 |
test_true_got(rc == MEMCACHED_SUCCESS, memcached_strerror(NULL, rc)); |
|
3509 |
||
3510 |
// Go fetch the keys and test to see if all of them were returned
|
|
905.1.9
by Brian Aker
Merge in additional checks on tests. |
3511 |
{
|
3512 |
size_t keys_returned; |
|
3513 |
test_true(fetch_all_results(memc, &keys_returned) == TEST_SUCCESS); |
|
3514 |
char buffer[30]; |
|
3515 |
snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)keys_returned); |
|
3516 |
test_true_got(global_count == keys_returned, buffer); |
|
3517 |
}
|
|
3518 |
||
148
by Brian Aker
Merged in new generate tests. |
3519 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3520 |
return TEST_SUCCESS; |
145.1.2
by brian@gir.tangent.org
More tests. |
3521 |
}
|
3522 |
||
736
by Brian Aker
Updates for CORK. |
3523 |
static test_return_t mget_read_result(memcached_st *memc) |
145.1.2
by brian@gir.tangent.org
More tests. |
3524 |
{
|
630
by Brian Aker
Style cleanup |
3525 |
memcached_return_t rc; |
145.1.2
by brian@gir.tangent.org
More tests. |
3526 |
|
905.1.12
by Brian Aker
Servers below 1.4.4 may have issues with this test. |
3527 |
if (! libmemcached_util_version_check(memc, 1, 4, 4)) |
3528 |
return TEST_SKIPPED; |
|
3529 |
||
281
by Brian Aker
Refactor of generate tests. |
3530 |
rc= memcached_mget(memc, global_keys, global_keys_length, global_count); |
905.1.11
by Brian Aker
See what happens if we skip the tests on the remote servers. |
3531 |
|
903.1.8
by Brian Aker
Cleanup test failures. |
3532 |
test_true_got(rc == MEMCACHED_SUCCESS, memcached_strerror(NULL, rc)); |
905.1.12
by Brian Aker
Servers below 1.4.4 may have issues with this test. |
3533 |
|
145.1.2
by brian@gir.tangent.org
More tests. |
3534 |
/* Turn this into a help function */
|
3535 |
{
|
|
3536 |
memcached_result_st results_obj; |
|
3537 |
memcached_result_st *results; |
|
3538 |
||
3539 |
results= memcached_result_create(memc, &results_obj); |
|
3540 |
||
3541 |
while ((results= memcached_fetch_result(memc, &results_obj, &rc))) |
|
3542 |
{
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3543 |
test_true(results); |
3544 |
test_true(rc == MEMCACHED_SUCCESS); |
|
145.1.2
by brian@gir.tangent.org
More tests. |
3545 |
}
|
3546 |
||
3547 |
memcached_result_free(&results_obj); |
|
3548 |
}
|
|
148
by Brian Aker
Merged in new generate tests. |
3549 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3550 |
return TEST_SUCCESS; |
145.1.2
by brian@gir.tangent.org
More tests. |
3551 |
}
|
3552 |
||
736
by Brian Aker
Updates for CORK. |
3553 |
static test_return_t mget_read_function(memcached_st *memc) |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
3554 |
{
|
630
by Brian Aker
Style cleanup |
3555 |
memcached_return_t rc; |
718
by Brian Aker
32/64 bit cleanup issue in tests. |
3556 |
size_t counter; |
630
by Brian Aker
Style cleanup |
3557 |
memcached_execute_fn callbacks[1]; |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
3558 |
|
905.1.12
by Brian Aker
Servers below 1.4.4 may have issues with this test. |
3559 |
if (! libmemcached_util_version_check(memc, 1, 4, 4)) |
3560 |
return TEST_SKIPPED; |
|
3561 |
||
281
by Brian Aker
Refactor of generate tests. |
3562 |
rc= memcached_mget(memc, global_keys, global_keys_length, global_count); |
905.1.11
by Brian Aker
See what happens if we skip the tests on the remote servers. |
3563 |
|
903.1.8
by Brian Aker
Cleanup test failures. |
3564 |
test_true_got(rc == MEMCACHED_SUCCESS, memcached_strerror(NULL, rc)); |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
3565 |
|
3566 |
callbacks[0]= &callback_counter; |
|
3567 |
counter= 0; |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
3568 |
rc= memcached_fetch_execute(memc, callbacks, (void *)&counter, 1); |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
3569 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3570 |
return TEST_SUCCESS; |
241
by Brian Aker
NEw code for the memcached_fetch_execute() function. |
3571 |
}
|
3572 |
||
736
by Brian Aker
Updates for CORK. |
3573 |
static test_return_t delete_generate(memcached_st *memc) |
237
by Brian Aker
Code for multi delete functions. |
3574 |
{
|
719
by Brian Aker
Small cleanup for for() to array. |
3575 |
for (size_t x= 0; x < global_count; x++) |
237
by Brian Aker
Code for multi delete functions. |
3576 |
{
|
3577 |
(void)memcached_delete(memc, global_keys[x], global_keys_length[x], (time_t)0); |
|
3578 |
}
|
|
3579 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3580 |
return TEST_SUCCESS; |
237
by Brian Aker
Code for multi delete functions. |
3581 |
}
|
3582 |
||
736
by Brian Aker
Updates for CORK. |
3583 |
static test_return_t delete_buffer_generate(memcached_st *memc) |
244
by brian@gir.tangent.org
memcached_behavior() causes commands to be buffered until they are flushed to |
3584 |
{
|
718
by Brian Aker
32/64 bit cleanup issue in tests. |
3585 |
uint64_t latch= 0; |
244
by brian@gir.tangent.org
memcached_behavior() causes commands to be buffered until they are flushed to |
3586 |
|
3587 |
latch= 1; |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
3588 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, latch); |
244
by brian@gir.tangent.org
memcached_behavior() causes commands to be buffered until they are flushed to |
3589 |
|
718
by Brian Aker
32/64 bit cleanup issue in tests. |
3590 |
for (size_t x= 0; x < global_count; x++) |
244
by brian@gir.tangent.org
memcached_behavior() causes commands to be buffered until they are flushed to |
3591 |
{
|
3592 |
(void)memcached_delete(memc, global_keys[x], global_keys_length[x], (time_t)0); |
|
3593 |
}
|
|
3594 |
||
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3595 |
return TEST_SUCCESS; |
244
by brian@gir.tangent.org
memcached_behavior() causes commands to be buffered until they are flushed to |
3596 |
}
|
3597 |
||
736
by Brian Aker
Updates for CORK. |
3598 |
static test_return_t add_host_test1(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3599 |
{
|
630
by Brian Aker
Style cleanup |
3600 |
memcached_return_t rc; |
143
by Brian Aker
Refactored out actual test code from test.c |
3601 |
char servername[]= "0.example.com"; |
3602 |
memcached_server_st *servers; |
|
3603 |
||
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
3604 |
servers= memcached_server_list_append_with_weight(NULL, servername, 400, 0, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3605 |
test_true(servers); |
3606 |
test_true(1 == memcached_server_list_count(servers)); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
3607 |
|
719
by Brian Aker
Small cleanup for for() to array. |
3608 |
for (size_t x= 2; x < 20; x++) |
143
by Brian Aker
Refactored out actual test code from test.c |
3609 |
{
|
3610 |
char buffer[SMALL_STRING_LEN]; |
|
3611 |
||
903.1.8
by Brian Aker
Cleanup test failures. |
3612 |
snprintf(buffer, SMALL_STRING_LEN, "%lu.example.com", (unsigned long)(400 +x)); |
590.1.4
by Trond Norbye
Strip trailing whitespaces |
3613 |
servers= memcached_server_list_append_with_weight(servers, buffer, 401, 0, |
143
by Brian Aker
Refactored out actual test code from test.c |
3614 |
&rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3615 |
test_true(rc == MEMCACHED_SUCCESS); |
3616 |
test_true(x == memcached_server_list_count(servers)); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
3617 |
}
|
3618 |
||
3619 |
rc= memcached_server_push(memc, servers); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3620 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
3621 |
rc= memcached_server_push(memc, servers); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3622 |
test_true(rc == MEMCACHED_SUCCESS); |
143
by Brian Aker
Refactored out actual test code from test.c |
3623 |
|
3624 |
memcached_server_list_free(servers); |
|
147
by Brian Aker
Updating test cases to return true/false |
3625 |
|
590.1.5
by Trond Norbye
Fix return type from test functions (should be TEST_SUCCESS and not 0) |
3626 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3627 |
}
|
3628 |
||
735
by Brian Aker
Merge Thomason's cork patch. |
3629 |
static test_return_t pre_nonblock(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3630 |
{
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
3631 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 0); |
143
by Brian Aker
Refactored out actual test code from test.c |
3632 |
|
632
by Brian Aker
Update for test system. |
3633 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3634 |
}
|
3635 |
||
735
by Brian Aker
Merge Thomason's cork patch. |
3636 |
static test_return_t pre_cork(memcached_st *memc) |
3637 |
{
|
|
3638 |
memcached_return_t rc; |
|
3639 |
bool set= true; |
|
763
by Brian Aker
Fix for OSX, where cork is slow.... |
3640 |
|
735
by Brian Aker
Merge Thomason's cork patch. |
3641 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_CORK, set); |
3642 |
||
763
by Brian Aker
Fix for OSX, where cork is slow.... |
3643 |
#ifdef __APPLE__
|
3644 |
return TEST_SKIPPED; |
|
3645 |
#endif
|
|
3646 |
||
735
by Brian Aker
Merge Thomason's cork patch. |
3647 |
if (rc == MEMCACHED_SUCCESS) |
3648 |
return TEST_SUCCESS; |
|
3649 |
||
3650 |
return TEST_SKIPPED; |
|
3651 |
}
|
|
3652 |
||
3653 |
static test_return_t pre_cork_and_nonblock(memcached_st *memc) |
|
3654 |
{
|
|
3655 |
test_return_t rc; |
|
800.1.2
by Trond Norbye
Add support for SASL |
3656 |
|
735
by Brian Aker
Merge Thomason's cork patch. |
3657 |
rc= pre_cork(memc); |
3658 |
||
763
by Brian Aker
Fix for OSX, where cork is slow.... |
3659 |
#ifdef __APPLE__
|
3660 |
return TEST_SKIPPED; |
|
3661 |
#endif
|
|
3662 |
||
735
by Brian Aker
Merge Thomason's cork patch. |
3663 |
if (rc != TEST_SUCCESS) |
3664 |
return rc; |
|
3665 |
||
3666 |
return pre_nonblock(memc); |
|
3667 |
}
|
|
3668 |
||
632
by Brian Aker
Update for test system. |
3669 |
static test_return_t pre_nonblock_binary(memcached_st *memc) |
418.1.2
by Trond Norbye
Run the async tests on the binary protocol as well |
3670 |
{
|
630
by Brian Aker
Style cleanup |
3671 |
memcached_return_t rc= MEMCACHED_FAILURE; |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
3672 |
memcached_st *memc_clone; |
418.1.2
by Trond Norbye
Run the async tests on the binary protocol as well |
3673 |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
3674 |
memc_clone= memcached_clone(NULL, memc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3675 |
test_true(memc_clone); |
418.1.2
by Trond Norbye
Run the async tests on the binary protocol as well |
3676 |
// The memcached_version needs to be done on a clone, because the server
|
3677 |
// will not toggle protocol on an connection.
|
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
3678 |
memcached_version(memc_clone); |
418.1.2
by Trond Norbye
Run the async tests on the binary protocol as well |
3679 |
|
904.1.3
by Brian Aker
Bump up version we test for binary protocol (per advice from Dormando). |
3680 |
if (libmemcached_util_version_check(memc_clone, 1, 4, 4)) |
418.1.2
by Trond Norbye
Run the async tests on the binary protocol as well |
3681 |
{
|
3682 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 0); |
|
3683 |
rc = memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3684 |
test_true(rc == MEMCACHED_SUCCESS); |
3685 |
test_true(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == 1); |
|
418.1.2
by Trond Norbye
Run the async tests on the binary protocol as well |
3686 |
}
|
632
by Brian Aker
Update for test system. |
3687 |
else
|
3688 |
{
|
|
3689 |
return TEST_SKIPPED; |
|
3690 |
}
|
|
418.1.2
by Trond Norbye
Run the async tests on the binary protocol as well |
3691 |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
3692 |
memcached_free(memc_clone); |
632
by Brian Aker
Update for test system. |
3693 |
|
3694 |
return rc == MEMCACHED_SUCCESS ? TEST_SUCCESS : TEST_SKIPPED; |
|
418.1.2
by Trond Norbye
Run the async tests on the binary protocol as well |
3695 |
}
|
3696 |
||
632
by Brian Aker
Update for test system. |
3697 |
static test_return_t pre_murmur(memcached_st *memc) |
317.1.2
by brian@gir-2.local
Patch for "murmur" hash algorithm. |
3698 |
{
|
910
by Brian Aker
Merge in bug fix for 677609 |
3699 |
#ifdef HAVE_MURMUR_HASH
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
3700 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_MURMUR); |
632
by Brian Aker
Update for test system. |
3701 |
return TEST_SUCCESS; |
910
by Brian Aker
Merge in bug fix for 677609 |
3702 |
#else
|
3703 |
(void) memc; |
|
3704 |
return TEST_SKIPPED; |
|
3705 |
#endif
|
|
317.1.2
by brian@gir-2.local
Patch for "murmur" hash algorithm. |
3706 |
}
|
3707 |
||
632
by Brian Aker
Update for test system. |
3708 |
static test_return_t pre_jenkins(memcached_st *memc) |
386
by brian@gir-3.local
Merging in Brian Pontz work on Jenkins hash |
3709 |
{
|
3710 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_JENKINS); |
|
3711 |
||
632
by Brian Aker
Update for test system. |
3712 |
return TEST_SUCCESS; |
386
by brian@gir-3.local
Merging in Brian Pontz work on Jenkins hash |
3713 |
}
|
3714 |
||
3715 |
||
632
by Brian Aker
Update for test system. |
3716 |
static test_return_t pre_md5(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3717 |
{
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
3718 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_MD5); |
143
by Brian Aker
Refactored out actual test code from test.c |
3719 |
|
632
by Brian Aker
Update for test system. |
3720 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3721 |
}
|
3722 |
||
632
by Brian Aker
Update for test system. |
3723 |
static test_return_t pre_crc(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3724 |
{
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
3725 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_CRC); |
143
by Brian Aker
Refactored out actual test code from test.c |
3726 |
|
632
by Brian Aker
Update for test system. |
3727 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3728 |
}
|
3729 |
||
632
by Brian Aker
Update for test system. |
3730 |
static test_return_t pre_hsieh(memcached_st *memc) |
186
by Brian Aker
Added MEMCACHED_HASH_HSIEH. |
3731 |
{
|
495
by Eric Lambert
Disable hsieh algorithm by default |
3732 |
#ifdef HAVE_HSIEH_HASH
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
3733 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_HSIEH); |
632
by Brian Aker
Update for test system. |
3734 |
return TEST_SUCCESS; |
495
by Eric Lambert
Disable hsieh algorithm by default |
3735 |
#else
|
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
3736 |
(void) memc; |
632
by Brian Aker
Update for test system. |
3737 |
return TEST_SKIPPED; |
495
by Eric Lambert
Disable hsieh algorithm by default |
3738 |
#endif
|
186
by Brian Aker
Added MEMCACHED_HASH_HSIEH. |
3739 |
}
|
3740 |
||
632
by Brian Aker
Update for test system. |
3741 |
static test_return_t pre_hash_fnv1_64(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3742 |
{
|
632
by Brian Aker
Update for test system. |
3743 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_MURMUR); |
143
by Brian Aker
Refactored out actual test code from test.c |
3744 |
|
632
by Brian Aker
Update for test system. |
3745 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3746 |
}
|
3747 |
||
632
by Brian Aker
Update for test system. |
3748 |
static test_return_t pre_hash_fnv1a_64(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3749 |
{
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
3750 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_FNV1A_64); |
143
by Brian Aker
Refactored out actual test code from test.c |
3751 |
|
632
by Brian Aker
Update for test system. |
3752 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3753 |
}
|
3754 |
||
632
by Brian Aker
Update for test system. |
3755 |
static test_return_t pre_hash_fnv1_32(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3756 |
{
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
3757 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_FNV1_32); |
143
by Brian Aker
Refactored out actual test code from test.c |
3758 |
|
632
by Brian Aker
Update for test system. |
3759 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3760 |
}
|
3761 |
||
632
by Brian Aker
Update for test system. |
3762 |
static test_return_t pre_hash_fnv1a_32(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3763 |
{
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
3764 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_FNV1A_32); |
143
by Brian Aker
Refactored out actual test code from test.c |
3765 |
|
632
by Brian Aker
Update for test system. |
3766 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3767 |
}
|
3768 |
||
632
by Brian Aker
Update for test system. |
3769 |
static test_return_t pre_behavior_ketama(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
3770 |
{
|
630
by Brian Aker
Style cleanup |
3771 |
memcached_return_t rc; |
317.1.66
by brian@localhost.localdomain
Cleanup of behaviors around ketama |
3772 |
uint64_t value; |
3773 |
||
3774 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA, 1); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3775 |
test_true(rc == MEMCACHED_SUCCESS); |
317.1.66
by brian@localhost.localdomain
Cleanup of behaviors around ketama |
3776 |
|
3777 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3778 |
test_true(value == 1); |
143
by Brian Aker
Refactored out actual test code from test.c |
3779 |
|
632
by Brian Aker
Update for test system. |
3780 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
3781 |
}
|
267.1.10
by Brian Aker
Clean up pointer issue. |
3782 |
|
632
by Brian Aker
Update for test system. |
3783 |
static test_return_t pre_behavior_ketama_weighted(memcached_st *memc) |
351
by brian@localhost.localdomain
Pushing weighted ketama code. |
3784 |
{
|
630
by Brian Aker
Style cleanup |
3785 |
memcached_return_t rc; |
351
by brian@localhost.localdomain
Pushing weighted ketama code. |
3786 |
uint64_t value; |
3787 |
||
3788 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED, 1); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3789 |
test_true(rc == MEMCACHED_SUCCESS); |
351
by brian@localhost.localdomain
Pushing weighted ketama code. |
3790 |
|
3791 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3792 |
test_true(value == 1); |
351
by brian@localhost.localdomain
Pushing weighted ketama code. |
3793 |
|
3794 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH, MEMCACHED_HASH_MD5); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3795 |
test_true(rc == MEMCACHED_SUCCESS); |
351
by brian@localhost.localdomain
Pushing weighted ketama code. |
3796 |
|
3797 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_HASH); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3798 |
test_true(value == MEMCACHED_HASH_MD5); |
632
by Brian Aker
Update for test system. |
3799 |
|
3800 |
return TEST_SUCCESS; |
|
351
by brian@localhost.localdomain
Pushing weighted ketama code. |
3801 |
}
|
353.1.1
by trond@localhost
Initial support for the binary protocol |
3802 |
|
632
by Brian Aker
Update for test system. |
3803 |
/**
|
3804 |
@note This should be testing to see if the server really supports the binary protocol.
|
|
3805 |
*/
|
|
3806 |
static test_return_t pre_binary(memcached_st *memc) |
|
353.1.1
by trond@localhost
Initial support for the binary protocol |
3807 |
{
|
630
by Brian Aker
Style cleanup |
3808 |
memcached_return_t rc= MEMCACHED_FAILURE; |
861
by Brian Aker
Fix for version on OSX |
3809 |
|
904.1.3
by Brian Aker
Bump up version we test for binary protocol (per advice from Dormando). |
3810 |
if (libmemcached_util_version_check(memc, 1, 4, 4)) |
357
by Trond Norbye
Do not try to run the binary protocol testsuite for pre-1.3 servers |
3811 |
{
|
3812 |
rc = memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3813 |
test_true(rc == MEMCACHED_SUCCESS); |
3814 |
test_true(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == 1); |
|
357
by Trond Norbye
Do not try to run the binary protocol testsuite for pre-1.3 servers |
3815 |
}
|
3816 |
||
632
by Brian Aker
Update for test system. |
3817 |
return rc == MEMCACHED_SUCCESS ? TEST_SUCCESS : TEST_SKIPPED; |
353.1.1
by trond@localhost
Initial support for the binary protocol |
3818 |
}
|
357
by Trond Norbye
Do not try to run the binary protocol testsuite for pre-1.3 servers |
3819 |
|
800.1.2
by Trond Norbye
Add support for SASL |
3820 |
static test_return_t pre_sasl(memcached_st *memc) |
3821 |
{
|
|
3822 |
memcached_return_t rc= MEMCACHED_FAILURE; |
|
3823 |
||
3824 |
#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
|
|
3825 |
const char *server= getenv("LIBMEMCACHED_TEST_SASL_SERVER"); |
|
3826 |
const char *user= getenv("LIBMEMCACHED_TEST_SASL_USERNAME"); |
|
3827 |
const char *pass= getenv("LIBMEMCACHED_TEST_SASL_PASSWORD"); |
|
3828 |
||
3829 |
if (server != NULL && user != NULL && pass != NULL) |
|
3830 |
{
|
|
3831 |
memcached_server_st *servers= memcached_servers_parse(server); |
|
3832 |
test_true(servers != NULL); |
|
3833 |
memcached_servers_reset(memc); |
|
3834 |
test_true(memcached_server_push(memc, servers) == MEMCACHED_SUCCESS); |
|
3835 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1); |
|
3836 |
rc= memcached_set_sasl_auth_data(memc, user, pass); |
|
3837 |
test_true(rc == MEMCACHED_SUCCESS); |
|
3838 |
}
|
|
3839 |
#else
|
|
3840 |
(void)memc; |
|
3841 |
#endif
|
|
3842 |
||
3843 |
return rc == MEMCACHED_SUCCESS ? TEST_SUCCESS : TEST_SKIPPED; |
|
3844 |
}
|
|
652
by Brian Aker
Merge code fix for replication non-block test failing instead of skipping on |
3845 |
|
632
by Brian Aker
Update for test system. |
3846 |
static test_return_t pre_replication(memcached_st *memc) |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
3847 |
{
|
640
by Brian Aker
Fix for replication test. |
3848 |
test_return_t test_rc; |
3849 |
test_rc= pre_binary(memc); |
|
3850 |
||
3851 |
if (test_rc != TEST_SUCCESS) |
|
3852 |
return test_rc; |
|
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
3853 |
|
3854 |
/*
|
|
3855 |
* Make sure that we store the item on all servers
|
|
3856 |
* (master + replicas == number of servers)
|
|
598.4.1
by Trond Norbye
Fixed compile failure due to wrong return value from function to detect if a testcase should be skipped or not |
3857 |
*/
|
630
by Brian Aker
Style cleanup |
3858 |
memcached_return_t rc; |
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
3859 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, |
695
by Brian Aker
number_of_hosts <-- encapsulated. |
3860 |
memcached_server_count(memc) - 1); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3861 |
test_true(rc == MEMCACHED_SUCCESS); |
3862 |
test_true(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS) == memcached_server_count(memc) - 1); |
|
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
3863 |
|
632
by Brian Aker
Update for test system. |
3864 |
return rc == MEMCACHED_SUCCESS ? TEST_SUCCESS : TEST_SKIPPED; |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
3865 |
}
|
3866 |
||
652
by Brian Aker
Merge code fix for replication non-block test failing instead of skipping on |
3867 |
|
632
by Brian Aker
Update for test system. |
3868 |
static test_return_t pre_replication_noblock(memcached_st *memc) |
546.1.1
by Trond Norbye
Bug 394442: Replication mget test fail on linux due to race conditions |
3869 |
{
|
652
by Brian Aker
Merge code fix for replication non-block test failing instead of skipping on |
3870 |
test_return_t rc; |
3871 |
||
3872 |
rc= pre_replication(memc); |
|
3873 |
if (rc != TEST_SUCCESS) |
|
3874 |
return rc; |
|
3875 |
||
3876 |
rc= pre_nonblock(memc); |
|
546.1.1
by Trond Norbye
Bug 394442: Replication mget test fail on linux due to race conditions |
3877 |
|
3878 |
return rc; |
|
3879 |
}
|
|
3880 |
||
652
by Brian Aker
Merge code fix for replication non-block test failing instead of skipping on |
3881 |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
3882 |
static void my_free(const memcached_st *ptr, void *mem, void *context) |
267.1.1
by brian@gir.local
Custom memory patch work (based on Sean Chittenden's patch) |
3883 |
{
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
3884 |
(void)context; |
3885 |
(void)ptr; |
|
639.1.4
by Trond Norbye
Updated the malloc tests so that they will break if we mix memory allocators. compile with -DHARD_MALLOC_TESTS to enable |
3886 |
#ifdef HARD_MALLOC_TESTS
|
3887 |
void *real_ptr= (mem == NULL) ? mem : (void*)((caddr_t)mem - 8); |
|
3888 |
free(real_ptr); |
|
3889 |
#else
|
|
267.1.1
by brian@gir.local
Custom memory patch work (based on Sean Chittenden's patch) |
3890 |
free(mem); |
639.1.4
by Trond Norbye
Updated the malloc tests so that they will break if we mix memory allocators. compile with -DHARD_MALLOC_TESTS to enable |
3891 |
#endif
|
267.1.1
by brian@gir.local
Custom memory patch work (based on Sean Chittenden's patch) |
3892 |
}
|
3893 |
||
652
by Brian Aker
Merge code fix for replication non-block test failing instead of skipping on |
3894 |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
3895 |
static void *my_malloc(const memcached_st *ptr, const size_t size, void *context) |
267.1.1
by brian@gir.local
Custom memory patch work (based on Sean Chittenden's patch) |
3896 |
{
|
749
by Brian Aker
New allocator interface. |
3897 |
(void)context; |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
3898 |
(void)ptr; |
639.1.4
by Trond Norbye
Updated the malloc tests so that they will break if we mix memory allocators. compile with -DHARD_MALLOC_TESTS to enable |
3899 |
#ifdef HARD_MALLOC_TESTS
|
3900 |
void *ret= malloc(size + 8); |
|
3901 |
if (ret != NULL) |
|
3902 |
{
|
|
3903 |
ret= (void*)((caddr_t)ret + 8); |
|
3904 |
}
|
|
3905 |
#else
|
|
535.2.1
by Trond Norbye
Refactor: clean up malloc/realloc/free/calloc |
3906 |
void *ret= malloc(size); |
639.1.4
by Trond Norbye
Updated the malloc tests so that they will break if we mix memory allocators. compile with -DHARD_MALLOC_TESTS to enable |
3907 |
#endif
|
3908 |
||
535.2.1
by Trond Norbye
Refactor: clean up malloc/realloc/free/calloc |
3909 |
if (ret != NULL) |
639.1.4
by Trond Norbye
Updated the malloc tests so that they will break if we mix memory allocators. compile with -DHARD_MALLOC_TESTS to enable |
3910 |
{
|
535.2.1
by Trond Norbye
Refactor: clean up malloc/realloc/free/calloc |
3911 |
memset(ret, 0xff, size); |
639.1.4
by Trond Norbye
Updated the malloc tests so that they will break if we mix memory allocators. compile with -DHARD_MALLOC_TESTS to enable |
3912 |
}
|
535.2.1
by Trond Norbye
Refactor: clean up malloc/realloc/free/calloc |
3913 |
|
3914 |
return ret; |
|
267.1.1
by brian@gir.local
Custom memory patch work (based on Sean Chittenden's patch) |
3915 |
}
|
3916 |
||
652
by Brian Aker
Merge code fix for replication non-block test failing instead of skipping on |
3917 |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
3918 |
static void *my_realloc(const memcached_st *ptr, void *mem, const size_t size, void *context) |
267.1.1
by brian@gir.local
Custom memory patch work (based on Sean Chittenden's patch) |
3919 |
{
|
749
by Brian Aker
New allocator interface. |
3920 |
(void)context; |
639.1.4
by Trond Norbye
Updated the malloc tests so that they will break if we mix memory allocators. compile with -DHARD_MALLOC_TESTS to enable |
3921 |
#ifdef HARD_MALLOC_TESTS
|
3922 |
void *real_ptr= (mem == NULL) ? NULL : (void*)((caddr_t)mem - 8); |
|
3923 |
void *nmem= realloc(real_ptr, size + 8); |
|
3924 |
||
3925 |
void *ret= NULL; |
|
3926 |
if (nmem != NULL) |
|
3927 |
{
|
|
3928 |
ret= (void*)((caddr_t)nmem + 8); |
|
3929 |
}
|
|
3930 |
||
3931 |
return ret; |
|
3932 |
#else
|
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
3933 |
(void)ptr; |
267.1.1
by brian@gir.local
Custom memory patch work (based on Sean Chittenden's patch) |
3934 |
return realloc(mem, size); |
639.1.4
by Trond Norbye
Updated the malloc tests so that they will break if we mix memory allocators. compile with -DHARD_MALLOC_TESTS to enable |
3935 |
#endif
|
267.1.1
by brian@gir.local
Custom memory patch work (based on Sean Chittenden's patch) |
3936 |
}
|
3937 |
||
652
by Brian Aker
Merge code fix for replication non-block test failing instead of skipping on |
3938 |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
3939 |
static void *my_calloc(const memcached_st *ptr, size_t nelem, const size_t size, void *context) |
535.2.1
by Trond Norbye
Refactor: clean up malloc/realloc/free/calloc |
3940 |
{
|
749
by Brian Aker
New allocator interface. |
3941 |
(void)context; |
639.1.4
by Trond Norbye
Updated the malloc tests so that they will break if we mix memory allocators. compile with -DHARD_MALLOC_TESTS to enable |
3942 |
#ifdef HARD_MALLOC_TESTS
|
3943 |
void *mem= my_malloc(ptr, nelem * size); |
|
3944 |
if (mem) |
|
3945 |
{
|
|
3946 |
memset(mem, 0, nelem * size); |
|
3947 |
}
|
|
3948 |
||
3949 |
return mem; |
|
3950 |
#else
|
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
3951 |
(void)ptr; |
535.2.1
by Trond Norbye
Refactor: clean up malloc/realloc/free/calloc |
3952 |
return calloc(nelem, size); |
639.1.4
by Trond Norbye
Updated the malloc tests so that they will break if we mix memory allocators. compile with -DHARD_MALLOC_TESTS to enable |
3953 |
#endif
|
535.2.1
by Trond Norbye
Refactor: clean up malloc/realloc/free/calloc |
3954 |
}
|
3955 |
||
652
by Brian Aker
Merge code fix for replication non-block test failing instead of skipping on |
3956 |
|
632
by Brian Aker
Update for test system. |
3957 |
static test_return_t set_prefix(memcached_st *memc) |
326
by Brian Aker
MEMCACHED_CALLBACK_PREFIX_KEY added (so domaining keys is now aailable in |
3958 |
{
|
630
by Brian Aker
Style cleanup |
3959 |
memcached_return_t rc; |
326
by Brian Aker
MEMCACHED_CALLBACK_PREFIX_KEY added (so domaining keys is now aailable in |
3960 |
const char *key= "mine"; |
3961 |
char *value; |
|
3962 |
||
3963 |
/* Make sure be default none exists */
|
|
3964 |
value= memcached_callback_get(memc, MEMCACHED_CALLBACK_PREFIX_KEY, &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3965 |
test_true(rc == MEMCACHED_FAILURE); |
326
by Brian Aker
MEMCACHED_CALLBACK_PREFIX_KEY added (so domaining keys is now aailable in |
3966 |
|
3967 |
/* Test a clean set */
|
|
3968 |
rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, (void *)key); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3969 |
test_true(rc == MEMCACHED_SUCCESS); |
326
by Brian Aker
MEMCACHED_CALLBACK_PREFIX_KEY added (so domaining keys is now aailable in |
3970 |
|
3971 |
value= memcached_callback_get(memc, MEMCACHED_CALLBACK_PREFIX_KEY, &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3972 |
test_true(memcmp(value, key, 4) == 0); |
3973 |
test_true(rc == MEMCACHED_SUCCESS); |
|
326
by Brian Aker
MEMCACHED_CALLBACK_PREFIX_KEY added (so domaining keys is now aailable in |
3974 |
|
3975 |
/* Test that we can turn it off */
|
|
3976 |
rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, NULL); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3977 |
test_true(rc == MEMCACHED_SUCCESS); |
326
by Brian Aker
MEMCACHED_CALLBACK_PREFIX_KEY added (so domaining keys is now aailable in |
3978 |
|
3979 |
value= memcached_callback_get(memc, MEMCACHED_CALLBACK_PREFIX_KEY, &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3980 |
test_true(rc == MEMCACHED_FAILURE); |
326
by Brian Aker
MEMCACHED_CALLBACK_PREFIX_KEY added (so domaining keys is now aailable in |
3981 |
|
3982 |
/* Now setup for main test */
|
|
3983 |
rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, (void *)key); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3984 |
test_true(rc == MEMCACHED_SUCCESS); |
326
by Brian Aker
MEMCACHED_CALLBACK_PREFIX_KEY added (so domaining keys is now aailable in |
3985 |
|
3986 |
value= memcached_callback_get(memc, MEMCACHED_CALLBACK_PREFIX_KEY, &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3987 |
test_true(rc == MEMCACHED_SUCCESS); |
3988 |
test_true(memcmp(value, key, 4) == 0); |
|
326
by Brian Aker
MEMCACHED_CALLBACK_PREFIX_KEY added (so domaining keys is now aailable in |
3989 |
|
338
by brian@gir-3.local
Clarified return type for prefix key in cases where it is too long. |
3990 |
/* Set to Zero, and then Set to something too large */
|
3991 |
{
|
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
3992 |
char long_key[255]; |
3993 |
memset(long_key, 0, 255); |
|
3994 |
||
338
by brian@gir-3.local
Clarified return type for prefix key in cases where it is too long. |
3995 |
rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, NULL); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3996 |
test_true(rc == MEMCACHED_SUCCESS); |
338
by brian@gir-3.local
Clarified return type for prefix key in cases where it is too long. |
3997 |
|
3998 |
value= memcached_callback_get(memc, MEMCACHED_CALLBACK_PREFIX_KEY, &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
3999 |
test_true(rc == MEMCACHED_FAILURE); |
4000 |
test_true(value == NULL); |
|
338
by brian@gir-3.local
Clarified return type for prefix key in cases where it is too long. |
4001 |
|
343
by brian@gir-3.local
More tests for Key prefix |
4002 |
/* Test a long key for failure */
|
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
4003 |
/* TODO, extend test to determine based on setting, what result should be */
|
928.1.2
by Brian Aker
Updates for strncpy. |
4004 |
strncpy(long_key, "Thisismorethentheallottednumberofcharacters", sizeof(long_key)); |
343
by brian@gir-3.local
More tests for Key prefix |
4005 |
rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, long_key); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4006 |
//test_true(rc == MEMCACHED_BAD_KEY_PROVIDED);
|
4007 |
test_true(rc == MEMCACHED_SUCCESS); |
|
343
by brian@gir-3.local
More tests for Key prefix |
4008 |
|
4009 |
/* Now test a key with spaces (which will fail from long key, since bad key is not set) */
|
|
928.1.2
by Brian Aker
Updates for strncpy. |
4010 |
strncpy(long_key, "This is more then the allotted number of characters", sizeof(long_key)); |
343
by brian@gir-3.local
More tests for Key prefix |
4011 |
rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, long_key); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4012 |
test_true(rc == MEMCACHED_BAD_KEY_PROVIDED); |
343
by brian@gir-3.local
More tests for Key prefix |
4013 |
|
4014 |
/* Test for a bad prefix, but with a short key */
|
|
4015 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_VERIFY_KEY, 1); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4016 |
test_true(rc == MEMCACHED_SUCCESS); |
343
by brian@gir-3.local
More tests for Key prefix |
4017 |
|
928.1.2
by Brian Aker
Updates for strncpy. |
4018 |
strncpy(long_key, "dog cat", sizeof(long_key)); |
338
by brian@gir-3.local
Clarified return type for prefix key in cases where it is too long. |
4019 |
rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_PREFIX_KEY, long_key); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4020 |
test_true(rc == MEMCACHED_BAD_KEY_PROVIDED); |
338
by brian@gir-3.local
Clarified return type for prefix key in cases where it is too long. |
4021 |
}
|
4022 |
||
632
by Brian Aker
Update for test system. |
4023 |
return TEST_SUCCESS; |
326
by Brian Aker
MEMCACHED_CALLBACK_PREFIX_KEY added (so domaining keys is now aailable in |
4024 |
}
|
4025 |
||
652
by Brian Aker
Merge code fix for replication non-block test failing instead of skipping on |
4026 |
|
539.1.1
by Trond Norbye
Deprecate the old callback interface to set the memory allocators |
4027 |
#ifdef MEMCACHED_ENABLE_DEPRECATED
|
632
by Brian Aker
Update for test system. |
4028 |
static test_return_t deprecated_set_memory_alloc(memcached_st *memc) |
267.1.1
by brian@gir.local
Custom memory patch work (based on Sean Chittenden's patch) |
4029 |
{
|
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
4030 |
void *test_ptr= NULL; |
4031 |
void *cb_ptr= NULL; |
|
4032 |
{
|
|
630
by Brian Aker
Style cleanup |
4033 |
memcached_malloc_fn malloc_cb= |
4034 |
(memcached_malloc_fn)my_malloc; |
|
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
4035 |
cb_ptr= *(void **)&malloc_cb; |
630
by Brian Aker
Style cleanup |
4036 |
memcached_return_t rc; |
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
4037 |
|
4038 |
rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_MALLOC_FUNCTION, cb_ptr); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4039 |
test_true(rc == MEMCACHED_SUCCESS); |
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
4040 |
test_ptr= memcached_callback_get(memc, MEMCACHED_CALLBACK_MALLOC_FUNCTION, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4041 |
test_true(rc == MEMCACHED_SUCCESS); |
4042 |
test_true(test_ptr == cb_ptr); |
|
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
4043 |
}
|
4044 |
||
4045 |
{
|
|
630
by Brian Aker
Style cleanup |
4046 |
memcached_realloc_fn realloc_cb= |
4047 |
(memcached_realloc_fn)my_realloc; |
|
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
4048 |
cb_ptr= *(void **)&realloc_cb; |
630
by Brian Aker
Style cleanup |
4049 |
memcached_return_t rc; |
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
4050 |
|
4051 |
rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_REALLOC_FUNCTION, cb_ptr); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4052 |
test_true(rc == MEMCACHED_SUCCESS); |
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
4053 |
test_ptr= memcached_callback_get(memc, MEMCACHED_CALLBACK_REALLOC_FUNCTION, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4054 |
test_true(rc == MEMCACHED_SUCCESS); |
4055 |
test_true(test_ptr == cb_ptr); |
|
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
4056 |
}
|
4057 |
||
4058 |
{
|
|
630
by Brian Aker
Style cleanup |
4059 |
memcached_free_fn free_cb= |
4060 |
(memcached_free_fn)my_free; |
|
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
4061 |
cb_ptr= *(void **)&free_cb; |
630
by Brian Aker
Style cleanup |
4062 |
memcached_return_t rc; |
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
4063 |
|
4064 |
rc= memcached_callback_set(memc, MEMCACHED_CALLBACK_FREE_FUNCTION, cb_ptr); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4065 |
test_true(rc == MEMCACHED_SUCCESS); |
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
4066 |
test_ptr= memcached_callback_get(memc, MEMCACHED_CALLBACK_FREE_FUNCTION, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4067 |
test_true(rc == MEMCACHED_SUCCESS); |
4068 |
test_true(test_ptr == cb_ptr); |
|
267.1.1
by brian@gir.local
Custom memory patch work (based on Sean Chittenden's patch) |
4069 |
}
|
632
by Brian Aker
Update for test system. |
4070 |
|
4071 |
return TEST_SUCCESS; |
|
535.2.1
by Trond Norbye
Refactor: clean up malloc/realloc/free/calloc |
4072 |
}
|
539.1.1
by Trond Norbye
Deprecate the old callback interface to set the memory allocators |
4073 |
#endif
|
535.2.1
by Trond Norbye
Refactor: clean up malloc/realloc/free/calloc |
4074 |
|
652
by Brian Aker
Merge code fix for replication non-block test failing instead of skipping on |
4075 |
|
632
by Brian Aker
Update for test system. |
4076 |
static test_return_t set_memory_alloc(memcached_st *memc) |
535.2.1
by Trond Norbye
Refactor: clean up malloc/realloc/free/calloc |
4077 |
{
|
630
by Brian Aker
Style cleanup |
4078 |
memcached_return_t rc; |
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4079 |
rc= memcached_set_memory_allocators(memc, NULL, my_free, |
749
by Brian Aker
New allocator interface. |
4080 |
my_realloc, my_calloc, NULL); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4081 |
test_true(rc == MEMCACHED_FAILURE); |
535.2.1
by Trond Norbye
Refactor: clean up malloc/realloc/free/calloc |
4082 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4083 |
rc= memcached_set_memory_allocators(memc, my_malloc, my_free, |
749
by Brian Aker
New allocator interface. |
4084 |
my_realloc, my_calloc, NULL); |
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4085 |
|
630
by Brian Aker
Style cleanup |
4086 |
memcached_malloc_fn mem_malloc; |
4087 |
memcached_free_fn mem_free; |
|
4088 |
memcached_realloc_fn mem_realloc; |
|
4089 |
memcached_calloc_fn mem_calloc; |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4090 |
memcached_get_memory_allocators(memc, &mem_malloc, &mem_free, |
4091 |
&mem_realloc, &mem_calloc); |
|
535.2.1
by Trond Norbye
Refactor: clean up malloc/realloc/free/calloc |
4092 |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4093 |
test_true(mem_malloc == my_malloc); |
4094 |
test_true(mem_realloc == my_realloc); |
|
4095 |
test_true(mem_calloc == my_calloc); |
|
4096 |
test_true(mem_free == my_free); |
|
267.1.1
by brian@gir.local
Custom memory patch work (based on Sean Chittenden's patch) |
4097 |
|
632
by Brian Aker
Update for test system. |
4098 |
return TEST_SUCCESS; |
267.1.1
by brian@gir.local
Custom memory patch work (based on Sean Chittenden's patch) |
4099 |
}
|
143
by Brian Aker
Refactored out actual test code from test.c |
4100 |
|
642
by Brian Aker
Adding in a consistent test for crc. |
4101 |
static test_return_t enable_consistent_crc(memcached_st *memc) |
4102 |
{
|
|
4103 |
test_return_t rc; |
|
4104 |
memcached_server_distribution_t value= MEMCACHED_DISTRIBUTION_CONSISTENT; |
|
4105 |
memcached_hash_t hash; |
|
4106 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, value); |
|
4107 |
if ((rc= pre_crc(memc)) != TEST_SUCCESS) |
|
4108 |
return rc; |
|
4109 |
||
4110 |
value= (memcached_server_distribution_t)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4111 |
test_true(value == MEMCACHED_DISTRIBUTION_CONSISTENT); |
642
by Brian Aker
Adding in a consistent test for crc. |
4112 |
|
4113 |
hash= (memcached_hash_t)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_HASH); |
|
4114 |
||
4115 |
if (hash != MEMCACHED_HASH_CRC) |
|
4116 |
return TEST_SKIPPED; |
|
4117 |
||
4118 |
return TEST_SUCCESS; |
|
4119 |
}
|
|
4120 |
||
4121 |
static test_return_t enable_consistent_hsieh(memcached_st *memc) |
|
195
by Brian Aker
Added tests for consistent hash. |
4122 |
{
|
632
by Brian Aker
Update for test system. |
4123 |
test_return_t rc; |
630
by Brian Aker
Style cleanup |
4124 |
memcached_server_distribution_t value= MEMCACHED_DISTRIBUTION_CONSISTENT; |
4125 |
memcached_hash_t hash; |
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
4126 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION, value); |
632
by Brian Aker
Update for test system. |
4127 |
if ((rc= pre_hsieh(memc)) != TEST_SUCCESS) |
4128 |
return rc; |
|
202
by brian@gir.local
Extending test cases (Hsieh has benchmarks now run by default) |
4129 |
|
630
by Brian Aker
Style cleanup |
4130 |
value= (memcached_server_distribution_t)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4131 |
test_true(value == MEMCACHED_DISTRIBUTION_CONSISTENT); |
202
by brian@gir.local
Extending test cases (Hsieh has benchmarks now run by default) |
4132 |
|
630
by Brian Aker
Style cleanup |
4133 |
hash= (memcached_hash_t)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_HASH); |
632
by Brian Aker
Update for test system. |
4134 |
|
4135 |
if (hash != MEMCACHED_HASH_HSIEH) |
|
4136 |
return TEST_SKIPPED; |
|
4137 |
||
4138 |
||
4139 |
return TEST_SUCCESS; |
|
195
by Brian Aker
Added tests for consistent hash. |
4140 |
}
|
4141 |
||
632
by Brian Aker
Update for test system. |
4142 |
static test_return_t enable_cas(memcached_st *memc) |
171
by Brian Aker
Updates for pkg-config. |
4143 |
{
|
4144 |
unsigned int set= 1; |
|
4145 |
||
856
by Brian Aker
Merge in version util. |
4146 |
if (libmemcached_util_version_check(memc, 1, 2, 4)) |
171
by Brian Aker
Updates for pkg-config. |
4147 |
{
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
4148 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, set); |
171
by Brian Aker
Updates for pkg-config. |
4149 |
|
632
by Brian Aker
Update for test system. |
4150 |
return TEST_SUCCESS; |
171
by Brian Aker
Updates for pkg-config. |
4151 |
}
|
4152 |
||
632
by Brian Aker
Update for test system. |
4153 |
return TEST_SKIPPED; |
171
by Brian Aker
Updates for pkg-config. |
4154 |
}
|
4155 |
||
736
by Brian Aker
Updates for CORK. |
4156 |
static test_return_t check_for_1_2_3(memcached_st *memc) |
162
by Brian Aker
More tests, and new code for append/prepend. |
4157 |
{
|
4158 |
memcached_version(memc); |
|
792
by Brian Aker
Lots of compiler fixes. |
4159 |
|
794
by Brian Aker
Updating memcached_server_instance_st structure. |
4160 |
memcached_server_instance_st instance= |
792
by Brian Aker
Lots of compiler fixes. |
4161 |
memcached_server_instance_by_position(memc, 0); |
162
by Brian Aker
More tests, and new code for append/prepend. |
4162 |
|
710
by Brian Aker
Fix test cases for encapsulation. |
4163 |
if ((instance->major_version >= 1 && (instance->minor_version == 2 && instance->micro_version >= 4)) |
4164 |
|| instance->minor_version > 2) |
|
856
by Brian Aker
Merge in version util. |
4165 |
{
|
632
by Brian Aker
Update for test system. |
4166 |
return TEST_SUCCESS; |
856
by Brian Aker
Merge in version util. |
4167 |
}
|
162
by Brian Aker
More tests, and new code for append/prepend. |
4168 |
|
632
by Brian Aker
Update for test system. |
4169 |
return TEST_SKIPPED; |
162
by Brian Aker
More tests, and new code for append/prepend. |
4170 |
}
|
4171 |
||
736
by Brian Aker
Updates for CORK. |
4172 |
static test_return_t pre_unix_socket(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
4173 |
{
|
630
by Brian Aker
Style cleanup |
4174 |
memcached_return_t rc; |
143
by Brian Aker
Refactored out actual test code from test.c |
4175 |
struct stat buf; |
4176 |
||
695
by Brian Aker
number_of_hosts <-- encapsulated. |
4177 |
memcached_servers_reset(memc); |
143
by Brian Aker
Refactored out actual test code from test.c |
4178 |
|
4179 |
if (stat("/tmp/memcached.socket", &buf)) |
|
632
by Brian Aker
Update for test system. |
4180 |
return TEST_SKIPPED; |
143
by Brian Aker
Refactored out actual test code from test.c |
4181 |
|
397
by brian@gir-3.local
Incomming code for additions in keys (see Changelog) |
4182 |
rc= memcached_server_add_unix_socket_with_weight(memc, "/tmp/memcached.socket", 0); |
143
by Brian Aker
Refactored out actual test code from test.c |
4183 |
|
632
by Brian Aker
Update for test system. |
4184 |
return ( rc == MEMCACHED_SUCCESS ? TEST_SUCCESS : TEST_FAILURE ); |
143
by Brian Aker
Refactored out actual test code from test.c |
4185 |
}
|
4186 |
||
736
by Brian Aker
Updates for CORK. |
4187 |
static test_return_t pre_nodelay(memcached_st *memc) |
143
by Brian Aker
Refactored out actual test code from test.c |
4188 |
{
|
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
4189 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 0); |
4190 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, 0); |
|
143
by Brian Aker
Refactored out actual test code from test.c |
4191 |
|
632
by Brian Aker
Update for test system. |
4192 |
return TEST_SUCCESS; |
143
by Brian Aker
Refactored out actual test code from test.c |
4193 |
}
|
4194 |
||
736
by Brian Aker
Updates for CORK. |
4195 |
static test_return_t pre_settimer(memcached_st *memc) |
356
by brian@localhost.localdomain
Added MEMCACHED_BEHAVIOR_SND_TIMEOUT, MEMCACHED_BEHAVIOR_RCV_TIMEOUT |
4196 |
{
|
4197 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SND_TIMEOUT, 1000); |
|
4198 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_RCV_TIMEOUT, 1000); |
|
4199 |
||
632
by Brian Aker
Update for test system. |
4200 |
return TEST_SUCCESS; |
356
by brian@localhost.localdomain
Added MEMCACHED_BEHAVIOR_SND_TIMEOUT, MEMCACHED_BEHAVIOR_RCV_TIMEOUT |
4201 |
}
|
4202 |
||
736
by Brian Aker
Updates for CORK. |
4203 |
static test_return_t poll_timeout(memcached_st *memc) |
175
by Brian Aker
memcached_behavior_set() can now modify the poll timeout |
4204 |
{
|
537.3.1
by Monty Taylor
Fixed -Wconversion warnings. |
4205 |
size_t timeout; |
175
by Brian Aker
memcached_behavior_set() can now modify the poll timeout |
4206 |
|
4207 |
timeout= 100; |
|
4208 |
||
317.1.8
by brian@gir-2.local
Fixed headers for includes. |
4209 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, timeout); |
175
by Brian Aker
memcached_behavior_set() can now modify the poll timeout |
4210 |
|
570.1.1
by Trond Norbye
Fix compilation issues with gcc 4.4.1 on macosx |
4211 |
timeout= (size_t)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT); |
175
by Brian Aker
memcached_behavior_set() can now modify the poll timeout |
4212 |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4213 |
test_true(timeout == 100); |
175
by Brian Aker
memcached_behavior_set() can now modify the poll timeout |
4214 |
|
632
by Brian Aker
Update for test system. |
4215 |
return TEST_SUCCESS; |
175
by Brian Aker
memcached_behavior_set() can now modify the poll timeout |
4216 |
}
|
4217 |
||
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
4218 |
static test_return_t noreply_test(memcached_st *memc) |
429
by Trond Norbye
Implement memcached_behavior_noreply |
4219 |
{
|
630
by Brian Aker
Style cleanup |
4220 |
memcached_return_t ret; |
429
by Trond Norbye
Implement memcached_behavior_noreply |
4221 |
ret= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NOREPLY, 1); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4222 |
test_true(ret == MEMCACHED_SUCCESS); |
429
by Trond Norbye
Implement memcached_behavior_noreply |
4223 |
ret= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 1); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4224 |
test_true(ret == MEMCACHED_SUCCESS); |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4225 |
ret= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, 1); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4226 |
test_true(ret == MEMCACHED_SUCCESS); |
4227 |
test_true(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_NOREPLY) == 1); |
|
4228 |
test_true(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS) == 1); |
|
4229 |
test_true(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS) == 1); |
|
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4230 |
|
4231 |
for (int count=0; count < 5; ++count) |
|
4232 |
{
|
|
719
by Brian Aker
Small cleanup for for() to array. |
4233 |
for (size_t x= 0; x < 100; ++x) |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4234 |
{
|
4235 |
char key[10]; |
|
903.1.8
by Brian Aker
Cleanup test failures. |
4236 |
int check_length= (size_t)snprintf(key, sizeof(key), "%lu", (unsigned long)x); |
4237 |
test_false((size_t)check_length >= sizeof(key) || check_length < 0); |
|
4238 |
||
4239 |
size_t len= (size_t)check_length; |
|
4240 |
||
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4241 |
switch (count) |
4242 |
{
|
|
4243 |
case 0: |
|
632
by Brian Aker
Update for test system. |
4244 |
ret= memcached_add(memc, key, len, key, len, 0, 0); |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4245 |
break; |
4246 |
case 1: |
|
632
by Brian Aker
Update for test system. |
4247 |
ret= memcached_replace(memc, key, len, key, len, 0, 0); |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4248 |
break; |
4249 |
case 2: |
|
632
by Brian Aker
Update for test system. |
4250 |
ret= memcached_set(memc, key, len, key, len, 0, 0); |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4251 |
break; |
4252 |
case 3: |
|
632
by Brian Aker
Update for test system. |
4253 |
ret= memcached_append(memc, key, len, key, len, 0, 0); |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4254 |
break; |
4255 |
case 4: |
|
632
by Brian Aker
Update for test system. |
4256 |
ret= memcached_prepend(memc, key, len, key, len, 0, 0); |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4257 |
break; |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
4258 |
default: |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4259 |
test_true(count); |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
4260 |
break; |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4261 |
}
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4262 |
test_true(ret == MEMCACHED_SUCCESS || ret == MEMCACHED_BUFFERED); |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4263 |
}
|
4264 |
||
4265 |
/*
|
|
4266 |
** NOTE: Don't ever do this in your code! this is not a supported use of the
|
|
4267 |
** API and is _ONLY_ done this way to verify that the library works the
|
|
4268 |
** way it is supposed to do!!!!
|
|
4269 |
*/
|
|
4270 |
int no_msg=0; |
|
725
by Brian Aker
Fix from --with-debug |
4271 |
for (uint32_t x= 0; x < memcached_server_count(memc); ++x) |
711
by Brian Aker
Final bits of abstraction. |
4272 |
{
|
794
by Brian Aker
Updating memcached_server_instance_st structure. |
4273 |
memcached_server_instance_st instance= |
792
by Brian Aker
Lots of compiler fixes. |
4274 |
memcached_server_instance_by_position(memc, x); |
711
by Brian Aker
Final bits of abstraction. |
4275 |
no_msg+=(int)(instance->cursor_active); |
4276 |
}
|
|
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4277 |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4278 |
test_true(no_msg == 0); |
4279 |
test_true(memcached_flush_buffers(memc) == MEMCACHED_SUCCESS); |
|
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4280 |
|
4281 |
/*
|
|
4282 |
** Now validate that all items was set properly!
|
|
4283 |
*/
|
|
719
by Brian Aker
Small cleanup for for() to array. |
4284 |
for (size_t x= 0; x < 100; ++x) |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4285 |
{
|
4286 |
char key[10]; |
|
719
by Brian Aker
Small cleanup for for() to array. |
4287 |
|
903.1.8
by Brian Aker
Cleanup test failures. |
4288 |
int check_length= (size_t)snprintf(key, sizeof(key), "%lu", (unsigned long)x); |
4289 |
||
4290 |
test_false((size_t)check_length >= sizeof(key) || check_length < 0); |
|
4291 |
||
4292 |
size_t len= (size_t)check_length; |
|
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4293 |
size_t length; |
4294 |
uint32_t flags; |
|
4295 |
char* value=memcached_get(memc, key, strlen(key), |
|
4296 |
&length, &flags, &ret); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4297 |
test_true(ret == MEMCACHED_SUCCESS && value != NULL); |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4298 |
switch (count) |
4299 |
{
|
|
4300 |
case 0: /* FALLTHROUGH */ |
|
4301 |
case 1: /* FALLTHROUGH */ |
|
4302 |
case 2: |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4303 |
test_true(strncmp(value, key, len) == 0); |
4304 |
test_true(len == length); |
|
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4305 |
break; |
4306 |
case 3: |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4307 |
test_true(length == len * 2); |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4308 |
break; |
4309 |
case 4: |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4310 |
test_true(length == len * 3); |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4311 |
break; |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
4312 |
default: |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4313 |
test_true(count); |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
4314 |
break; |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4315 |
}
|
4316 |
free(value); |
|
4317 |
}
|
|
4318 |
}
|
|
4319 |
||
4320 |
/* Try setting an illegal cas value (should not return an error to
|
|
4321 |
* the caller (because we don't expect a return message from the server)
|
|
4322 |
*/
|
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
4323 |
const char* keys[]= {"0"}; |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4324 |
size_t lengths[]= {1}; |
4325 |
size_t length; |
|
4326 |
uint32_t flags; |
|
4327 |
memcached_result_st results_obj; |
|
4328 |
memcached_result_st *results; |
|
527
by brian@localhost.localdomain
Cleaned up structures for holes. |
4329 |
ret= memcached_mget(memc, keys, lengths, 1); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4330 |
test_true(ret == MEMCACHED_SUCCESS); |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4331 |
|
527
by brian@localhost.localdomain
Cleaned up structures for holes. |
4332 |
results= memcached_result_create(memc, &results_obj); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4333 |
test_true(results); |
527
by brian@localhost.localdomain
Cleaned up structures for holes. |
4334 |
results= memcached_fetch_result(memc, &results_obj, &ret); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4335 |
test_true(results); |
4336 |
test_true(ret == MEMCACHED_SUCCESS); |
|
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4337 |
uint64_t cas= memcached_result_cas(results); |
4338 |
memcached_result_free(&results_obj); |
|
4339 |
||
4340 |
ret= memcached_cas(memc, keys[0], lengths[0], keys[0], lengths[0], 0, 0, cas); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4341 |
test_true(ret == MEMCACHED_SUCCESS); |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4342 |
|
4343 |
/*
|
|
4344 |
* The item will have a new cas value, so try to set it again with the old
|
|
4345 |
* value. This should fail!
|
|
4346 |
*/
|
|
4347 |
ret= memcached_cas(memc, keys[0], lengths[0], keys[0], lengths[0], 0, 0, cas); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4348 |
test_true(ret == MEMCACHED_SUCCESS); |
4349 |
test_true(memcached_flush_buffers(memc) == MEMCACHED_SUCCESS); |
|
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4350 |
char* value=memcached_get(memc, keys[0], lengths[0], &length, &flags, &ret); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4351 |
test_true(ret == MEMCACHED_SUCCESS && value != NULL); |
445
by Trond Norbye
Implemented support for noreply in the binary protocol |
4352 |
free(value); |
440
by Trond Norbye
Fix connect bug in memcached_flush_buffers and syntax bug in noreply |
4353 |
|
438
by Trond Norbye
Remove compiler warnings from test suite |
4354 |
return TEST_SUCCESS; |
429
by Trond Norbye
Implement memcached_behavior_noreply |
4355 |
}
|
143
by Brian Aker
Refactored out actual test code from test.c |
4356 |
|
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
4357 |
static test_return_t analyzer_test(memcached_st *memc) |
439
by Toru Maesaka
Added cluster analysis functionality to the library and memstat |
4358 |
{
|
630
by Brian Aker
Style cleanup |
4359 |
memcached_return_t rc; |
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
4360 |
memcached_stat_st *memc_stat; |
439
by Toru Maesaka
Added cluster analysis functionality to the library and memstat |
4361 |
memcached_analysis_st *report; |
4362 |
||
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
4363 |
memc_stat= memcached_stat(memc, NULL, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4364 |
test_true(rc == MEMCACHED_SUCCESS); |
4365 |
test_true(memc_stat); |
|
439
by Toru Maesaka
Added cluster analysis functionality to the library and memstat |
4366 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4367 |
report= memcached_analyze(memc, memc_stat, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4368 |
test_true(rc == MEMCACHED_SUCCESS); |
4369 |
test_true(report); |
|
439
by Toru Maesaka
Added cluster analysis functionality to the library and memstat |
4370 |
|
4371 |
free(report); |
|
537.1.1
by Monty Taylor
Aligned configure.ac with libdizzle and gearman. |
4372 |
memcached_stat_free(NULL, memc_stat); |
439
by Toru Maesaka
Added cluster analysis functionality to the library and memstat |
4373 |
|
443
by Trond Norbye
Source cleanup (remove compiler warnings ++) |
4374 |
return TEST_SUCCESS; |
439
by Toru Maesaka
Added cluster analysis functionality to the library and memstat |
4375 |
}
|
4376 |
||
526
by brian@localhost.localdomain
Added new memcached_dump() command. |
4377 |
/* Count the objects */
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4378 |
static memcached_return_t callback_dump_counter(const memcached_st *ptr, |
4379 |
const char *key, |
|
4380 |
size_t key_length, |
|
744
by Brian Aker
Partial patch on pass through to fix issues with trigger writers not |
4381 |
void *context) |
526
by brian@localhost.localdomain
Added new memcached_dump() command. |
4382 |
{
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4383 |
(void)ptr; (void)key; (void)key_length; |
718
by Brian Aker
32/64 bit cleanup issue in tests. |
4384 |
size_t *counter= (size_t *)context; |
526
by brian@localhost.localdomain
Added new memcached_dump() command. |
4385 |
|
4386 |
*counter= *counter + 1; |
|
4387 |
||
4388 |
return MEMCACHED_SUCCESS; |
|
4389 |
}
|
|
4390 |
||
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
4391 |
static test_return_t dump_test(memcached_st *memc) |
526
by brian@localhost.localdomain
Added new memcached_dump() command. |
4392 |
{
|
630
by Brian Aker
Style cleanup |
4393 |
memcached_return_t rc; |
718
by Brian Aker
32/64 bit cleanup issue in tests. |
4394 |
size_t counter= 0; |
630
by Brian Aker
Style cleanup |
4395 |
memcached_dump_fn callbacks[1]; |
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
4396 |
test_return_t main_rc; |
526
by brian@localhost.localdomain
Added new memcached_dump() command. |
4397 |
|
4398 |
callbacks[0]= &callback_dump_counter; |
|
4399 |
||
4400 |
/* No support for Binary protocol yet */
|
|
629
by Brian Aker
Additional flag removal. |
4401 |
if (memc->flags.binary_protocol) |
526
by brian@localhost.localdomain
Added new memcached_dump() command. |
4402 |
return TEST_SUCCESS; |
4403 |
||
4404 |
main_rc= set_test3(memc); |
|
4405 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4406 |
test_true (main_rc == TEST_SUCCESS); |
526
by brian@localhost.localdomain
Added new memcached_dump() command. |
4407 |
|
4408 |
rc= memcached_dump(memc, callbacks, (void *)&counter, 1); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4409 |
test_true(rc == MEMCACHED_SUCCESS); |
526
by brian@localhost.localdomain
Added new memcached_dump() command. |
4410 |
|
4411 |
/* We may have more then 32 if our previous flush has not completed */
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4412 |
test_true(counter >= 32); |
526
by brian@localhost.localdomain
Added new memcached_dump() command. |
4413 |
|
4414 |
return TEST_SUCCESS; |
|
4415 |
}
|
|
4416 |
||
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
4417 |
#ifdef HAVE_LIBMEMCACHEDUTIL
|
632
by Brian Aker
Update for test system. |
4418 |
static void* connection_release(void *arg) |
620
by Brian Aker
Updated tests to use new macro (less assert()). |
4419 |
{
|
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
4420 |
struct { |
4421 |
memcached_pool_st* pool; |
|
4422 |
memcached_st* mmc; |
|
4423 |
} *resource= arg; |
|
4424 |
||
4425 |
usleep(250); |
|
506
by Trond Norbye
Fixed up review comments from Brian |
4426 |
assert(memcached_pool_push(resource->pool, resource->mmc) == MEMCACHED_SUCCESS); |
509
by Monty Taylor
Enabled warnings=errors for GCC and then made things compile. Had to turn off |
4427 |
return arg; |
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
4428 |
}
|
4429 |
||
903.1.10
by Brian Aker
Merge in enabling of if to correctly only dump servers during failure. |
4430 |
#define POOL_SIZE 10
|
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
4431 |
static test_return_t connection_pool_test(memcached_st *memc) |
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
4432 |
{
|
903.1.10
by Brian Aker
Merge in enabling of if to correctly only dump servers during failure. |
4433 |
memcached_pool_st* pool= memcached_pool_create(memc, 5, POOL_SIZE); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4434 |
test_true(pool != NULL); |
903.1.10
by Brian Aker
Merge in enabling of if to correctly only dump servers during failure. |
4435 |
memcached_st *mmc[POOL_SIZE]; |
630
by Brian Aker
Style cleanup |
4436 |
memcached_return_t rc; |
506
by Trond Norbye
Fixed up review comments from Brian |
4437 |
|
903.1.10
by Brian Aker
Merge in enabling of if to correctly only dump servers during failure. |
4438 |
for (size_t x= 0; x < POOL_SIZE; ++x) |
719
by Brian Aker
Small cleanup for for() to array. |
4439 |
{
|
506
by Trond Norbye
Fixed up review comments from Brian |
4440 |
mmc[x]= memcached_pool_pop(pool, false, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4441 |
test_true(mmc[x] != NULL); |
4442 |
test_true(rc == MEMCACHED_SUCCESS); |
|
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
4443 |
}
|
4444 |
||
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4445 |
test_true(memcached_pool_pop(pool, false, &rc) == NULL); |
4446 |
test_true(rc == MEMCACHED_SUCCESS); |
|
506
by Trond Norbye
Fixed up review comments from Brian |
4447 |
|
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
4448 |
pthread_t tid; |
4449 |
struct { |
|
4450 |
memcached_pool_st* pool; |
|
4451 |
memcached_st* mmc; |
|
4452 |
} item= { .pool = pool, .mmc = mmc[9] }; |
|
4453 |
pthread_create(&tid, NULL, connection_release, &item); |
|
506
by Trond Norbye
Fixed up review comments from Brian |
4454 |
mmc[9]= memcached_pool_pop(pool, true, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4455 |
test_true(rc == MEMCACHED_SUCCESS); |
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
4456 |
pthread_join(tid, NULL); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4457 |
test_true(mmc[9] == item.mmc); |
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
4458 |
const char *key= "key"; |
4459 |
size_t keylen= strlen(key); |
|
4460 |
||
4461 |
// verify that I can do ops with all connections
|
|
4462 |
rc= memcached_set(mmc[0], key, keylen, "0", 1, 0, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4463 |
test_true(rc == MEMCACHED_SUCCESS); |
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
4464 |
|
903.1.10
by Brian Aker
Merge in enabling of if to correctly only dump servers during failure. |
4465 |
for (size_t x= 0; x < POOL_SIZE; ++x) |
719
by Brian Aker
Small cleanup for for() to array. |
4466 |
{
|
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
4467 |
uint64_t number_value; |
4468 |
rc= memcached_increment(mmc[x], key, keylen, 1, &number_value); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4469 |
test_true(rc == MEMCACHED_SUCCESS); |
4470 |
test_true(number_value == (x+1)); |
|
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
4471 |
}
|
4472 |
||
4473 |
// Release them..
|
|
903.1.10
by Brian Aker
Merge in enabling of if to correctly only dump servers during failure. |
4474 |
for (size_t x= 0; x < POOL_SIZE; ++x) |
719
by Brian Aker
Small cleanup for for() to array. |
4475 |
{
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4476 |
test_true(memcached_pool_push(pool, mmc[x]) == MEMCACHED_SUCCESS); |
719
by Brian Aker
Small cleanup for for() to array. |
4477 |
}
|
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
4478 |
|
584.1.1
by Trond Norbye
RFE: It should be possible to set behavior flags on a pool |
4479 |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4480 |
/* verify that I can set behaviors on the pool when I don't have all
|
584.1.1
by Trond Norbye
RFE: It should be possible to set behavior flags on a pool |
4481 |
* of the connections in the pool. It should however be enabled
|
4482 |
* when I push the item into the pool
|
|
4483 |
*/
|
|
4484 |
mmc[0]= memcached_pool_pop(pool, false, &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4485 |
test_true(mmc[0] != NULL); |
584.1.1
by Trond Norbye
RFE: It should be possible to set behavior flags on a pool |
4486 |
|
4487 |
rc= memcached_pool_behavior_set(pool, MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK, 9999); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4488 |
test_true(rc == MEMCACHED_SUCCESS); |
584.1.1
by Trond Norbye
RFE: It should be possible to set behavior flags on a pool |
4489 |
|
4490 |
mmc[1]= memcached_pool_pop(pool, false, &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4491 |
test_true(mmc[1] != NULL); |
584.1.1
by Trond Norbye
RFE: It should be possible to set behavior flags on a pool |
4492 |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4493 |
test_true(memcached_behavior_get(mmc[1], MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK) == 9999); |
4494 |
test_true(memcached_pool_push(pool, mmc[1]) == MEMCACHED_SUCCESS); |
|
4495 |
test_true(memcached_pool_push(pool, mmc[0]) == MEMCACHED_SUCCESS); |
|
584.1.1
by Trond Norbye
RFE: It should be possible to set behavior flags on a pool |
4496 |
|
4497 |
mmc[0]= memcached_pool_pop(pool, false, &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4498 |
test_true(memcached_behavior_get(mmc[0], MEMCACHED_BEHAVIOR_IO_MSG_WATERMARK) == 9999); |
4499 |
test_true(memcached_pool_push(pool, mmc[0]) == MEMCACHED_SUCCESS); |
|
4500 |
||
4501 |
test_true(memcached_pool_destroy(pool) == memc); |
|
903.1.10
by Brian Aker
Merge in enabling of if to correctly only dump servers during failure. |
4502 |
|
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
4503 |
return TEST_SUCCESS; |
4504 |
}
|
|
845
by Brian Aker
Added libmemcached_ping() to memcached utility library. |
4505 |
|
856
by Brian Aker
Merge in version util. |
4506 |
static test_return_t util_version_test(memcached_st *memc) |
4507 |
{
|
|
4508 |
bool if_successful; |
|
4509 |
||
4510 |
if_successful= libmemcached_util_version_check(memc, 0, 0, 0); |
|
4511 |
test_true(if_successful == true); |
|
4512 |
||
4513 |
if_successful= libmemcached_util_version_check(memc, 9, 9, 9); |
|
903.1.3
by Brian Aker
Fix/debug for FreeBSD failures. |
4514 |
|
903.1.11
by Brian Aker
Fix if() |
4515 |
// We expect failure
|
4516 |
if (if_successful) |
|
903.1.3
by Brian Aker
Fix/debug for FreeBSD failures. |
4517 |
{
|
903.1.5
by Brian Aker
Updating test case such that we output version information and correctly set |
4518 |
fprintf(stderr, "\n----------------------------------------------------------------------\n"); |
903.1.6
by Brian Aker
Version will now have a default we can use to look for invalid versions. |
4519 |
fprintf(stderr, "\nDumping Server Information\n\n"); |
903.1.3
by Brian Aker
Fix/debug for FreeBSD failures. |
4520 |
memcached_server_fn callbacks[1]; |
4521 |
||
4522 |
callbacks[0]= dump_server_information; |
|
4523 |
memcached_server_cursor(memc, callbacks, (void *)stderr, 1); |
|
903.1.5
by Brian Aker
Updating test case such that we output version information and correctly set |
4524 |
fprintf(stderr, "\n----------------------------------------------------------------------\n"); |
903.1.3
by Brian Aker
Fix/debug for FreeBSD failures. |
4525 |
}
|
856
by Brian Aker
Merge in version util. |
4526 |
test_true(if_successful == false); |
4527 |
||
4528 |
memcached_server_instance_st instance= |
|
4529 |
memcached_server_instance_by_position(memc, 0); |
|
4530 |
||
4531 |
memcached_version(memc); |
|
4532 |
||
4533 |
// We only use one binary when we test, so this should be just fine.
|
|
861
by Brian Aker
Fix for version on OSX |
4534 |
if_successful= libmemcached_util_version_check(memc, instance->major_version, instance->minor_version, instance->micro_version); |
4535 |
test_true(if_successful == true); |
|
4536 |
||
4537 |
if (instance->micro_version > 0) |
|
882
by Brian Aker
Found issue from Fedora builder compiling with --with-debug |
4538 |
if_successful= libmemcached_util_version_check(memc, instance->major_version, instance->minor_version, (uint8_t)(instance->micro_version -1)); |
861
by Brian Aker
Fix for version on OSX |
4539 |
else if (instance->minor_version > 0) |
882
by Brian Aker
Found issue from Fedora builder compiling with --with-debug |
4540 |
if_successful= libmemcached_util_version_check(memc, instance->major_version, (uint8_t)(instance->minor_version - 1), instance->micro_version); |
861
by Brian Aker
Fix for version on OSX |
4541 |
else if (instance->major_version > 0) |
882
by Brian Aker
Found issue from Fedora builder compiling with --with-debug |
4542 |
if_successful= libmemcached_util_version_check(memc, (uint8_t)(instance->major_version -1), instance->minor_version, instance->micro_version); |
861
by Brian Aker
Fix for version on OSX |
4543 |
|
4544 |
test_true(if_successful == true); |
|
4545 |
||
4546 |
if (instance->micro_version > 0) |
|
882
by Brian Aker
Found issue from Fedora builder compiling with --with-debug |
4547 |
if_successful= libmemcached_util_version_check(memc, instance->major_version, instance->minor_version, (uint8_t)(instance->micro_version +1)); |
861
by Brian Aker
Fix for version on OSX |
4548 |
else if (instance->minor_version > 0) |
882
by Brian Aker
Found issue from Fedora builder compiling with --with-debug |
4549 |
if_successful= libmemcached_util_version_check(memc, instance->major_version, (uint8_t)(instance->minor_version +1), instance->micro_version); |
861
by Brian Aker
Fix for version on OSX |
4550 |
else if (instance->major_version > 0) |
882
by Brian Aker
Found issue from Fedora builder compiling with --with-debug |
4551 |
if_successful= libmemcached_util_version_check(memc, (uint8_t)(instance->major_version +1), instance->minor_version, instance->micro_version); |
856
by Brian Aker
Merge in version util. |
4552 |
|
4553 |
test_true(if_successful == false); |
|
4554 |
||
4555 |
return TEST_SUCCESS; |
|
4556 |
}
|
|
4557 |
||
845
by Brian Aker
Added libmemcached_ping() to memcached utility library. |
4558 |
static test_return_t ping_test(memcached_st *memc) |
4559 |
{
|
|
4560 |
memcached_return_t rc; |
|
4561 |
memcached_server_instance_st instance= |
|
4562 |
memcached_server_instance_by_position(memc, 0); |
|
4563 |
||
4564 |
// Test both the version that returns a code, and the one that does not.
|
|
856
by Brian Aker
Merge in version util. |
4565 |
test_true(libmemcached_util_ping(memcached_server_name(instance), |
4566 |
memcached_server_port(instance), NULL)); |
|
845
by Brian Aker
Added libmemcached_ping() to memcached utility library. |
4567 |
|
856
by Brian Aker
Merge in version util. |
4568 |
test_true(libmemcached_util_ping(memcached_server_name(instance), |
4569 |
memcached_server_port(instance), &rc)); |
|
845
by Brian Aker
Added libmemcached_ping() to memcached utility library. |
4570 |
|
4571 |
test_true(rc == MEMCACHED_SUCCESS); |
|
4572 |
||
4573 |
return TEST_SUCCESS; |
|
4574 |
}
|
|
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
4575 |
#endif
|
4576 |
||
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
4577 |
static test_return_t replication_set_test(memcached_st *memc) |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4578 |
{
|
630
by Brian Aker
Style cleanup |
4579 |
memcached_return_t rc; |
547.2.3
by Monty Taylor
Turned on -fvisibility=hidden. Added API markers to the code. |
4580 |
memcached_st *memc_clone= memcached_clone(NULL, memc); |
4581 |
memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, 0); |
|
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4582 |
|
4583 |
rc= memcached_set(memc, "bubba", 5, "0", 1, 0, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4584 |
test_true(rc == MEMCACHED_SUCCESS); |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4585 |
|
4586 |
/*
|
|
546.1.1
by Trond Norbye
Bug 394442: Replication mget test fail on linux due to race conditions |
4587 |
** We are using the quiet commands to store the replicas, so we need
|
4588 |
** to ensure that all of them are processed before we can continue.
|
|
4589 |
** In the test we go directly from storing the object to trying to
|
|
4590 |
** receive the object from all of the different servers, so we
|
|
4591 |
** could end up in a race condition (the memcached server hasn't yet
|
|
4592 |
** processed the quiet command from the replication set when it process
|
|
4593 |
** the request from the other client (created by the clone)). As a
|
|
4594 |
** workaround for that we call memcached_quit to send the quit command
|
|
4595 |
** to the server and wait for the response ;-) If you use the test code
|
|
4596 |
** as an example for your own code, please note that you shouldn't need
|
|
4597 |
** to do this ;-)
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4598 |
*/
|
546.1.1
by Trond Norbye
Bug 394442: Replication mget test fail on linux due to race conditions |
4599 |
memcached_quit(memc); |
4600 |
||
4601 |
/*
|
|
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4602 |
** "bubba" should now be stored on all of our servers. We don't have an
|
4603 |
** easy to use API to address each individual server, so I'll just iterate
|
|
4604 |
** through a bunch of "master keys" and I should most likely hit all of the
|
|
4605 |
** servers...
|
|
4606 |
*/
|
|
4607 |
for (int x= 'a'; x <= 'z'; ++x) |
|
4608 |
{
|
|
4609 |
char key[2]= { [0]= (char)x }; |
|
4610 |
size_t len; |
|
4611 |
uint32_t flags; |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4612 |
char *val= memcached_get_by_key(memc_clone, key, 1, "bubba", 5, |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4613 |
&len, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4614 |
test_true(rc == MEMCACHED_SUCCESS); |
4615 |
test_true(val != NULL); |
|
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4616 |
free(val); |
4617 |
}
|
|
4618 |
||
547.2.3
by Monty Taylor
Turned on -fvisibility=hidden. Added API markers to the code. |
4619 |
memcached_free(memc_clone); |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4620 |
|
4621 |
return TEST_SUCCESS; |
|
4622 |
}
|
|
4623 |
||
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
4624 |
static test_return_t replication_get_test(memcached_st *memc) |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4625 |
{
|
630
by Brian Aker
Style cleanup |
4626 |
memcached_return_t rc; |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4627 |
|
4628 |
/*
|
|
4629 |
* Don't do the following in your code. I am abusing the internal details
|
|
4630 |
* within the library, and this is not a supported interface.
|
|
4631 |
* This is to verify correct behavior in the library
|
|
4632 |
*/
|
|
695
by Brian Aker
number_of_hosts <-- encapsulated. |
4633 |
for (uint32_t host= 0; host < memcached_server_count(memc); ++host) |
540
by Brian Aker
Merge Monty |
4634 |
{
|
547.2.3
by Monty Taylor
Turned on -fvisibility=hidden. Added API markers to the code. |
4635 |
memcached_st *memc_clone= memcached_clone(NULL, memc); |
794
by Brian Aker
Updating memcached_server_instance_st structure. |
4636 |
memcached_server_instance_st instance= |
792
by Brian Aker
Lots of compiler fixes. |
4637 |
memcached_server_instance_by_position(memc_clone, host); |
711
by Brian Aker
Final bits of abstraction. |
4638 |
|
792
by Brian Aker
Lots of compiler fixes. |
4639 |
((memcached_server_write_instance_st)instance)->port= 0; |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4640 |
|
4641 |
for (int x= 'a'; x <= 'z'; ++x) |
|
4642 |
{
|
|
4643 |
char key[2]= { [0]= (char)x }; |
|
4644 |
size_t len; |
|
4645 |
uint32_t flags; |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4646 |
char *val= memcached_get_by_key(memc_clone, key, 1, "bubba", 5, |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4647 |
&len, &flags, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4648 |
test_true(rc == MEMCACHED_SUCCESS); |
4649 |
test_true(val != NULL); |
|
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4650 |
free(val); |
4651 |
}
|
|
4652 |
||
547.2.3
by Monty Taylor
Turned on -fvisibility=hidden. Added API markers to the code. |
4653 |
memcached_free(memc_clone); |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4654 |
}
|
4655 |
||
4656 |
return TEST_SUCCESS; |
|
4657 |
}
|
|
4658 |
||
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
4659 |
static test_return_t replication_mget_test(memcached_st *memc) |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4660 |
{
|
630
by Brian Aker
Style cleanup |
4661 |
memcached_return_t rc; |
547.2.3
by Monty Taylor
Turned on -fvisibility=hidden. Added API markers to the code. |
4662 |
memcached_st *memc_clone= memcached_clone(NULL, memc); |
4663 |
memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, 0); |
|
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4664 |
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
4665 |
const char *keys[]= { "bubba", "key1", "key2", "key3" }; |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4666 |
size_t len[]= { 5, 4, 4, 4 }; |
4667 |
||
719
by Brian Aker
Small cleanup for for() to array. |
4668 |
for (size_t x= 0; x< 4; ++x) |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4669 |
{
|
4670 |
rc= memcached_set(memc, keys[x], len[x], "0", 1, 0, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4671 |
test_true(rc == MEMCACHED_SUCCESS); |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4672 |
}
|
4673 |
||
4674 |
/*
|
|
546.1.1
by Trond Norbye
Bug 394442: Replication mget test fail on linux due to race conditions |
4675 |
** We are using the quiet commands to store the replicas, so we need
|
4676 |
** to ensure that all of them are processed before we can continue.
|
|
4677 |
** In the test we go directly from storing the object to trying to
|
|
4678 |
** receive the object from all of the different servers, so we
|
|
4679 |
** could end up in a race condition (the memcached server hasn't yet
|
|
4680 |
** processed the quiet command from the replication set when it process
|
|
4681 |
** the request from the other client (created by the clone)). As a
|
|
4682 |
** workaround for that we call memcached_quit to send the quit command
|
|
4683 |
** to the server and wait for the response ;-) If you use the test code
|
|
4684 |
** as an example for your own code, please note that you shouldn't need
|
|
4685 |
** to do this ;-)
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4686 |
*/
|
546.1.1
by Trond Norbye
Bug 394442: Replication mget test fail on linux due to race conditions |
4687 |
memcached_quit(memc); |
4688 |
||
4689 |
/*
|
|
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4690 |
* Don't do the following in your code. I am abusing the internal details
|
4691 |
* within the library, and this is not a supported interface.
|
|
4692 |
* This is to verify correct behavior in the library
|
|
4693 |
*/
|
|
4694 |
memcached_result_st result_obj; |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4695 |
for (uint32_t host= 0; host < memc_clone->number_of_hosts; host++) |
539
by Brian Aker
Merging replication |
4696 |
{
|
540
by Brian Aker
Merge Monty |
4697 |
memcached_st *new_clone= memcached_clone(NULL, memc); |
794
by Brian Aker
Updating memcached_server_instance_st structure. |
4698 |
memcached_server_instance_st instance= |
792
by Brian Aker
Lots of compiler fixes. |
4699 |
memcached_server_instance_by_position(new_clone, host); |
4700 |
((memcached_server_write_instance_st)instance)->port= 0; |
|
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4701 |
|
4702 |
for (int x= 'a'; x <= 'z'; ++x) |
|
4703 |
{
|
|
728
by Brian Aker
Small icc repairs. |
4704 |
char key[2]= { [0]= (char)x, [1]= 0 }; |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4705 |
|
540
by Brian Aker
Merge Monty |
4706 |
rc= memcached_mget_by_key(new_clone, key, 1, keys, len, 4); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4707 |
test_true(rc == MEMCACHED_SUCCESS); |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4708 |
|
540
by Brian Aker
Merge Monty |
4709 |
memcached_result_st *results= memcached_result_create(new_clone, &result_obj); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4710 |
test_true(results); |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4711 |
|
4712 |
int hits= 0; |
|
540
by Brian Aker
Merge Monty |
4713 |
while ((results= memcached_fetch_result(new_clone, &result_obj, &rc)) != NULL) |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4714 |
{
|
539
by Brian Aker
Merging replication |
4715 |
hits++; |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4716 |
}
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4717 |
test_true(hits == 4); |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4718 |
memcached_result_free(&result_obj); |
4719 |
}
|
|
4720 |
||
540
by Brian Aker
Merge Monty |
4721 |
memcached_free(new_clone); |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4722 |
}
|
4723 |
||
563.2.1
by Trond Norbye
Bug #400177: Memory leak in replication_mget_test |
4724 |
memcached_free(memc_clone); |
4725 |
||
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4726 |
return TEST_SUCCESS; |
4727 |
}
|
|
4728 |
||
621.1.2
by Mikko Koppanen
Added test for randomized reads |
4729 |
static test_return_t replication_randomize_mget_test(memcached_st *memc) |
4730 |
{
|
|
4731 |
memcached_result_st result_obj; |
|
630
by Brian Aker
Style cleanup |
4732 |
memcached_return_t rc; |
621.1.2
by Mikko Koppanen
Added test for randomized reads |
4733 |
memcached_st *memc_clone= memcached_clone(NULL, memc); |
4734 |
memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, 3); |
|
4735 |
memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ, 1); |
|
4736 |
||
4737 |
const char *keys[]= { "key1", "key2", "key3", "key4", "key5", "key6", "key7" }; |
|
4738 |
size_t len[]= { 4, 4, 4, 4, 4, 4, 4 }; |
|
4739 |
||
807
by Brian Aker
Style cleanup |
4740 |
for (size_t x= 0; x< 7; ++x) |
621.1.2
by Mikko Koppanen
Added test for randomized reads |
4741 |
{
|
4742 |
rc= memcached_set(memc, keys[x], len[x], "1", 1, 0, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4743 |
test_true(rc == MEMCACHED_SUCCESS); |
621.1.2
by Mikko Koppanen
Added test for randomized reads |
4744 |
}
|
633
by Brian Aker
First merge of Trond's patches (cherry picking). |
4745 |
|
621.1.2
by Mikko Koppanen
Added test for randomized reads |
4746 |
memcached_quit(memc); |
4747 |
||
719
by Brian Aker
Small cleanup for for() to array. |
4748 |
for (size_t x= 0; x< 7; ++x) |
4749 |
{
|
|
621.1.2
by Mikko Koppanen
Added test for randomized reads |
4750 |
const char key[2]= { [0]= (const char)x }; |
4751 |
||
4752 |
rc= memcached_mget_by_key(memc_clone, key, 1, keys, len, 7); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4753 |
test_true(rc == MEMCACHED_SUCCESS); |
621.1.2
by Mikko Koppanen
Added test for randomized reads |
4754 |
|
4755 |
memcached_result_st *results= memcached_result_create(memc_clone, &result_obj); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4756 |
test_true(results); |
621.1.2
by Mikko Koppanen
Added test for randomized reads |
4757 |
|
4758 |
int hits= 0; |
|
4759 |
while ((results= memcached_fetch_result(memc_clone, &result_obj, &rc)) != NULL) |
|
4760 |
{
|
|
4761 |
++hits; |
|
4762 |
}
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4763 |
test_true(hits == 7); |
621.1.2
by Mikko Koppanen
Added test for randomized reads |
4764 |
memcached_result_free(&result_obj); |
4765 |
}
|
|
4766 |
memcached_free(memc_clone); |
|
4767 |
return TEST_SUCCESS; |
|
4768 |
}
|
|
4769 |
||
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
4770 |
static test_return_t replication_delete_test(memcached_st *memc) |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4771 |
{
|
630
by Brian Aker
Style cleanup |
4772 |
memcached_return_t rc; |
547.2.3
by Monty Taylor
Turned on -fvisibility=hidden. Added API markers to the code. |
4773 |
memcached_st *memc_clone= memcached_clone(NULL, memc); |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4774 |
/* Delete the items from all of the servers except 1 */
|
4775 |
uint64_t repl= memcached_behavior_get(memc, |
|
4776 |
MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS); |
|
4777 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, --repl); |
|
4778 |
||
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
4779 |
const char *keys[]= { "bubba", "key1", "key2", "key3" }; |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4780 |
size_t len[]= { 5, 4, 4, 4 }; |
4781 |
||
719
by Brian Aker
Small cleanup for for() to array. |
4782 |
for (size_t x= 0; x< 4; ++x) |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4783 |
{
|
4784 |
rc= memcached_delete_by_key(memc, keys[0], len[0], keys[x], len[x], 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4785 |
test_true(rc == MEMCACHED_SUCCESS); |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4786 |
}
|
4787 |
||
4788 |
/*
|
|
4789 |
* Don't do the following in your code. I am abusing the internal details
|
|
4790 |
* within the library, and this is not a supported interface.
|
|
4791 |
* This is to verify correct behavior in the library
|
|
4792 |
*/
|
|
540
by Brian Aker
Merge Monty |
4793 |
uint32_t hash= memcached_generate_hash(memc, keys[0], len[0]); |
725
by Brian Aker
Fix from --with-debug |
4794 |
for (uint32_t x= 0; x < (repl + 1); ++x) |
540
by Brian Aker
Merge Monty |
4795 |
{
|
794
by Brian Aker
Updating memcached_server_instance_st structure. |
4796 |
memcached_server_instance_st instance= |
792
by Brian Aker
Lots of compiler fixes. |
4797 |
memcached_server_instance_by_position(memc_clone, x); |
711
by Brian Aker
Final bits of abstraction. |
4798 |
|
792
by Brian Aker
Lots of compiler fixes. |
4799 |
((memcached_server_write_instance_st)instance)->port= 0; |
547.2.3
by Monty Taylor
Turned on -fvisibility=hidden. Added API markers to the code. |
4800 |
if (++hash == memc_clone->number_of_hosts) |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4801 |
hash= 0; |
4802 |
}
|
|
4803 |
||
4804 |
memcached_result_st result_obj; |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4805 |
for (uint32_t host= 0; host < memc_clone->number_of_hosts; ++host) |
539
by Brian Aker
Merging replication |
4806 |
{
|
719
by Brian Aker
Small cleanup for for() to array. |
4807 |
for (size_t x= 'a'; x <= 'z'; ++x) |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4808 |
{
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
4809 |
const char key[2]= { [0]= (const char)x }; |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4810 |
|
547.2.3
by Monty Taylor
Turned on -fvisibility=hidden. Added API markers to the code. |
4811 |
rc= memcached_mget_by_key(memc_clone, key, 1, keys, len, 4); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4812 |
test_true(rc == MEMCACHED_SUCCESS); |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4813 |
|
547.2.3
by Monty Taylor
Turned on -fvisibility=hidden. Added API markers to the code. |
4814 |
memcached_result_st *results= memcached_result_create(memc_clone, &result_obj); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4815 |
test_true(results); |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4816 |
|
4817 |
int hits= 0; |
|
547.2.3
by Monty Taylor
Turned on -fvisibility=hidden. Added API markers to the code. |
4818 |
while ((results= memcached_fetch_result(memc_clone, &result_obj, &rc)) != NULL) |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4819 |
{
|
4820 |
++hits; |
|
4821 |
}
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4822 |
test_true(hits == 4); |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4823 |
memcached_result_free(&result_obj); |
4824 |
}
|
|
4825 |
}
|
|
547.2.3
by Monty Taylor
Turned on -fvisibility=hidden. Added API markers to the code. |
4826 |
memcached_free(memc_clone); |
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
4827 |
|
4828 |
return TEST_SUCCESS; |
|
4829 |
}
|
|
4830 |
||
632
by Brian Aker
Update for test system. |
4831 |
#if 0
|
4832 |
static test_return_t hash_sanity_test (memcached_st *memc)
|
|
4833 |
{
|
|
4834 |
(void)memc;
|
|
4835 |
||
4836 |
assert(MEMCACHED_HASH_DEFAULT == MEMCACHED_HASH_DEFAULT);
|
|
4837 |
assert(MEMCACHED_HASH_MD5 == MEMCACHED_HASH_MD5);
|
|
4838 |
assert(MEMCACHED_HASH_CRC == MEMCACHED_HASH_CRC);
|
|
4839 |
assert(MEMCACHED_HASH_FNV1_64 == MEMCACHED_HASH_FNV1_64);
|
|
4840 |
assert(MEMCACHED_HASH_FNV1A_64 == MEMCACHED_HASH_FNV1A_64);
|
|
4841 |
assert(MEMCACHED_HASH_FNV1_32 == MEMCACHED_HASH_FNV1_32);
|
|
4842 |
assert(MEMCACHED_HASH_FNV1A_32 == MEMCACHED_HASH_FNV1A_32);
|
|
4843 |
#ifdef HAVE_HSIEH_HASH
|
|
4844 |
assert(MEMCACHED_HASH_HSIEH == MEMCACHED_HASH_HSIEH);
|
|
4845 |
#endif
|
|
4846 |
assert(MEMCACHED_HASH_MURMUR == MEMCACHED_HASH_MURMUR);
|
|
4847 |
assert(MEMCACHED_HASH_JENKINS == MEMCACHED_HASH_JENKINS);
|
|
4848 |
assert(MEMCACHED_HASH_MAX == MEMCACHED_HASH_MAX);
|
|
4849 |
||
4850 |
return TEST_SUCCESS;
|
|
4851 |
}
|
|
4852 |
#endif
|
|
4853 |
||
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
4854 |
static test_return_t hsieh_avaibility_test (memcached_st *memc) |
495
by Eric Lambert
Disable hsieh algorithm by default |
4855 |
{
|
630
by Brian Aker
Style cleanup |
4856 |
memcached_return_t expected_rc= MEMCACHED_FAILURE; |
495
by Eric Lambert
Disable hsieh algorithm by default |
4857 |
#ifdef HAVE_HSIEH_HASH
|
4858 |
expected_rc= MEMCACHED_SUCCESS; |
|
4859 |
#endif
|
|
630
by Brian Aker
Style cleanup |
4860 |
memcached_return_t rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, |
739
by Brian Aker
Refactor test framework to run pre/post just once. |
4861 |
(uint64_t)MEMCACHED_HASH_HSIEH); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4862 |
test_true(rc == expected_rc); |
739
by Brian Aker
Refactor test framework to run pre/post just once. |
4863 |
|
495
by Eric Lambert
Disable hsieh algorithm by default |
4864 |
return TEST_SUCCESS; |
4865 |
}
|
|
4866 |
||
910
by Brian Aker
Merge in bug fix for 677609 |
4867 |
static test_return_t murmur_avaibility_test (memcached_st *memc) |
4868 |
{
|
|
4869 |
memcached_return_t expected_rc= MEMCACHED_FAILURE; |
|
4870 |
#ifdef HAVE_MURMUR_HASH
|
|
4871 |
expected_rc= MEMCACHED_SUCCESS; |
|
4872 |
#endif
|
|
4873 |
memcached_return_t rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, |
|
4874 |
(uint64_t)MEMCACHED_HASH_MURMUR); |
|
4875 |
test_true(rc == expected_rc); |
|
4876 |
||
4877 |
return TEST_SUCCESS; |
|
4878 |
}
|
|
4879 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4880 |
static test_return_t one_at_a_time_run (memcached_st *memc) |
758
by Brian Aker
Updates to libhashkit. |
4881 |
{
|
4882 |
uint32_t x; |
|
4883 |
const char **ptr; |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4884 |
(void)memc; |
758
by Brian Aker
Updates to libhashkit. |
4885 |
|
4886 |
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
|
4887 |
{
|
|
4888 |
uint32_t hash_val; |
|
4889 |
||
4890 |
hash_val= memcached_generate_hash_value(*ptr, strlen(*ptr), MEMCACHED_HASH_DEFAULT); |
|
4891 |
test_true(one_at_a_time_values[x] == hash_val); |
|
4892 |
}
|
|
4893 |
||
4894 |
return TEST_SUCCESS; |
|
4895 |
}
|
|
4896 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4897 |
static test_return_t md5_run (memcached_st *memc) |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4898 |
{
|
4899 |
uint32_t x; |
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
4900 |
const char **ptr; |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4901 |
(void)memc; |
632
by Brian Aker
Update for test system. |
4902 |
|
4903 |
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
|
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4904 |
{
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4905 |
uint32_t hash_val; |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4906 |
|
4907 |
hash_val= memcached_generate_hash_value(*ptr, strlen(*ptr), MEMCACHED_HASH_MD5); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4908 |
test_true(md5_values[x] == hash_val); |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4909 |
}
|
4910 |
||
4911 |
return TEST_SUCCESS; |
|
4912 |
}
|
|
4913 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4914 |
static test_return_t crc_run (memcached_st *memc) |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4915 |
{
|
4916 |
uint32_t x; |
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
4917 |
const char **ptr; |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4918 |
(void)memc; |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4919 |
|
632
by Brian Aker
Update for test system. |
4920 |
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4921 |
{
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4922 |
uint32_t hash_val; |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4923 |
|
4924 |
hash_val= memcached_generate_hash_value(*ptr, strlen(*ptr), MEMCACHED_HASH_CRC); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4925 |
test_true(crc_values[x] == hash_val); |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4926 |
}
|
4927 |
||
4928 |
return TEST_SUCCESS; |
|
4929 |
}
|
|
4930 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4931 |
static test_return_t fnv1_64_run (memcached_st *memc) |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4932 |
{
|
4933 |
uint32_t x; |
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
4934 |
const char **ptr; |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4935 |
(void)memc; |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4936 |
|
632
by Brian Aker
Update for test system. |
4937 |
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4938 |
{
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4939 |
uint32_t hash_val; |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4940 |
|
4941 |
hash_val= memcached_generate_hash_value(*ptr, strlen(*ptr), MEMCACHED_HASH_FNV1_64); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4942 |
test_true(fnv1_64_values[x] == hash_val); |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4943 |
}
|
4944 |
||
4945 |
return TEST_SUCCESS; |
|
4946 |
}
|
|
4947 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4948 |
static test_return_t fnv1a_64_run (memcached_st *memc) |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4949 |
{
|
4950 |
uint32_t x; |
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
4951 |
const char **ptr; |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4952 |
(void)memc; |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4953 |
|
632
by Brian Aker
Update for test system. |
4954 |
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4955 |
{
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4956 |
uint32_t hash_val; |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4957 |
|
4958 |
hash_val= memcached_generate_hash_value(*ptr, strlen(*ptr), MEMCACHED_HASH_FNV1A_64); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4959 |
test_true(fnv1a_64_values[x] == hash_val); |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4960 |
}
|
4961 |
||
4962 |
return TEST_SUCCESS; |
|
4963 |
}
|
|
4964 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4965 |
static test_return_t fnv1_32_run (memcached_st *memc) |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4966 |
{
|
4967 |
uint32_t x; |
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
4968 |
const char **ptr; |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4969 |
(void)memc; |
632
by Brian Aker
Update for test system. |
4970 |
|
4971 |
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
|
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4972 |
{
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4973 |
uint32_t hash_val; |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4974 |
|
4975 |
hash_val= memcached_generate_hash_value(*ptr, strlen(*ptr), MEMCACHED_HASH_FNV1_32); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4976 |
test_true(fnv1_32_values[x] == hash_val); |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4977 |
}
|
4978 |
||
4979 |
return TEST_SUCCESS; |
|
4980 |
}
|
|
4981 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4982 |
static test_return_t fnv1a_32_run (memcached_st *memc) |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4983 |
{
|
4984 |
uint32_t x; |
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
4985 |
const char **ptr; |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4986 |
(void)memc; |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4987 |
|
632
by Brian Aker
Update for test system. |
4988 |
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4989 |
{
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
4990 |
uint32_t hash_val; |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4991 |
|
4992 |
hash_val= memcached_generate_hash_value(*ptr, strlen(*ptr), MEMCACHED_HASH_FNV1A_32); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
4993 |
test_true(fnv1a_32_values[x] == hash_val); |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
4994 |
}
|
4995 |
||
4996 |
return TEST_SUCCESS; |
|
4997 |
}
|
|
4998 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
4999 |
static test_return_t hsieh_run (memcached_st *memc) |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5000 |
{
|
5001 |
uint32_t x; |
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
5002 |
const char **ptr; |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
5003 |
(void)memc; |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5004 |
|
632
by Brian Aker
Update for test system. |
5005 |
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5006 |
{
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
5007 |
uint32_t hash_val; |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5008 |
|
5009 |
hash_val= memcached_generate_hash_value(*ptr, strlen(*ptr), MEMCACHED_HASH_HSIEH); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5010 |
test_true(hsieh_values[x] == hash_val); |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5011 |
}
|
5012 |
||
5013 |
return TEST_SUCCESS; |
|
5014 |
}
|
|
5015 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
5016 |
static test_return_t murmur_run (memcached_st *memc) |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5017 |
{
|
826.2.1
by Monty Taylor
Uses WORDS_BIGENDIAN to test for and disable big endian architectures. |
5018 |
#ifdef WORDS_BIGENDIAN
|
910
by Brian Aker
Merge in bug fix for 677609 |
5019 |
(void)murmur_values; |
633
by Brian Aker
First merge of Trond's patches (cherry picking). |
5020 |
return TEST_SKIPPED; |
5021 |
#else
|
|
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5022 |
uint32_t x; |
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
5023 |
const char **ptr; |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
5024 |
(void)memc; |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5025 |
|
632
by Brian Aker
Update for test system. |
5026 |
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5027 |
{
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
5028 |
uint32_t hash_val; |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5029 |
|
632
by Brian Aker
Update for test system. |
5030 |
hash_val= memcached_generate_hash_value(*ptr, strlen(*ptr), MEMCACHED_HASH_MURMUR); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5031 |
test_true(murmur_values[x] == hash_val); |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5032 |
}
|
5033 |
||
5034 |
return TEST_SUCCESS; |
|
633
by Brian Aker
First merge of Trond's patches (cherry picking). |
5035 |
#endif
|
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5036 |
}
|
5037 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
5038 |
static test_return_t jenkins_run (memcached_st *memc) |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5039 |
{
|
5040 |
uint32_t x; |
|
550.2.1
by Monty Taylor
Fixed -Wwrite-strings warnings. |
5041 |
const char **ptr; |
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
5042 |
(void)memc; |
632
by Brian Aker
Update for test system. |
5043 |
|
5044 |
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
|
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5045 |
{
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
5046 |
uint32_t hash_val; |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5047 |
|
5048 |
hash_val= memcached_generate_hash_value(*ptr, strlen(*ptr), MEMCACHED_HASH_JENKINS); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5049 |
test_true(jenkins_values[x] == hash_val); |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
5050 |
}
|
5051 |
||
5052 |
return TEST_SUCCESS; |
|
5053 |
}
|
|
5054 |
||
776
by Brian Aker
Adding test, showing off how to add a custom function to libmemcached. |
5055 |
static uint32_t hash_md5_test_function(const char *string, size_t string_length, void *context) |
5056 |
{
|
|
5057 |
(void)context; |
|
5058 |
return libhashkit_md5(string, string_length); |
|
5059 |
}
|
|
5060 |
||
5061 |
static uint32_t hash_crc_test_function(const char *string, size_t string_length, void *context) |
|
5062 |
{
|
|
5063 |
(void)context; |
|
5064 |
return libhashkit_crc32(string, string_length); |
|
5065 |
}
|
|
5066 |
||
5067 |
static test_return_t memcached_get_hashkit_test (memcached_st *memc) |
|
5068 |
{
|
|
5069 |
uint32_t x; |
|
5070 |
const char **ptr; |
|
801
by Brian Aker
Correction to API for custom hash settings. |
5071 |
const hashkit_st *kit; |
5072 |
hashkit_st new_kit; |
|
776
by Brian Aker
Adding test, showing off how to add a custom function to libmemcached. |
5073 |
hashkit_return_t hash_rc; |
5074 |
||
5075 |
uint32_t md5_hosts[]= {4U, 1U, 0U, 1U, 4U, 2U, 0U, 3U, 0U, 0U, 3U, 1U, 0U, 0U, 1U, 3U, 0U, 0U, 0U, 3U, 1U, 0U, 4U, 4U, 3U}; |
|
5076 |
uint32_t crc_hosts[]= {2U, 4U, 1U, 0U, 2U, 4U, 4U, 4U, 1U, 2U, 3U, 4U, 3U, 4U, 1U, 3U, 3U, 2U, 0U, 0U, 0U, 1U, 2U, 4U, 0U}; |
|
5077 |
||
5078 |
kit= memcached_get_hashkit(memc); |
|
5079 |
||
801
by Brian Aker
Correction to API for custom hash settings. |
5080 |
hashkit_clone(&new_kit, kit); |
5081 |
hash_rc= hashkit_set_custom_function(&new_kit, hash_md5_test_function, NULL); |
|
776
by Brian Aker
Adding test, showing off how to add a custom function to libmemcached. |
5082 |
test_true(hash_rc == HASHKIT_SUCCESS); |
5083 |
||
801
by Brian Aker
Correction to API for custom hash settings. |
5084 |
memcached_set_hashkit(memc, &new_kit); |
5085 |
||
776
by Brian Aker
Adding test, showing off how to add a custom function to libmemcached. |
5086 |
/*
|
5087 |
Verify Setting the hash.
|
|
5088 |
*/
|
|
5089 |
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
|
5090 |
{
|
|
5091 |
uint32_t hash_val; |
|
5092 |
||
5093 |
hash_val= hashkit_digest(kit, *ptr, strlen(*ptr)); |
|
5094 |
test_true(md5_values[x] == hash_val); |
|
5095 |
}
|
|
5096 |
||
800.1.2
by Trond Norbye
Add support for SASL |
5097 |
|
776
by Brian Aker
Adding test, showing off how to add a custom function to libmemcached. |
5098 |
/*
|
5099 |
Now check memcached_st.
|
|
5100 |
*/
|
|
5101 |
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
|
5102 |
{
|
|
5103 |
uint32_t hash_val; |
|
5104 |
||
5105 |
hash_val= memcached_generate_hash(memc, *ptr, strlen(*ptr)); |
|
5106 |
test_true(md5_hosts[x] == hash_val); |
|
5107 |
}
|
|
5108 |
||
801
by Brian Aker
Correction to API for custom hash settings. |
5109 |
hash_rc= hashkit_set_custom_function(&new_kit, hash_crc_test_function, NULL); |
776
by Brian Aker
Adding test, showing off how to add a custom function to libmemcached. |
5110 |
test_true(hash_rc == HASHKIT_SUCCESS); |
5111 |
||
801
by Brian Aker
Correction to API for custom hash settings. |
5112 |
memcached_set_hashkit(memc, &new_kit); |
5113 |
||
776
by Brian Aker
Adding test, showing off how to add a custom function to libmemcached. |
5114 |
/*
|
5115 |
Verify Setting the hash.
|
|
5116 |
*/
|
|
5117 |
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
|
5118 |
{
|
|
5119 |
uint32_t hash_val; |
|
5120 |
||
5121 |
hash_val= hashkit_digest(kit, *ptr, strlen(*ptr)); |
|
5122 |
test_true(crc_values[x] == hash_val); |
|
5123 |
}
|
|
5124 |
||
5125 |
for (ptr= list_to_hash, x= 0; *ptr; ptr++, x++) |
|
5126 |
{
|
|
5127 |
uint32_t hash_val; |
|
5128 |
||
5129 |
hash_val= memcached_generate_hash(memc, *ptr, strlen(*ptr)); |
|
5130 |
test_true(crc_hosts[x] == hash_val); |
|
5131 |
}
|
|
5132 |
||
5133 |
return TEST_SUCCESS; |
|
5134 |
}
|
|
5135 |
||
839
by Brian Aker
Look for regressions in error messages. |
5136 |
/*
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
5137 |
Test case adapted from John Gorman <johngorman2@gmail.com>
|
839
by Brian Aker
Look for regressions in error messages. |
5138 |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
5139 |
We are testing the error condition when we connect to a server via memcached_get()
|
839
by Brian Aker
Look for regressions in error messages. |
5140 |
but find that the server is not available.
|
5141 |
*/
|
|
859
by Brian Aker
Fix for interface issues (Bug 571909 <571909@bugs.launchpad.net>) |
5142 |
static test_return_t memcached_get_MEMCACHED_ERRNO(memcached_st *memc) |
839
by Brian Aker
Look for regressions in error messages. |
5143 |
{
|
5144 |
(void)memc; |
|
5145 |
memcached_st *tl_memc_h; |
|
5146 |
memcached_server_st *servers; |
|
5147 |
||
5148 |
const char *key= "MemcachedLives"; |
|
5149 |
size_t len; |
|
5150 |
uint32_t flags; |
|
5151 |
memcached_return rc; |
|
5152 |
char *value; |
|
5153 |
||
5154 |
// Create a handle.
|
|
5155 |
tl_memc_h= memcached_create(NULL); |
|
859
by Brian Aker
Fix for interface issues (Bug 571909 <571909@bugs.launchpad.net>) |
5156 |
servers= memcached_servers_parse("localhost:9898,localhost:9899"); // This server should not exist |
839
by Brian Aker
Look for regressions in error messages. |
5157 |
memcached_server_push(tl_memc_h, servers); |
5158 |
memcached_server_list_free(servers); |
|
5159 |
||
5160 |
// See if memcached is reachable.
|
|
5161 |
value= memcached_get(tl_memc_h, key, strlen(key), &len, &flags, &rc); |
|
5162 |
||
868
by Brian Aker
Update to clean up test case. |
5163 |
test_false(value); |
839
by Brian Aker
Look for regressions in error messages. |
5164 |
test_true(len == 0); |
903.1.3
by Brian Aker
Fix/debug for FreeBSD failures. |
5165 |
test_false(rc == MEMCACHED_SUCCESS); |
839
by Brian Aker
Look for regressions in error messages. |
5166 |
|
868
by Brian Aker
Update to clean up test case. |
5167 |
memcached_free(tl_memc_h); |
5168 |
||
839
by Brian Aker
Look for regressions in error messages. |
5169 |
return TEST_SUCCESS; |
5170 |
}
|
|
5171 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
5172 |
/*
|
839
by Brian Aker
Look for regressions in error messages. |
5173 |
We connect to a server which exists, but search for a key that does not exist.
|
5174 |
*/
|
|
5175 |
static test_return_t memcached_get_MEMCACHED_NOTFOUND(memcached_st *memc) |
|
5176 |
{
|
|
5177 |
const char *key= "MemcachedKeyNotEXIST"; |
|
5178 |
size_t len; |
|
5179 |
uint32_t flags; |
|
5180 |
memcached_return rc; |
|
5181 |
char *value; |
|
5182 |
||
5183 |
// See if memcached is reachable.
|
|
5184 |
value= memcached_get(memc, key, strlen(key), &len, &flags, &rc); |
|
5185 |
||
868
by Brian Aker
Update to clean up test case. |
5186 |
test_false(value); |
839
by Brian Aker
Look for regressions in error messages. |
5187 |
test_true(len == 0); |
5188 |
test_true(rc == MEMCACHED_NOTFOUND); |
|
5189 |
||
5190 |
return TEST_SUCCESS; |
|
5191 |
}
|
|
5192 |
||
840
by Brian Aker
Additional tests. |
5193 |
/*
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
5194 |
Test case adapted from John Gorman <johngorman2@gmail.com>
|
840
by Brian Aker
Additional tests. |
5195 |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
5196 |
We are testing the error condition when we connect to a server via memcached_get_by_key()
|
840
by Brian Aker
Additional tests. |
5197 |
but find that the server is not available.
|
5198 |
*/
|
|
859
by Brian Aker
Fix for interface issues (Bug 571909 <571909@bugs.launchpad.net>) |
5199 |
static test_return_t memcached_get_by_key_MEMCACHED_ERRNO(memcached_st *memc) |
840
by Brian Aker
Additional tests. |
5200 |
{
|
5201 |
(void)memc; |
|
5202 |
memcached_st *tl_memc_h; |
|
5203 |
memcached_server_st *servers; |
|
5204 |
||
5205 |
const char *key= "MemcachedLives"; |
|
5206 |
size_t len; |
|
5207 |
uint32_t flags; |
|
5208 |
memcached_return rc; |
|
5209 |
char *value; |
|
5210 |
||
5211 |
// Create a handle.
|
|
5212 |
tl_memc_h= memcached_create(NULL); |
|
859
by Brian Aker
Fix for interface issues (Bug 571909 <571909@bugs.launchpad.net>) |
5213 |
servers= memcached_servers_parse("localhost:9898,localhost:9899"); // This server should not exist |
840
by Brian Aker
Additional tests. |
5214 |
memcached_server_push(tl_memc_h, servers); |
5215 |
memcached_server_list_free(servers); |
|
5216 |
||
5217 |
// See if memcached is reachable.
|
|
5218 |
value= memcached_get_by_key(tl_memc_h, key, strlen(key), key, strlen(key), &len, &flags, &rc); |
|
5219 |
||
868
by Brian Aker
Update to clean up test case. |
5220 |
test_false(value); |
840
by Brian Aker
Additional tests. |
5221 |
test_true(len == 0); |
903.1.3
by Brian Aker
Fix/debug for FreeBSD failures. |
5222 |
test_false(rc == MEMCACHED_SUCCESS); |
840
by Brian Aker
Additional tests. |
5223 |
|
868
by Brian Aker
Update to clean up test case. |
5224 |
memcached_free(tl_memc_h); |
5225 |
||
840
by Brian Aker
Additional tests. |
5226 |
return TEST_SUCCESS; |
5227 |
}
|
|
5228 |
||
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
5229 |
/*
|
840
by Brian Aker
Additional tests. |
5230 |
We connect to a server which exists, but search for a key that does not exist.
|
5231 |
*/
|
|
5232 |
static test_return_t memcached_get_by_key_MEMCACHED_NOTFOUND(memcached_st *memc) |
|
5233 |
{
|
|
5234 |
const char *key= "MemcachedKeyNotEXIST"; |
|
5235 |
size_t len; |
|
5236 |
uint32_t flags; |
|
5237 |
memcached_return rc; |
|
5238 |
char *value; |
|
5239 |
||
5240 |
// See if memcached is reachable.
|
|
5241 |
value= memcached_get_by_key(memc, key, strlen(key), key, strlen(key), &len, &flags, &rc); |
|
5242 |
||
868
by Brian Aker
Update to clean up test case. |
5243 |
test_false(value); |
840
by Brian Aker
Additional tests. |
5244 |
test_true(len == 0); |
5245 |
test_true(rc == MEMCACHED_NOTFOUND); |
|
5246 |
||
5247 |
return TEST_SUCCESS; |
|
5248 |
}
|
|
5249 |
||
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
5250 |
|
5251 |
static test_return_t ketama_compatibility_libmemcached(memcached_st *trash) |
|
5252 |
{
|
|
630
by Brian Aker
Style cleanup |
5253 |
memcached_return_t rc; |
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
5254 |
uint64_t value; |
5255 |
int x; |
|
5256 |
memcached_server_st *server_pool; |
|
5257 |
memcached_st *memc; |
|
5258 |
||
5259 |
(void)trash; |
|
5260 |
||
5261 |
memc= memcached_create(NULL); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5262 |
test_true(memc); |
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
5263 |
|
5264 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED, 1); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5265 |
test_true(rc == MEMCACHED_SUCCESS); |
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
5266 |
|
5267 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5268 |
test_true(value == 1); |
637
by Brian Aker
Updating interface. |
5269 |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5270 |
test_true(memcached_behavior_set_distribution(memc, MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA) == MEMCACHED_SUCCESS); |
5271 |
test_true(memcached_behavior_get_distribution(memc) == MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA); |
|
637
by Brian Aker
Updating interface. |
5272 |
|
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
5273 |
|
5274 |
server_pool = memcached_servers_parse("10.0.1.1:11211 600,10.0.1.2:11211 300,10.0.1.3:11211 200,10.0.1.4:11211 350,10.0.1.5:11211 1000,10.0.1.6:11211 800,10.0.1.7:11211 950,10.0.1.8:11211 100"); |
|
5275 |
memcached_server_push(memc, server_pool); |
|
5276 |
||
5277 |
/* verify that the server list was parsed okay. */
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5278 |
test_true(memcached_server_count(memc) == 8); |
653
by Brian Aker
Test cleanup. |
5279 |
test_strcmp(server_pool[0].hostname, "10.0.1.1"); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5280 |
test_true(server_pool[0].port == 11211); |
5281 |
test_true(server_pool[0].weight == 600); |
|
653
by Brian Aker
Test cleanup. |
5282 |
test_strcmp(server_pool[2].hostname, "10.0.1.3"); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5283 |
test_true(server_pool[2].port == 11211); |
5284 |
test_true(server_pool[2].weight == 200); |
|
653
by Brian Aker
Test cleanup. |
5285 |
test_strcmp(server_pool[7].hostname, "10.0.1.8"); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5286 |
test_true(server_pool[7].port == 11211); |
5287 |
test_true(server_pool[7].weight == 100); |
|
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
5288 |
|
5289 |
/* VDEAAAAA hashes to fffcd1b5, after the last continuum point, and lets
|
|
5290 |
* us test the boundary wraparound.
|
|
5291 |
*/
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5292 |
test_true(memcached_generate_hash(memc, (char *)"VDEAAAAA", 8) == memc->continuum[0].index); |
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
5293 |
|
5294 |
/* verify the standard ketama set. */
|
|
5295 |
for (x= 0; x < 99; x++) |
|
5296 |
{
|
|
5297 |
uint32_t server_idx = memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key)); |
|
794
by Brian Aker
Updating memcached_server_instance_st structure. |
5298 |
memcached_server_instance_st instance= |
792
by Brian Aker
Lots of compiler fixes. |
5299 |
memcached_server_instance_by_position(memc, server_idx); |
5300 |
const char *hostname = memcached_server_name(instance); |
|
653
by Brian Aker
Test cleanup. |
5301 |
|
5302 |
test_strcmp(hostname, ketama_test_cases[x].server); |
|
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
5303 |
}
|
5304 |
||
5305 |
memcached_server_list_free(server_pool); |
|
5306 |
memcached_free(memc); |
|
5307 |
||
5308 |
return TEST_SUCCESS; |
|
5309 |
}
|
|
5310 |
||
5311 |
static test_return_t ketama_compatibility_spymemcached(memcached_st *trash) |
|
5312 |
{
|
|
630
by Brian Aker
Style cleanup |
5313 |
memcached_return_t rc; |
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
5314 |
uint64_t value; |
5315 |
int x; |
|
5316 |
memcached_server_st *server_pool; |
|
5317 |
memcached_st *memc; |
|
5318 |
||
5319 |
(void)trash; |
|
5320 |
||
5321 |
memc= memcached_create(NULL); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5322 |
test_true(memc); |
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
5323 |
|
5324 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED, 1); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5325 |
test_true(rc == MEMCACHED_SUCCESS); |
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
5326 |
|
5327 |
value= memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5328 |
test_true(value == 1); |
637
by Brian Aker
Updating interface. |
5329 |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5330 |
test_true(memcached_behavior_set_distribution(memc, MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY) == MEMCACHED_SUCCESS); |
5331 |
test_true(memcached_behavior_get_distribution(memc) == MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY); |
|
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
5332 |
|
5333 |
server_pool = memcached_servers_parse("10.0.1.1:11211 600,10.0.1.2:11211 300,10.0.1.3:11211 200,10.0.1.4:11211 350,10.0.1.5:11211 1000,10.0.1.6:11211 800,10.0.1.7:11211 950,10.0.1.8:11211 100"); |
|
5334 |
memcached_server_push(memc, server_pool); |
|
5335 |
||
5336 |
/* verify that the server list was parsed okay. */
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5337 |
test_true(memcached_server_count(memc) == 8); |
653
by Brian Aker
Test cleanup. |
5338 |
test_strcmp(server_pool[0].hostname, "10.0.1.1"); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5339 |
test_true(server_pool[0].port == 11211); |
5340 |
test_true(server_pool[0].weight == 600); |
|
653
by Brian Aker
Test cleanup. |
5341 |
test_strcmp(server_pool[2].hostname, "10.0.1.3"); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5342 |
test_true(server_pool[2].port == 11211); |
5343 |
test_true(server_pool[2].weight == 200); |
|
653
by Brian Aker
Test cleanup. |
5344 |
test_strcmp(server_pool[7].hostname, "10.0.1.8"); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5345 |
test_true(server_pool[7].port == 11211); |
5346 |
test_true(server_pool[7].weight == 100); |
|
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
5347 |
|
5348 |
/* VDEAAAAA hashes to fffcd1b5, after the last continuum point, and lets
|
|
5349 |
* us test the boundary wraparound.
|
|
5350 |
*/
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5351 |
test_true(memcached_generate_hash(memc, (char *)"VDEAAAAA", 8) == memc->continuum[0].index); |
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
5352 |
|
5353 |
/* verify the standard ketama set. */
|
|
5354 |
for (x= 0; x < 99; x++) |
|
5355 |
{
|
|
792
by Brian Aker
Lots of compiler fixes. |
5356 |
uint32_t server_idx= memcached_generate_hash(memc, ketama_test_cases_spy[x].key, strlen(ketama_test_cases_spy[x].key)); |
5357 |
||
794
by Brian Aker
Updating memcached_server_instance_st structure. |
5358 |
memcached_server_instance_st instance= |
792
by Brian Aker
Lots of compiler fixes. |
5359 |
memcached_server_instance_by_position(memc, server_idx); |
5360 |
||
5361 |
const char *hostname= memcached_server_name(instance); |
|
5362 |
||
653
by Brian Aker
Test cleanup. |
5363 |
test_strcmp(hostname, ketama_test_cases_spy[x].server); |
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
5364 |
}
|
5365 |
||
5366 |
memcached_server_list_free(server_pool); |
|
5367 |
memcached_free(memc); |
|
5368 |
||
5369 |
return TEST_SUCCESS; |
|
5370 |
}
|
|
5371 |
||
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
5372 |
static test_return_t regression_bug_434484(memcached_st *memc) |
580.1.2
by Trond Norbye
Bug #434484: Binary protocol maps NOT_STORED to wrong error code |
5373 |
{
|
640
by Brian Aker
Fix for replication test. |
5374 |
test_return_t test_rc; |
5375 |
test_rc= pre_binary(memc); |
|
5376 |
||
5377 |
if (test_rc != TEST_SUCCESS) |
|
5378 |
return test_rc; |
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
5379 |
|
630
by Brian Aker
Style cleanup |
5380 |
memcached_return_t ret; |
580.1.2
by Trond Norbye
Bug #434484: Binary protocol maps NOT_STORED to wrong error code |
5381 |
const char *key= "regression_bug_434484"; |
5382 |
size_t keylen= strlen(key); |
|
5383 |
||
5384 |
ret= memcached_append(memc, key, keylen, key, keylen, 0, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5385 |
test_true(ret == MEMCACHED_NOTSTORED); |
580.1.2
by Trond Norbye
Bug #434484: Binary protocol maps NOT_STORED to wrong error code |
5386 |
|
5387 |
size_t size= 2048 * 1024; |
|
597.1.1
by Trond Norbye
Bug #446607: Syscall param write(buf) points to uninitialised byte(s) |
5388 |
void *data= calloc(1, size); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5389 |
test_true(data != NULL); |
580.1.2
by Trond Norbye
Bug #434484: Binary protocol maps NOT_STORED to wrong error code |
5390 |
ret= memcached_set(memc, key, keylen, data, size, 0, 0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5391 |
test_true(ret == MEMCACHED_E2BIG); |
580.1.2
by Trond Norbye
Bug #434484: Binary protocol maps NOT_STORED to wrong error code |
5392 |
free(data); |
5393 |
||
5394 |
return TEST_SUCCESS; |
|
5395 |
}
|
|
5396 |
||
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
5397 |
static test_return_t regression_bug_434843(memcached_st *memc) |
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5398 |
{
|
640
by Brian Aker
Fix for replication test. |
5399 |
test_return_t test_rc; |
5400 |
test_rc= pre_binary(memc); |
|
5401 |
||
5402 |
if (test_rc != TEST_SUCCESS) |
|
5403 |
return test_rc; |
|
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5404 |
|
630
by Brian Aker
Style cleanup |
5405 |
memcached_return_t rc; |
715
by Brian Aker
Fix for bug #15450 |
5406 |
size_t counter= 0; |
630
by Brian Aker
Style cleanup |
5407 |
memcached_execute_fn callbacks[1]= { [0]= &callback_counter }; |
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5408 |
|
5409 |
/*
|
|
5410 |
* I only want to hit only _one_ server so I know the number of requests I'm
|
|
5411 |
* sending in the pipleine to the server. Let's try to do a multiget of
|
|
598.4.2
by Trond Norbye
Reduce the number of items in the mget for regression_bug_434843 to 1024 |
5412 |
* 1024 (that should satisfy most users don't you think?). Future versions
|
5413 |
* will include a mget_execute function call if you need a higher number.
|
|
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5414 |
*/
|
695
by Brian Aker
number_of_hosts <-- encapsulated. |
5415 |
uint32_t number_of_hosts= memcached_server_count(memc); |
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5416 |
memc->number_of_hosts= 1; |
598.4.2
by Trond Norbye
Reduce the number of items in the mget for regression_bug_434843 to 1024 |
5417 |
const size_t max_keys= 1024; |
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5418 |
char **keys= calloc(max_keys, sizeof(char*)); |
5419 |
size_t *key_length=calloc(max_keys, sizeof(size_t)); |
|
5420 |
||
718
by Brian Aker
32/64 bit cleanup issue in tests. |
5421 |
for (size_t x= 0; x < max_keys; ++x) |
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5422 |
{
|
5423 |
char k[251]; |
|
718
by Brian Aker
32/64 bit cleanup issue in tests. |
5424 |
|
903.1.8
by Brian Aker
Cleanup test failures. |
5425 |
key_length[x]= (size_t)snprintf(k, sizeof(k), "0200%lu", (unsigned long)x); |
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5426 |
keys[x]= strdup(k); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5427 |
test_true(keys[x] != NULL); |
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5428 |
}
|
5429 |
||
5430 |
/*
|
|
5431 |
* Run two times.. the first time we should have 100% cache miss,
|
|
5432 |
* and the second time we should have 100% cache hits
|
|
5433 |
*/
|
|
715
by Brian Aker
Fix for bug #15450 |
5434 |
for (size_t y= 0; y < 2; y++) |
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5435 |
{
|
5436 |
rc= memcached_mget(memc, (const char**)keys, key_length, max_keys); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5437 |
test_true(rc == MEMCACHED_SUCCESS); |
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5438 |
rc= memcached_fetch_execute(memc, callbacks, (void *)&counter, 1); |
715
by Brian Aker
Fix for bug #15450 |
5439 |
|
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5440 |
if (y == 0) |
5441 |
{
|
|
5442 |
/* The first iteration should give me a 100% cache miss. verify that*/
|
|
597.1.1
by Trond Norbye
Bug #446607: Syscall param write(buf) points to uninitialised byte(s) |
5443 |
char blob[1024]= { 0 }; |
715
by Brian Aker
Fix for bug #15450 |
5444 |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5445 |
test_true(counter == 0); |
715
by Brian Aker
Fix for bug #15450 |
5446 |
|
5447 |
for (size_t x= 0; x < max_keys; ++x) |
|
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5448 |
{
|
5449 |
rc= memcached_add(memc, keys[x], key_length[x], |
|
5450 |
blob, sizeof(blob), 0, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5451 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5452 |
}
|
5453 |
}
|
|
5454 |
else
|
|
5455 |
{
|
|
5456 |
/* Verify that we received all of the key/value pairs */
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5457 |
test_true(counter == max_keys); |
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5458 |
}
|
5459 |
}
|
|
5460 |
||
5461 |
/* Release allocated resources */
|
|
590.1.9
by Trond Norbye
Fix compilation warnings reported by gcc |
5462 |
for (size_t x= 0; x < max_keys; ++x) |
715
by Brian Aker
Fix for bug #15450 |
5463 |
{
|
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5464 |
free(keys[x]); |
715
by Brian Aker
Fix for bug #15450 |
5465 |
}
|
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5466 |
free(keys); |
5467 |
free(key_length); |
|
5468 |
||
5469 |
memc->number_of_hosts= number_of_hosts; |
|
695
by Brian Aker
number_of_hosts <-- encapsulated. |
5470 |
|
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5471 |
return TEST_SUCCESS; |
5472 |
}
|
|
5473 |
||
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
5474 |
static test_return_t regression_bug_434843_buffered(memcached_st *memc) |
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5475 |
{
|
630
by Brian Aker
Style cleanup |
5476 |
memcached_return_t rc; |
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5477 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 1); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5478 |
test_true(rc == MEMCACHED_SUCCESS); |
590.1.7
by Trond Norbye
Bug #434843: Large multigets with binary protocol may hang client |
5479 |
|
5480 |
return regression_bug_434843(memc); |
|
5481 |
}
|
|
5482 |
||
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
5483 |
static test_return_t regression_bug_421108(memcached_st *memc) |
590.1.8
by Trond Norbye
Bug 421108: memstat reports same value for bytes, bytes_read and bytes_written |
5484 |
{
|
630
by Brian Aker
Style cleanup |
5485 |
memcached_return_t rc; |
590.1.8
by Trond Norbye
Bug 421108: memstat reports same value for bytes, bytes_read and bytes_written |
5486 |
memcached_stat_st *memc_stat= memcached_stat(memc, NULL, &rc); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5487 |
test_true(rc == MEMCACHED_SUCCESS); |
590.1.8
by Trond Norbye
Bug 421108: memstat reports same value for bytes, bytes_read and bytes_written |
5488 |
|
5489 |
char *bytes= memcached_stat_get_value(memc, memc_stat, "bytes", &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5490 |
test_true(rc == MEMCACHED_SUCCESS); |
5491 |
test_true(bytes != NULL); |
|
590.1.8
by Trond Norbye
Bug 421108: memstat reports same value for bytes, bytes_read and bytes_written |
5492 |
char *bytes_read= memcached_stat_get_value(memc, memc_stat, |
5493 |
"bytes_read", &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5494 |
test_true(rc == MEMCACHED_SUCCESS); |
5495 |
test_true(bytes_read != NULL); |
|
590.1.8
by Trond Norbye
Bug 421108: memstat reports same value for bytes, bytes_read and bytes_written |
5496 |
|
5497 |
char *bytes_written= memcached_stat_get_value(memc, memc_stat, |
|
5498 |
"bytes_written", &rc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5499 |
test_true(rc == MEMCACHED_SUCCESS); |
5500 |
test_true(bytes_written != NULL); |
|
590.1.8
by Trond Norbye
Bug 421108: memstat reports same value for bytes, bytes_read and bytes_written |
5501 |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5502 |
test_true(strcmp(bytes, bytes_read) != 0); |
5503 |
test_true(strcmp(bytes, bytes_written) != 0); |
|
590.1.8
by Trond Norbye
Bug 421108: memstat reports same value for bytes, bytes_read and bytes_written |
5504 |
|
5505 |
/* Release allocated resources */
|
|
5506 |
free(bytes); |
|
5507 |
free(bytes_read); |
|
5508 |
free(bytes_written); |
|
5509 |
memcached_stat_free(NULL, memc_stat); |
|
653
by Brian Aker
Test cleanup. |
5510 |
|
590.1.8
by Trond Norbye
Bug 421108: memstat reports same value for bytes, bytes_read and bytes_written |
5511 |
return TEST_SUCCESS; |
5512 |
}
|
|
5513 |
||
590.1.13
by Trond Norbye
Bug #442914: 'delete noreply' may hang the client |
5514 |
/*
|
5515 |
* The test case isn't obvious so I should probably document why
|
|
5516 |
* it works the way it does. Bug 442914 was caused by a bug
|
|
5517 |
* in the logic in memcached_purge (it did not handle the case
|
|
5518 |
* where the number of bytes sent was equal to the watermark).
|
|
5519 |
* In this test case, create messages so that we hit that case
|
|
5520 |
* and then disable noreply mode and issue a new command to
|
|
5521 |
* verify that it isn't stuck. If we change the format for the
|
|
5522 |
* delete command or the watermarks, we need to update this
|
|
5523 |
* test....
|
|
5524 |
*/
|
|
598.2.1
by Brian Aker
Updated test harness, merged Trond's fix for OSX hang. |
5525 |
static test_return_t regression_bug_442914(memcached_st *memc) |
590.1.13
by Trond Norbye
Bug #442914: 'delete noreply' may hang the client |
5526 |
{
|
630
by Brian Aker
Style cleanup |
5527 |
memcached_return_t rc; |
590.1.13
by Trond Norbye
Bug #442914: 'delete noreply' may hang the client |
5528 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NOREPLY, 1); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5529 |
test_true(rc == MEMCACHED_SUCCESS); |
590.1.13
by Trond Norbye
Bug #442914: 'delete noreply' may hang the client |
5530 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, 1); |
5531 |
||
695
by Brian Aker
number_of_hosts <-- encapsulated. |
5532 |
uint32_t number_of_hosts= memcached_server_count(memc); |
590.1.13
by Trond Norbye
Bug #442914: 'delete noreply' may hang the client |
5533 |
memc->number_of_hosts= 1; |
5534 |
||
5535 |
char k[250]; |
|
5536 |
size_t len; |
|
5537 |
||
728
by Brian Aker
Small icc repairs. |
5538 |
for (uint32_t x= 0; x < 250; ++x) |
590.1.13
by Trond Norbye
Bug #442914: 'delete noreply' may hang the client |
5539 |
{
|
5540 |
len= (size_t)snprintf(k, sizeof(k), "%0250u", x); |
|
5541 |
rc= memcached_delete(memc, k, len, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5542 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
590.1.13
by Trond Norbye
Bug #442914: 'delete noreply' may hang the client |
5543 |
}
|
5544 |
||
728
by Brian Aker
Small icc repairs. |
5545 |
(void)snprintf(k, sizeof(k), "%037u", 251U); |
5546 |
len= strlen(k); |
|
5547 |
||
590.1.13
by Trond Norbye
Bug #442914: 'delete noreply' may hang the client |
5548 |
rc= memcached_delete(memc, k, len, 0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5549 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
590.1.13
by Trond Norbye
Bug #442914: 'delete noreply' may hang the client |
5550 |
|
5551 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NOREPLY, 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5552 |
test_true(rc == MEMCACHED_SUCCESS); |
590.1.13
by Trond Norbye
Bug #442914: 'delete noreply' may hang the client |
5553 |
rc= memcached_delete(memc, k, len, 0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5554 |
test_true(rc == MEMCACHED_NOTFOUND); |
590.1.13
by Trond Norbye
Bug #442914: 'delete noreply' may hang the client |
5555 |
|
5556 |
memc->number_of_hosts= number_of_hosts; |
|
5557 |
||
5558 |
return TEST_SUCCESS; |
|
5559 |
}
|
|
5560 |
||
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5561 |
static test_return_t regression_bug_447342(memcached_st *memc) |
5562 |
{
|
|
794
by Brian Aker
Updating memcached_server_instance_st structure. |
5563 |
memcached_server_instance_st instance_one; |
5564 |
memcached_server_instance_st instance_two; |
|
709
by Brian Aker
Partial encapsulation of memcached_st->hosts |
5565 |
|
901.1.1
by Monty Taylor
Fixed systemtap issues (I hope) and a test case compile. |
5566 |
if (memcached_server_count(memc) < 3 || pre_replication(memc) != TEST_SUCCESS) |
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5567 |
return TEST_SKIPPED; |
5568 |
||
630
by Brian Aker
Style cleanup |
5569 |
memcached_return_t rc; |
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5570 |
|
5571 |
rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS, 2); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5572 |
test_true(rc == MEMCACHED_SUCCESS); |
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5573 |
|
5574 |
const size_t max_keys= 100; |
|
5575 |
char **keys= calloc(max_keys, sizeof(char*)); |
|
708
by Brian Aker
Abstract out ptr->hosts[server_key] references. |
5576 |
size_t *key_length= calloc(max_keys, sizeof(size_t)); |
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5577 |
|
718
by Brian Aker
32/64 bit cleanup issue in tests. |
5578 |
for (size_t x= 0; x < max_keys; ++x) |
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5579 |
{
|
603.1.6
by Trond Norbye
mget with replication didn't work if you had a cache miss |
5580 |
char k[251]; |
718
by Brian Aker
32/64 bit cleanup issue in tests. |
5581 |
|
903.1.8
by Brian Aker
Cleanup test failures. |
5582 |
key_length[x]= (size_t)snprintf(k, sizeof(k), "0200%lu", (unsigned long)x); |
603.1.6
by Trond Norbye
mget with replication didn't work if you had a cache miss |
5583 |
keys[x]= strdup(k); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5584 |
test_true(keys[x] != NULL); |
603.1.6
by Trond Norbye
mget with replication didn't work if you had a cache miss |
5585 |
rc= memcached_set(memc, k, key_length[x], k, key_length[x], 0, 0); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5586 |
test_true(rc == MEMCACHED_SUCCESS); |
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5587 |
}
|
5588 |
||
5589 |
/*
|
|
5590 |
** We are using the quiet commands to store the replicas, so we need
|
|
5591 |
** to ensure that all of them are processed before we can continue.
|
|
5592 |
** In the test we go directly from storing the object to trying to
|
|
5593 |
** receive the object from all of the different servers, so we
|
|
5594 |
** could end up in a race condition (the memcached server hasn't yet
|
|
5595 |
** processed the quiet command from the replication set when it process
|
|
5596 |
** the request from the other client (created by the clone)). As a
|
|
5597 |
** workaround for that we call memcached_quit to send the quit command
|
|
5598 |
** to the server and wait for the response ;-) If you use the test code
|
|
5599 |
** as an example for your own code, please note that you shouldn't need
|
|
5600 |
** to do this ;-)
|
|
5601 |
*/
|
|
5602 |
memcached_quit(memc); |
|
612.2.1
by Trond Norbye
Bug 463297: Deferred deletes doesn't work on a 1.4.x server |
5603 |
|
5604 |
/* Verify that all messages are stored, and we didn't stuff too much
|
|
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5605 |
* into the servers
|
5606 |
*/
|
|
5607 |
rc= memcached_mget(memc, (const char* const *)keys, key_length, max_keys); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5608 |
test_true(rc == MEMCACHED_SUCCESS); |
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5609 |
|
718
by Brian Aker
32/64 bit cleanup issue in tests. |
5610 |
size_t counter= 0; |
630
by Brian Aker
Style cleanup |
5611 |
memcached_execute_fn callbacks[1]= { [0]= &callback_counter }; |
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5612 |
rc= memcached_fetch_execute(memc, callbacks, (void *)&counter, 1); |
5613 |
/* Verify that we received all of the key/value pairs */
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5614 |
test_true(counter == max_keys); |
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5615 |
|
5616 |
memcached_quit(memc); |
|
5617 |
/*
|
|
5618 |
* Don't do the following in your code. I am abusing the internal details
|
|
5619 |
* within the library, and this is not a supported interface.
|
|
5620 |
* This is to verify correct behavior in the library. Fake that two servers
|
|
5621 |
* are dead..
|
|
5622 |
*/
|
|
792
by Brian Aker
Lots of compiler fixes. |
5623 |
instance_one= memcached_server_instance_by_position(memc, 0); |
5624 |
instance_two= memcached_server_instance_by_position(memc, 2); |
|
709
by Brian Aker
Partial encapsulation of memcached_st->hosts |
5625 |
in_port_t port0= instance_one->port; |
5626 |
in_port_t port2= instance_two->port; |
|
641
by Brian Aker
ICC fixes. |
5627 |
|
792
by Brian Aker
Lots of compiler fixes. |
5628 |
((memcached_server_write_instance_st)instance_one)->port= 0; |
5629 |
((memcached_server_write_instance_st)instance_two)->port= 0; |
|
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5630 |
|
5631 |
rc= memcached_mget(memc, (const char* const *)keys, key_length, max_keys); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5632 |
test_true(rc == MEMCACHED_SUCCESS); |
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5633 |
|
5634 |
counter= 0; |
|
5635 |
rc= memcached_fetch_execute(memc, callbacks, (void *)&counter, 1); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5636 |
test_true(counter == (unsigned int)max_keys); |
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5637 |
|
603.1.6
by Trond Norbye
mget with replication didn't work if you had a cache miss |
5638 |
/* restore the memc handle */
|
792
by Brian Aker
Lots of compiler fixes. |
5639 |
((memcached_server_write_instance_st)instance_one)->port= port0; |
5640 |
((memcached_server_write_instance_st)instance_two)->port= port2; |
|
603.1.6
by Trond Norbye
mget with replication didn't work if you had a cache miss |
5641 |
|
5642 |
memcached_quit(memc); |
|
5643 |
||
5644 |
/* Remove half of the objects */
|
|
708
by Brian Aker
Abstract out ptr->hosts[server_key] references. |
5645 |
for (size_t x= 0; x < max_keys; ++x) |
641
by Brian Aker
ICC fixes. |
5646 |
{
|
603.1.6
by Trond Norbye
mget with replication didn't work if you had a cache miss |
5647 |
if (x & 1) |
5648 |
{
|
|
5649 |
rc= memcached_delete(memc, keys[x], key_length[x], 0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5650 |
test_true(rc == MEMCACHED_SUCCESS); |
603.1.6
by Trond Norbye
mget with replication didn't work if you had a cache miss |
5651 |
}
|
641
by Brian Aker
ICC fixes. |
5652 |
}
|
603.1.6
by Trond Norbye
mget with replication didn't work if you had a cache miss |
5653 |
|
5654 |
memcached_quit(memc); |
|
792
by Brian Aker
Lots of compiler fixes. |
5655 |
((memcached_server_write_instance_st)instance_one)->port= 0; |
5656 |
((memcached_server_write_instance_st)instance_two)->port= 0; |
|
603.1.6
by Trond Norbye
mget with replication didn't work if you had a cache miss |
5657 |
|
5658 |
/* now retry the command, this time we should have cache misses */
|
|
5659 |
rc= memcached_mget(memc, (const char* const *)keys, key_length, max_keys); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5660 |
test_true(rc == MEMCACHED_SUCCESS); |
603.1.6
by Trond Norbye
mget with replication didn't work if you had a cache miss |
5661 |
|
5662 |
counter= 0; |
|
5663 |
rc= memcached_fetch_execute(memc, callbacks, (void *)&counter, 1); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5664 |
test_true(counter == (unsigned int)(max_keys >> 1)); |
603.1.6
by Trond Norbye
mget with replication didn't work if you had a cache miss |
5665 |
|
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5666 |
/* Release allocated resources */
|
5667 |
for (size_t x= 0; x < max_keys; ++x) |
|
708
by Brian Aker
Abstract out ptr->hosts[server_key] references. |
5668 |
{
|
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5669 |
free(keys[x]); |
708
by Brian Aker
Abstract out ptr->hosts[server_key] references. |
5670 |
}
|
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5671 |
free(keys); |
5672 |
free(key_length); |
|
5673 |
||
5674 |
/* restore the memc handle */
|
|
792
by Brian Aker
Lots of compiler fixes. |
5675 |
((memcached_server_write_instance_st)instance_one)->port= port0; |
5676 |
((memcached_server_write_instance_st)instance_two)->port= port2; |
|
641
by Brian Aker
ICC fixes. |
5677 |
|
603.1.5
by Trond Norbye
Fix problems with multigets and replication |
5678 |
return TEST_SUCCESS; |
5679 |
}
|
|
5680 |
||
612.2.1
by Trond Norbye
Bug 463297: Deferred deletes doesn't work on a 1.4.x server |
5681 |
static test_return_t regression_bug_463297(memcached_st *memc) |
5682 |
{
|
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
5683 |
memcached_st *memc_clone= memcached_clone(NULL, memc); |
5684 |
test_true(memc_clone != NULL); |
|
5685 |
test_true(memcached_version(memc_clone) == MEMCACHED_SUCCESS); |
|
5686 |
||
5687 |
memcached_server_instance_st instance= |
|
5688 |
memcached_server_instance_by_position(memc_clone, 0); |
|
5689 |
||
5690 |
if (instance->major_version > 1 || |
|
5691 |
(instance->major_version == 1 && |
|
5692 |
instance->minor_version > 2)) |
|
612.2.1
by Trond Norbye
Bug 463297: Deferred deletes doesn't work on a 1.4.x server |
5693 |
{
|
861
by Brian Aker
Fix for version on OSX |
5694 |
/* Binary protocol doesn't support deferred delete */
|
5695 |
memcached_st *bin_clone= memcached_clone(NULL, memc); |
|
5696 |
test_true(bin_clone != NULL); |
|
5697 |
test_true(memcached_behavior_set(bin_clone, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1) == MEMCACHED_SUCCESS); |
|
5698 |
test_true(memcached_delete(bin_clone, "foo", 3, 1) == MEMCACHED_INVALID_ARGUMENTS); |
|
5699 |
memcached_free(bin_clone); |
|
5700 |
||
5701 |
memcached_quit(memc_clone); |
|
5702 |
||
5703 |
/* If we know the server version, deferred delete should fail
|
|
5704 |
* with invalid arguments */
|
|
5705 |
test_true(memcached_delete(memc_clone, "foo", 3, 1) == MEMCACHED_INVALID_ARGUMENTS); |
|
5706 |
||
5707 |
/* If we don't know the server version, we should get a protocol error */
|
|
5708 |
memcached_return_t rc= memcached_delete(memc, "foo", 3, 1); |
|
5709 |
||
5710 |
/* but there is a bug in some of the memcached servers (1.4) that treats
|
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
5711 |
* the counter as noreply so it doesn't send the proper error message
|
903.1.6
by Brian Aker
Version will now have a default we can use to look for invalid versions. |
5712 |
*/
|
5713 |
test_true_got(rc == MEMCACHED_PROTOCOL_ERROR || rc == MEMCACHED_NOTFOUND || rc == MEMCACHED_CLIENT_ERROR || rc == MEMCACHED_INVALID_ARGUMENTS, memcached_strerror(NULL, rc)); |
|
861
by Brian Aker
Fix for version on OSX |
5714 |
|
5715 |
/* And buffered mode should be disabled and we should get protocol error */
|
|
5716 |
test_true(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 1) == MEMCACHED_SUCCESS); |
|
5717 |
rc= memcached_delete(memc, "foo", 3, 1); |
|
903.1.6
by Brian Aker
Version will now have a default we can use to look for invalid versions. |
5718 |
test_true_got(rc == MEMCACHED_PROTOCOL_ERROR || rc == MEMCACHED_NOTFOUND || rc == MEMCACHED_CLIENT_ERROR || rc == MEMCACHED_INVALID_ARGUMENTS, memcached_strerror(NULL, rc)); |
861
by Brian Aker
Fix for version on OSX |
5719 |
|
5720 |
/* Same goes for noreply... */
|
|
5721 |
test_true(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NOREPLY, 1) == MEMCACHED_SUCCESS); |
|
5722 |
rc= memcached_delete(memc, "foo", 3, 1); |
|
903.1.6
by Brian Aker
Version will now have a default we can use to look for invalid versions. |
5723 |
test_true_got(rc == MEMCACHED_PROTOCOL_ERROR || rc == MEMCACHED_NOTFOUND || rc == MEMCACHED_CLIENT_ERROR || rc == MEMCACHED_INVALID_ARGUMENTS, memcached_strerror(NULL, rc)); |
861
by Brian Aker
Fix for version on OSX |
5724 |
|
5725 |
/* but a normal request should go through (and be buffered) */
|
|
5726 |
test_true((rc= memcached_delete(memc, "foo", 3, 0)) == MEMCACHED_BUFFERED); |
|
5727 |
test_true(memcached_flush_buffers(memc) == MEMCACHED_SUCCESS); |
|
5728 |
||
5729 |
test_true(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BUFFER_REQUESTS, 0) == MEMCACHED_SUCCESS); |
|
5730 |
/* unbuffered noreply should be success */
|
|
5731 |
test_true(memcached_delete(memc, "foo", 3, 0) == MEMCACHED_SUCCESS); |
|
5732 |
/* unbuffered with reply should be not found... */
|
|
5733 |
test_true(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NOREPLY, 0) == MEMCACHED_SUCCESS); |
|
5734 |
test_true(memcached_delete(memc, "foo", 3, 0) == MEMCACHED_NOTFOUND); |
|
612.2.1
by Trond Norbye
Bug 463297: Deferred deletes doesn't work on a 1.4.x server |
5735 |
}
|
5736 |
||
5737 |
memcached_free(memc_clone); |
|
5738 |
return TEST_SUCCESS; |
|
5739 |
}
|
|
5740 |
||
5741 |
||
598.3.1
by Jean-Charles Redoutey
Added reviewed version of memcached_server_get_last_disconnect |
5742 |
/* Test memcached_server_get_last_disconnect
|
5743 |
* For a working server set, shall be NULL
|
|
5744 |
* For a set of non existing server, shall not be NULL
|
|
5745 |
*/
|
|
736
by Brian Aker
Updates for CORK. |
5746 |
static test_return_t test_get_last_disconnect(memcached_st *memc) |
598.3.1
by Jean-Charles Redoutey
Added reviewed version of memcached_server_get_last_disconnect |
5747 |
{
|
630
by Brian Aker
Style cleanup |
5748 |
memcached_return_t rc; |
794
by Brian Aker
Updating memcached_server_instance_st structure. |
5749 |
memcached_server_instance_st disconnected_server; |
598.3.1
by Jean-Charles Redoutey
Added reviewed version of memcached_server_get_last_disconnect |
5750 |
|
5751 |
/* With the working set of server */
|
|
5752 |
const char *key= "marmotte"; |
|
5753 |
const char *value= "milka"; |
|
5754 |
||
833
by Brian Aker
Fix for bad name servers. |
5755 |
memcached_reset_last_disconnected_server(memc); |
598.3.1
by Jean-Charles Redoutey
Added reviewed version of memcached_server_get_last_disconnect |
5756 |
rc= memcached_set(memc, key, strlen(key), |
5757 |
value, strlen(value), |
|
5758 |
(time_t)0, (uint32_t)0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5759 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
598.3.1
by Jean-Charles Redoutey
Added reviewed version of memcached_server_get_last_disconnect |
5760 |
|
5761 |
disconnected_server = memcached_server_get_last_disconnect(memc); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5762 |
test_true(disconnected_server == NULL); |
598.3.1
by Jean-Charles Redoutey
Added reviewed version of memcached_server_get_last_disconnect |
5763 |
|
5764 |
/* With a non existing server */
|
|
5765 |
memcached_st *mine; |
|
5766 |
memcached_server_st *servers; |
|
5767 |
||
5768 |
const char *server_list= "localhost:9"; |
|
5769 |
||
5770 |
servers= memcached_servers_parse(server_list); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5771 |
test_true(servers); |
598.3.1
by Jean-Charles Redoutey
Added reviewed version of memcached_server_get_last_disconnect |
5772 |
mine= memcached_create(NULL); |
5773 |
rc= memcached_server_push(mine, servers); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5774 |
test_true(rc == MEMCACHED_SUCCESS); |
598.3.1
by Jean-Charles Redoutey
Added reviewed version of memcached_server_get_last_disconnect |
5775 |
memcached_server_list_free(servers); |
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5776 |
test_true(mine); |
598.3.1
by Jean-Charles Redoutey
Added reviewed version of memcached_server_get_last_disconnect |
5777 |
|
5778 |
rc= memcached_set(mine, key, strlen(key), |
|
5779 |
value, strlen(value), |
|
5780 |
(time_t)0, (uint32_t)0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5781 |
test_true(rc != MEMCACHED_SUCCESS); |
598.3.1
by Jean-Charles Redoutey
Added reviewed version of memcached_server_get_last_disconnect |
5782 |
|
833
by Brian Aker
Fix for bad name servers. |
5783 |
disconnected_server= memcached_server_get_last_disconnect(mine); |
5784 |
if (disconnected_server == NULL) |
|
5785 |
{
|
|
5786 |
fprintf(stderr, "RC %s\n", memcached_strerror(mine, rc)); |
|
5787 |
abort(); |
|
5788 |
}
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5789 |
test_true(disconnected_server != NULL); |
793
by Brian Aker
Merge in additional type fixes. |
5790 |
test_true(memcached_server_port(disconnected_server)== 9); |
5791 |
test_true(strncmp(memcached_server_name(disconnected_server),"localhost",9) == 0); |
|
598.3.1
by Jean-Charles Redoutey
Added reviewed version of memcached_server_get_last_disconnect |
5792 |
|
5793 |
memcached_quit(mine); |
|
5794 |
memcached_free(mine); |
|
5795 |
||
5796 |
return TEST_SUCCESS; |
|
5797 |
}
|
|
598.5.1
by Jean-Charles Redoutey
Fixed retry counter wrongly incremented in case of certain behavior change |
5798 |
|
818
by Brian Aker
Concurrent memcached_verbosity(). |
5799 |
static test_return_t test_verbosity(memcached_st *memc) |
5800 |
{
|
|
5801 |
memcached_verbosity(memc, 3); |
|
5802 |
||
5803 |
return TEST_SUCCESS; |
|
5804 |
}
|
|
5805 |
||
823
by Brian Aker
Improve on algo for disabling bad hosts. |
5806 |
static test_return_t test_server_failure(memcached_st *memc) |
5807 |
{
|
|
5808 |
memcached_st *local_memc; |
|
5809 |
memcached_server_instance_st instance= memcached_server_instance_by_position(memc, 0); |
|
5810 |
||
5811 |
local_memc= memcached_create(NULL); |
|
5812 |
||
5813 |
memcached_server_add(local_memc, memcached_server_name(instance), memcached_server_port(instance)); |
|
5814 |
memcached_behavior_set(local_memc, MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT, 2); |
|
5815 |
||
5816 |
uint32_t server_count= memcached_server_count(local_memc); |
|
5817 |
||
5818 |
test_true(server_count == 1); |
|
5819 |
||
5820 |
// Disable the server
|
|
5821 |
instance= memcached_server_instance_by_position(local_memc, 0); |
|
5822 |
((memcached_server_write_instance_st)instance)->server_failure_counter= 2; |
|
5823 |
||
5824 |
memcached_return_t rc; |
|
5825 |
rc= memcached_set(local_memc, "foo", strlen("foo"), |
|
5826 |
NULL, 0, |
|
5827 |
(time_t)0, (uint32_t)0); |
|
5828 |
test_true(rc == MEMCACHED_SERVER_MARKED_DEAD); |
|
5829 |
||
5830 |
((memcached_server_write_instance_st)instance)->server_failure_counter= 0; |
|
5831 |
rc= memcached_set(local_memc, "foo", strlen("foo"), |
|
5832 |
NULL, 0, |
|
5833 |
(time_t)0, (uint32_t)0); |
|
5834 |
test_true(rc == MEMCACHED_SUCCESS); |
|
5835 |
||
5836 |
||
5837 |
memcached_free(local_memc); |
|
5838 |
||
5839 |
return TEST_SUCCESS; |
|
5840 |
}
|
|
5841 |
||
822
by Brian Aker
Update for last disconnect to stick around even if ejected. |
5842 |
static test_return_t test_cull_servers(memcached_st *memc) |
5843 |
{
|
|
5844 |
uint32_t count = memcached_server_count(memc); |
|
5845 |
||
5846 |
// Do not do this in your code, it is not supported.
|
|
5847 |
memc->servers[1].state.is_dead= true; |
|
5848 |
memc->state.is_time_for_rebuild= true; |
|
5849 |
||
5850 |
uint32_t new_count= memcached_server_count(memc); |
|
5851 |
test_true(count == new_count); |
|
5852 |
||
5853 |
#if 0
|
|
5854 |
test_true(count == new_count + 1 );
|
|
5855 |
#endif
|
|
5856 |
||
5857 |
return TEST_SUCCESS; |
|
5858 |
}
|
|
5859 |
||
876
by Brian Aker
Merge in usage for execute_stat. |
5860 |
|
875
by Brian Aker
Merge in memcached_stat_execute(). |
5861 |
static memcached_return_t stat_printer(memcached_server_instance_st server, |
5862 |
const char *key, size_t key_length, |
|
5863 |
const char *value, size_t value_length, |
|
5864 |
void *context) |
|
5865 |
{
|
|
5866 |
(void)server; |
|
5867 |
(void)context; |
|
5868 |
(void)key; |
|
5869 |
(void)key_length; |
|
5870 |
(void)value; |
|
5871 |
(void)value_length; |
|
5872 |
||
5873 |
return MEMCACHED_SUCCESS; |
|
5874 |
}
|
|
5875 |
||
5876 |
static test_return_t memcached_stat_execute_test(memcached_st *memc) |
|
5877 |
{
|
|
5878 |
memcached_return_t rc= memcached_stat_execute(memc, NULL, stat_printer, NULL); |
|
5879 |
test_true(rc == MEMCACHED_SUCCESS); |
|
5880 |
||
5881 |
rc= memcached_stat_execute(memc, "slabs", stat_printer, NULL); |
|
5882 |
test_true(rc == MEMCACHED_SUCCESS); |
|
5883 |
||
5884 |
rc= memcached_stat_execute(memc, "items", stat_printer, NULL); |
|
5885 |
test_true(rc == MEMCACHED_SUCCESS); |
|
5886 |
||
5887 |
rc= memcached_stat_execute(memc, "sizes", stat_printer, NULL); |
|
5888 |
test_true(rc == MEMCACHED_SUCCESS); |
|
5889 |
||
5890 |
return TEST_SUCCESS; |
|
5891 |
}
|
|
5892 |
||
598.5.1
by Jean-Charles Redoutey
Fixed retry counter wrongly incremented in case of certain behavior change |
5893 |
/*
|
602.1.3
by Trond Norbye
Simplify wrong_failure_counter_test to only test the changed code |
5894 |
* This test ensures that the failure counter isn't incremented during
|
5895 |
* normal termination of the memcached instance.
|
|
598.5.1
by Jean-Charles Redoutey
Fixed retry counter wrongly incremented in case of certain behavior change |
5896 |
*/
|
5897 |
static test_return_t wrong_failure_counter_test(memcached_st *memc) |
|
5898 |
{
|
|
630
by Brian Aker
Style cleanup |
5899 |
memcached_return_t rc; |
794
by Brian Aker
Updating memcached_server_instance_st structure. |
5900 |
memcached_server_instance_st instance; |
598.5.1
by Jean-Charles Redoutey
Fixed retry counter wrongly incremented in case of certain behavior change |
5901 |
|
5902 |
/* Set value to force connection to the server */
|
|
5903 |
const char *key= "marmotte"; |
|
5904 |
const char *value= "milka"; |
|
602.1.3
by Trond Norbye
Simplify wrong_failure_counter_test to only test the changed code |
5905 |
|
5906 |
/*
|
|
5907 |
* Please note that I'm abusing the internal structures in libmemcached
|
|
5908 |
* in a non-portable way and you shouldn't be doing this. I'm only
|
|
5909 |
* doing this in order to verify that the library works the way it should
|
|
5910 |
*/
|
|
695
by Brian Aker
number_of_hosts <-- encapsulated. |
5911 |
uint32_t number_of_hosts= memcached_server_count(memc); |
602.1.3
by Trond Norbye
Simplify wrong_failure_counter_test to only test the changed code |
5912 |
memc->number_of_hosts= 1; |
5913 |
||
5914 |
/* Ensure that we are connected to the server by setting a value */
|
|
598.5.1
by Jean-Charles Redoutey
Fixed retry counter wrongly incremented in case of certain behavior change |
5915 |
rc= memcached_set(memc, key, strlen(key), |
5916 |
value, strlen(value), |
|
5917 |
(time_t)0, (uint32_t)0); |
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5918 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED); |
598.5.1
by Jean-Charles Redoutey
Fixed retry counter wrongly incremented in case of certain behavior change |
5919 |
|
5920 |
||
792
by Brian Aker
Lots of compiler fixes. |
5921 |
instance= memcached_server_instance_by_position(memc, 0); |
602.1.3
by Trond Norbye
Simplify wrong_failure_counter_test to only test the changed code |
5922 |
/* The test is to see that the memcached_quit doesn't increase the
|
5923 |
* the server failure conter, so let's ensure that it is zero
|
|
5924 |
* before sending quit
|
|
5925 |
*/
|
|
792
by Brian Aker
Lots of compiler fixes. |
5926 |
((memcached_server_write_instance_st)instance)->server_failure_counter= 0; |
602.1.3
by Trond Norbye
Simplify wrong_failure_counter_test to only test the changed code |
5927 |
|
5928 |
memcached_quit(memc); |
|
5929 |
||
5930 |
/* Verify that it memcached_quit didn't increment the failure counter
|
|
5931 |
* Please note that this isn't bullet proof, because an error could
|
|
5932 |
* occur...
|
|
5933 |
*/
|
|
737
by Brian Aker
Updated test_truth to be test_true to match the shades, I mean test_false() |
5934 |
test_true(instance->server_failure_counter == 0); |
602.1.3
by Trond Norbye
Simplify wrong_failure_counter_test to only test the changed code |
5935 |
|
5936 |
/* restore the instance */
|
|
5937 |
memc->number_of_hosts= number_of_hosts; |
|
598.5.1
by Jean-Charles Redoutey
Fixed retry counter wrongly incremented in case of certain behavior change |
5938 |
|
5939 |
return TEST_SUCCESS; |
|
5940 |
}
|
|
5941 |
||
916
by Brian Aker
Merge in test case from JC Redoutey . |
5942 |
/*
|
5943 |
* This tests ensures expected disconnections (for some behavior changes
|
|
5944 |
* for instance) do not wrongly increase failure counter
|
|
5945 |
*/
|
|
5946 |
static test_return_t wrong_failure_counter_two_test(memcached_st *memc) |
|
5947 |
{
|
|
5948 |
memcached_return rc; |
|
5949 |
||
5950 |
memcached_st *memc_clone; |
|
5951 |
memc_clone= memcached_clone(NULL, memc); |
|
5952 |
test_true(memc_clone); |
|
5953 |
||
5954 |
/* Set value to force connection to the server */
|
|
5955 |
const char *key= "marmotte"; |
|
5956 |
const char *value= "milka"; |
|
5957 |
char *string = NULL; |
|
5958 |
size_t string_length; |
|
5959 |
uint32_t flags; |
|
5960 |
||
5961 |
rc= memcached_set(memc_clone, key, strlen(key), |
|
5962 |
value, strlen(value), |
|
5963 |
(time_t)0, (uint32_t)0); |
|
5964 |
test_true_got(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED, memcached_strerror(NULL, rc)); |
|
5965 |
||
5966 |
||
5967 |
/* put failure limit to 1 */
|
|
5968 |
rc= memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT, 1); |
|
5969 |
assert(rc == MEMCACHED_SUCCESS); |
|
928.1.3
by Brian Aker
Fix strlen vs sizeof usage in a few spots. |
5970 |
|
916
by Brian Aker
Merge in test case from JC Redoutey . |
5971 |
/* Put a retry timeout to effectively activate failure_limit effect */
|
5972 |
rc= memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_RETRY_TIMEOUT, 1); |
|
5973 |
assert(rc == MEMCACHED_SUCCESS); |
|
928.1.3
by Brian Aker
Fix strlen vs sizeof usage in a few spots. |
5974 |
|
916
by Brian Aker
Merge in test case from JC Redoutey . |
5975 |
/* change behavior that triggers memcached_quit()*/
|
5976 |
rc= memcached_behavior_set(memc_clone, MEMCACHED_BEHAVIOR_TCP_NODELAY, 1); |
|
5977 |
assert(rc == MEMCACHED_SUCCESS); |
|
5978 |
||
5979 |
||
5980 |
/* Check if we still are connected */
|
|
5981 |
string= memcached_get(memc_clone, key, strlen(key), |
|
5982 |
&string_length, &flags, &rc); |
|
5983 |
||
5984 |
test_true_got(rc == MEMCACHED_SUCCESS, memcached_strerror(NULL, rc)); |
|
5985 |
test_true(string); |
|
5986 |
free(string); |
|
5987 |
||
5988 |
return TEST_SUCCESS; |
|
5989 |
}
|
|
5990 |
||
622.2.1
by Jean-Charles Redoutey
Fixed mget_execute possibly failing into some non ending recursive call |
5991 |
|
5992 |
||
5993 |
||
5994 |
/*
|
|
5995 |
* Test that ensures mget_execute does not end into recursive calls that finally fails
|
|
5996 |
*/
|
|
5997 |
static test_return_t regression_bug_490486(memcached_st *memc) |
|
5998 |
{
|
|
715
by Brian Aker
Fix for bug #15450 |
5999 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1); |
6000 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 1); |
|
6001 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, 1000); |
|
6002 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT, 1); |
|
6003 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_RETRY_TIMEOUT, 3600); |
|
622.2.1
by Jean-Charles Redoutey
Fixed mget_execute possibly failing into some non ending recursive call |
6004 |
|
835
by Brian Aker
Updates for OSX issues. |
6005 |
#ifdef __APPLE__
|
6006 |
return TEST_SKIPPED; // My MAC can't handle this test |
|
6007 |
#endif
|
|
6008 |
||
622.2.1
by Jean-Charles Redoutey
Fixed mget_execute possibly failing into some non ending recursive call |
6009 |
/*
|
6010 |
* I only want to hit _one_ server so I know the number of requests I'm
|
|
6011 |
* sending in the pipeline.
|
|
6012 |
*/
|
|
6013 |
uint32_t number_of_hosts= memc->number_of_hosts; |
|
6014 |
memc->number_of_hosts= 1; |
|
715
by Brian Aker
Fix for bug #15450 |
6015 |
size_t max_keys= 20480; |
6016 |
||
6017 |
||
6018 |
char **keys= calloc(max_keys, sizeof(char*)); |
|
6019 |
size_t *key_length=calloc(max_keys, sizeof(size_t)); |
|
622.2.1
by Jean-Charles Redoutey
Fixed mget_execute possibly failing into some non ending recursive call |
6020 |
|
6021 |
/* First add all of the items.. */
|
|
835
by Brian Aker
Updates for OSX issues. |
6022 |
bool slept= false; |
715
by Brian Aker
Fix for bug #15450 |
6023 |
char blob[1024]= { 0 }; |
622.2.1
by Jean-Charles Redoutey
Fixed mget_execute possibly failing into some non ending recursive call |
6024 |
memcached_return rc; |
715
by Brian Aker
Fix for bug #15450 |
6025 |
for (size_t x= 0; x < max_keys; ++x) |
622.2.1
by Jean-Charles Redoutey
Fixed mget_execute possibly failing into some non ending recursive call |
6026 |
{
|
6027 |
char k[251]; |
|
903.1.8
by Brian Aker
Cleanup test failures. |
6028 |
key_length[x]= (size_t)snprintf(k, sizeof(k), "0200%lu", (unsigned long)x); |
622.2.1
by Jean-Charles Redoutey
Fixed mget_execute possibly failing into some non ending recursive call |
6029 |
keys[x]= strdup(k); |
6030 |
assert(keys[x] != NULL); |
|
6031 |
rc= memcached_set(memc, keys[x], key_length[x], blob, sizeof(blob), 0, 0); |
|
835
by Brian Aker
Updates for OSX issues. |
6032 |
#ifdef __APPLE__
|
6033 |
if (rc == MEMCACHED_SERVER_MARKED_DEAD) |
|
6034 |
{
|
|
6035 |
break; // We are out of business |
|
6036 |
}
|
|
6037 |
#endif
|
|
6038 |
test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_BUFFERED || rc == MEMCACHED_TIMEOUT); // MEMCACHED_TIMEOUT <-- only observed on OSX |
|
6039 |
||
6040 |
if (rc == MEMCACHED_TIMEOUT && slept == false) |
|
6041 |
{
|
|
6042 |
x++; |
|
6043 |
sleep(1);// We will try to sleep |
|
6044 |
slept= true; |
|
6045 |
}
|
|
6046 |
else if (rc == MEMCACHED_TIMEOUT && slept == true) |
|
6047 |
{
|
|
6048 |
// We failed to send everything.
|
|
6049 |
break; |
|
6050 |
}
|
|
6051 |
}
|
|
6052 |
||
6053 |
if (rc != MEMCACHED_SERVER_MARKED_DEAD) |
|
6054 |
{
|
|
6055 |
||
6056 |
/* Try to get all of them with a large multiget */
|
|
6057 |
size_t counter= 0; |
|
6058 |
memcached_execute_function callbacks[1]= { [0]= &callback_counter }; |
|
6059 |
rc= memcached_mget_execute(memc, (const char**)keys, key_length, |
|
6060 |
(size_t)max_keys, callbacks, &counter, 1); |
|
6061 |
||
6062 |
assert(rc == MEMCACHED_SUCCESS); |
|
6063 |
char* the_value= NULL; |
|
6064 |
char the_key[MEMCACHED_MAX_KEY]; |
|
6065 |
size_t the_key_length; |
|
6066 |
size_t the_value_length; |
|
6067 |
uint32_t the_flags; |
|
6068 |
||
6069 |
do { |
|
6070 |
the_value= memcached_fetch(memc, the_key, &the_key_length, &the_value_length, &the_flags, &rc); |
|
6071 |
||
6072 |
if ((the_value!= NULL) && (rc == MEMCACHED_SUCCESS)) |
|
6073 |
{
|
|
6074 |
++counter; |
|
6075 |
free(the_value); |
|
6076 |
}
|
|
6077 |
||
6078 |
} while ( (the_value!= NULL) && (rc == MEMCACHED_SUCCESS)); |
|
6079 |
||
6080 |
||
6081 |
assert(rc == MEMCACHED_END); |
|
6082 |
||
6083 |
/* Verify that we got all of the items */
|
|
6084 |
assert(counter == max_keys); |
|
6085 |
}
|
|
622.2.1
by Jean-Charles Redoutey
Fixed mget_execute possibly failing into some non ending recursive call |
6086 |
|
6087 |
/* Release all allocated resources */
|
|
715
by Brian Aker
Fix for bug #15450 |
6088 |
for (size_t x= 0; x < max_keys; ++x) |
6089 |
{
|
|
622.2.1
by Jean-Charles Redoutey
Fixed mget_execute possibly failing into some non ending recursive call |
6090 |
free(keys[x]); |
715
by Brian Aker
Fix for bug #15450 |
6091 |
}
|
622.2.1
by Jean-Charles Redoutey
Fixed mget_execute possibly failing into some non ending recursive call |
6092 |
free(keys); |
6093 |
free(key_length); |
|
6094 |
||
6095 |
memc->number_of_hosts= number_of_hosts; |
|
715
by Brian Aker
Fix for bug #15450 |
6096 |
|
622.2.1
by Jean-Charles Redoutey
Fixed mget_execute possibly failing into some non ending recursive call |
6097 |
return TEST_SUCCESS; |
6098 |
}
|
|
6099 |
||
841
by Brian Aker
Fix (though only partial), for connect timeout. |
6100 |
static test_return_t regression_bug_583031(memcached_st *unused) |
6101 |
{
|
|
6102 |
(void)unused; |
|
6103 |
||
6104 |
memcached_st *memc= memcached_create(NULL); |
|
6105 |
assert(memc); |
|
6106 |
memcached_server_add(memc, "10.2.3.4", 11211); |
|
6107 |
||
6108 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT, 1000); |
|
6109 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_RETRY_TIMEOUT, 1000); |
|
6110 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SND_TIMEOUT, 1000); |
|
6111 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_RCV_TIMEOUT, 1000); |
|
6112 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_POLL_TIMEOUT, 1000); |
|
6113 |
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT, 3); |
|
6114 |
||
6115 |
memcached_return_t rc; |
|
6116 |
size_t length; |
|
6117 |
uint32_t flags; |
|
6118 |
||
6119 |
(void)memcached_get(memc, "dsf", 3, &length, &flags, &rc); |
|
6120 |
||
905.1.8
by Brian Aker
Better reporting on errors from mget. |
6121 |
test_true_got(rc == MEMCACHED_TIMEOUT, memcached_strerror(NULL, rc)); |
841
by Brian Aker
Fix (though only partial), for connect timeout. |
6122 |
|
6123 |
memcached_free(memc); |
|
6124 |
||
6125 |
return TEST_SUCCESS; |
|
6126 |
}
|
|
6127 |
||
922
by Brian Aker
Fix for memory leak when parsing servers. |
6128 |
// Look for memory leak
|
6129 |
static test_return_t regression_bug_728286(memcached_st *unused) |
|
6130 |
{
|
|
6131 |
(void)unused; |
|
6132 |
memcached_server_st *servers = memcached_servers_parse("1.2.3.4:99"); |
|
6133 |
memcached_server_free(servers); |
|
6134 |
||
6135 |
return TEST_SUCCESS; |
|
6136 |
}
|
|
6137 |
||
926
by Brian Aker
Merge in solution for lp:581030. |
6138 |
static test_return_t regression_bug_581030(memcached_st *unused) |
6139 |
{
|
|
6140 |
(void)unused; |
|
6141 |
||
6142 |
#ifndef DEBUG
|
|
6143 |
memcached_stat_st *local_stat= memcached_stat(NULL, NULL, NULL); |
|
6144 |
test_false(local_stat); |
|
6145 |
||
6146 |
memcached_stat_free(NULL, NULL); |
|
6147 |
#endif
|
|
6148 |
||
6149 |
return TEST_SUCCESS; |
|
6150 |
}
|
|
6151 |
||
833
by Brian Aker
Fix for bad name servers. |
6152 |
static void memcached_die(memcached_st* mc, memcached_return error, const char* what, uint32_t it) |
831
by Brian Aker
Test case |
6153 |
{
|
833
by Brian Aker
Fix for bad name servers. |
6154 |
fprintf(stderr, "Iteration #%u: ", it); |
831
by Brian Aker
Test case |
6155 |
|
6156 |
if(error == MEMCACHED_ERRNO) |
|
6157 |
{
|
|
6158 |
fprintf(stderr, "system error %d from %s: %s\n", |
|
6159 |
errno, what, strerror(errno)); |
|
6160 |
}
|
|
6161 |
else
|
|
6162 |
{
|
|
6163 |
fprintf(stderr, "error %d from %s: %s\n", error, what, |
|
6164 |
memcached_strerror(mc, error)); |
|
6165 |
}
|
|
6166 |
}
|
|
6167 |
||
833
by Brian Aker
Fix for bad name servers. |
6168 |
#define TEST_CONSTANT_CREATION 200
|
831
by Brian Aker
Test case |
6169 |
|
6170 |
static test_return_t regression_bug_(memcached_st *memc) |
|
6171 |
{
|
|
833
by Brian Aker
Fix for bad name servers. |
6172 |
const char *remote_server; |
6173 |
(void)memc; |
|
6174 |
||
6175 |
if (! (remote_server= getenv("LIBMEMCACHED_REMOTE_SERVER"))) |
|
6176 |
{
|
|
6177 |
return TEST_SKIPPED; |
|
6178 |
}
|
|
831
by Brian Aker
Test case |
6179 |
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
6180 |
for (uint32_t x= 0; x < TEST_CONSTANT_CREATION; x++) |
831
by Brian Aker
Test case |
6181 |
{
|
6182 |
memcached_st* mc= memcached_create(NULL); |
|
6183 |
memcached_return rc; |
|
6184 |
||
6185 |
rc= memcached_behavior_set(mc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1); |
|
6186 |
if (rc != MEMCACHED_SUCCESS) |
|
6187 |
{
|
|
6188 |
memcached_die(mc, rc, "memcached_behavior_set", x); |
|
6189 |
}
|
|
6190 |
||
6191 |
rc= memcached_behavior_set(mc, MEMCACHED_BEHAVIOR_CACHE_LOOKUPS, 1); |
|
6192 |
if (rc != MEMCACHED_SUCCESS) |
|
6193 |
{
|
|
6194 |
memcached_die(mc, rc, "memcached_behavior_set", x); |
|
6195 |
}
|
|
6196 |
||
833
by Brian Aker
Fix for bad name servers. |
6197 |
rc= memcached_server_add(mc, remote_server, 0); |
6198 |
if (rc != MEMCACHED_SUCCESS) |
|
831
by Brian Aker
Test case |
6199 |
{
|
6200 |
memcached_die(mc, rc, "memcached_server_add", x); |
|
6201 |
}
|
|
6202 |
||
6203 |
const char *set_key= "akey"; |
|
6204 |
const size_t set_key_len= strlen(set_key); |
|
6205 |
const char *set_value= "a value"; |
|
6206 |
const size_t set_value_len= strlen(set_value); |
|
6207 |
||
833
by Brian Aker
Fix for bad name servers. |
6208 |
if (rc == MEMCACHED_SUCCESS) |
831
by Brian Aker
Test case |
6209 |
{
|
908.1.1
by Trond Norbye
Don't use __attribute__((unused)) |
6210 |
if (x > 0) |
833
by Brian Aker
Fix for bad name servers. |
6211 |
{
|
6212 |
size_t get_value_len; |
|
6213 |
char *get_value; |
|
6214 |
uint32_t get_value_flags; |
|
6215 |
||
6216 |
get_value= memcached_get(mc, set_key, set_key_len, &get_value_len, |
|
6217 |
&get_value_flags, &rc); |
|
6218 |
if (rc != MEMCACHED_SUCCESS) |
|
6219 |
{
|
|
6220 |
memcached_die(mc, rc, "memcached_get", x); |
|
6221 |
}
|
|
6222 |
else
|
|
6223 |
{
|
|
6224 |
||
6225 |
if (x != 0 && |
|
6226 |
(get_value_len != set_value_len |
|
6227 |
|| 0!=strncmp(get_value, set_value, get_value_len))) |
|
6228 |
{
|
|
6229 |
fprintf(stderr, "Values don't match?\n"); |
|
6230 |
rc= MEMCACHED_FAILURE; |
|
6231 |
}
|
|
6232 |
free(get_value); |
|
6233 |
}
|
|
6234 |
}
|
|
6235 |
||
6236 |
rc= memcached_set(mc, |
|
6237 |
set_key, set_key_len, |
|
6238 |
set_value, set_value_len, |
|
6239 |
0, /* time */ |
|
6240 |
0 /* flags */ |
|
6241 |
);
|
|
831
by Brian Aker
Test case |
6242 |
if (rc != MEMCACHED_SUCCESS) |
6243 |
{
|
|
833
by Brian Aker
Fix for bad name servers. |
6244 |
memcached_die(mc, rc, "memcached_set", x); |
6245 |
}
|
|
831
by Brian Aker
Test case |
6246 |
}
|
6247 |
||
6248 |
memcached_quit(mc); |
|
6249 |
memcached_free(mc); |
|
833
by Brian Aker
Fix for bad name servers. |
6250 |
|
6251 |
if (rc != MEMCACHED_SUCCESS) |
|
6252 |
{
|
|
6253 |
break; |
|
6254 |
}
|
|
831
by Brian Aker
Test case |
6255 |
}
|
6256 |
||
837
by Brian Aker
Fix for Solaris |
6257 |
return TEST_SUCCESS; |
831
by Brian Aker
Test case |
6258 |
}
|
6259 |
||
800.1.2
by Trond Norbye
Add support for SASL |
6260 |
/*
|
6261 |
* Test that the sasl authentication works. We cannot use the default
|
|
6262 |
* pool of servers, because that would require that all servers we want
|
|
6263 |
* to test supports SASL authentication, and that they use the default
|
|
6264 |
* creds.
|
|
6265 |
*/
|
|
6266 |
static test_return_t sasl_auth_test(memcached_st *memc) |
|
6267 |
{
|
|
800.1.3
by Trond Norbye
Fix build for non-sasl-enabled builds |
6268 |
#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
|
800.1.2
by Trond Norbye
Add support for SASL |
6269 |
memcached_return_t rc; |
6270 |
||
6271 |
rc= memcached_set(memc, "foo", 3, "bar", 3, (time_t)0, (uint32_t)0); |
|
6272 |
test_true(rc == MEMCACHED_SUCCESS); |
|
6273 |
test_true((rc= memcached_delete(memc, "foo", 3, 0)) == MEMCACHED_SUCCESS); |
|
6274 |
test_true((rc= memcached_destroy_sasl_auth_data(memc)) == MEMCACHED_SUCCESS); |
|
6275 |
test_true((rc= memcached_destroy_sasl_auth_data(memc)) == MEMCACHED_FAILURE); |
|
6276 |
test_true((rc= memcached_destroy_sasl_auth_data(NULL)) == MEMCACHED_FAILURE); |
|
6277 |
memcached_quit(memc); |
|
6278 |
||
6279 |
rc= memcached_set_sasl_auth_data(memc, |
|
6280 |
getenv("LIBMEMCACHED_TEST_SASL_USERNAME"), |
|
6281 |
getenv("LIBMEMCACHED_TEST_SASL_SERVER")); |
|
6282 |
test_true(rc == MEMCACHED_SUCCESS); |
|
6283 |
||
6284 |
rc= memcached_set(memc, "foo", 3, "bar", 3, (time_t)0, (uint32_t)0); |
|
6285 |
test_true(rc == MEMCACHED_AUTH_FAILURE); |
|
6286 |
test_true(memcached_destroy_sasl_auth_data(memc) == MEMCACHED_SUCCESS); |
|
6287 |
||
6288 |
memcached_quit(memc); |
|
6289 |
return TEST_SUCCESS; |
|
800.1.3
by Trond Norbye
Fix build for non-sasl-enabled builds |
6290 |
#else
|
6291 |
(void)memc; |
|
6292 |
return TEST_FAILURE; |
|
6293 |
#endif
|
|
800.1.2
by Trond Norbye
Add support for SASL |
6294 |
}
|
622.2.1
by Jean-Charles Redoutey
Fixed mget_execute possibly failing into some non ending recursive call |
6295 |
|
143
by Brian Aker
Refactored out actual test code from test.c |
6296 |
/* Clean the server before beginning testing */
|
6297 |
test_st tests[] ={ |
|
861
by Brian Aker
Fix for version on OSX |
6298 |
{"util_version", 1, (test_callback_fn)util_version_test }, |
632
by Brian Aker
Update for test system. |
6299 |
{"flush", 0, (test_callback_fn)flush_test }, |
6300 |
{"init", 0, (test_callback_fn)init_test }, |
|
6301 |
{"allocation", 0, (test_callback_fn)allocation_test }, |
|
6302 |
{"server_list_null_test", 0, (test_callback_fn)server_list_null_test}, |
|
6303 |
{"server_unsort", 0, (test_callback_fn)server_unsort_test}, |
|
6304 |
{"server_sort", 0, (test_callback_fn)server_sort_test}, |
|
6305 |
{"server_sort2", 0, (test_callback_fn)server_sort2_test}, |
|
792
by Brian Aker
Lots of compiler fixes. |
6306 |
{"memcached_server_remove", 0, (test_callback_fn)memcached_server_remove_test}, |
632
by Brian Aker
Update for test system. |
6307 |
{"clone_test", 0, (test_callback_fn)clone_test }, |
6308 |
{"connection_test", 0, (test_callback_fn)connection_test}, |
|
6309 |
{"callback_test", 0, (test_callback_fn)callback_test}, |
|
6310 |
{"userdata_test", 0, (test_callback_fn)userdata_test}, |
|
6311 |
{"error", 0, (test_callback_fn)error_test }, |
|
6312 |
{"set", 0, (test_callback_fn)set_test }, |
|
6313 |
{"set2", 0, (test_callback_fn)set_test2 }, |
|
6314 |
{"set3", 0, (test_callback_fn)set_test3 }, |
|
6315 |
{"dump", 1, (test_callback_fn)dump_test}, |
|
6316 |
{"add", 1, (test_callback_fn)add_test }, |
|
6317 |
{"replace", 1, (test_callback_fn)replace_test }, |
|
6318 |
{"delete", 1, (test_callback_fn)delete_test }, |
|
6319 |
{"get", 1, (test_callback_fn)get_test }, |
|
6320 |
{"get2", 0, (test_callback_fn)get_test2 }, |
|
6321 |
{"get3", 0, (test_callback_fn)get_test3 }, |
|
6322 |
{"get4", 0, (test_callback_fn)get_test4 }, |
|
6323 |
{"partial mget", 0, (test_callback_fn)get_test5 }, |
|
6324 |
{"stats_servername", 0, (test_callback_fn)stats_servername_test }, |
|
6325 |
{"increment", 0, (test_callback_fn)increment_test }, |
|
6326 |
{"increment_with_initial", 1, (test_callback_fn)increment_with_initial_test }, |
|
6327 |
{"decrement", 0, (test_callback_fn)decrement_test }, |
|
6328 |
{"decrement_with_initial", 1, (test_callback_fn)decrement_with_initial_test }, |
|
6329 |
{"increment_by_key", 0, (test_callback_fn)increment_by_key_test }, |
|
6330 |
{"increment_with_initial_by_key", 1, (test_callback_fn)increment_with_initial_by_key_test }, |
|
6331 |
{"decrement_by_key", 0, (test_callback_fn)decrement_by_key_test }, |
|
6332 |
{"decrement_with_initial_by_key", 1, (test_callback_fn)decrement_with_initial_by_key_test }, |
|
6333 |
{"quit", 0, (test_callback_fn)quit_test }, |
|
6334 |
{"mget", 1, (test_callback_fn)mget_test }, |
|
6335 |
{"mget_result", 1, (test_callback_fn)mget_result_test }, |
|
6336 |
{"mget_result_alloc", 1, (test_callback_fn)mget_result_alloc_test }, |
|
6337 |
{"mget_result_function", 1, (test_callback_fn)mget_result_function }, |
|
6338 |
{"mget_execute", 1, (test_callback_fn)mget_execute }, |
|
6339 |
{"mget_end", 0, (test_callback_fn)mget_end }, |
|
6340 |
{"get_stats", 0, (test_callback_fn)get_stats }, |
|
6341 |
{"add_host_test", 0, (test_callback_fn)add_host_test }, |
|
6342 |
{"add_host_test_1", 0, (test_callback_fn)add_host_test1 }, |
|
6343 |
{"get_stats_keys", 0, (test_callback_fn)get_stats_keys }, |
|
6344 |
{"version_string_test", 0, (test_callback_fn)version_string_test}, |
|
6345 |
{"bad_key", 1, (test_callback_fn)bad_key_test }, |
|
6346 |
{"memcached_server_cursor", 1, (test_callback_fn)memcached_server_cursor_test }, |
|
6347 |
{"read_through", 1, (test_callback_fn)read_through }, |
|
6348 |
{"delete_through", 1, (test_callback_fn)delete_through }, |
|
6349 |
{"noreply", 1, (test_callback_fn)noreply_test}, |
|
6350 |
{"analyzer", 1, (test_callback_fn)analyzer_test}, |
|
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
6351 |
#ifdef HAVE_LIBMEMCACHEDUTIL
|
632
by Brian Aker
Update for test system. |
6352 |
{"connectionpool", 1, (test_callback_fn)connection_pool_test }, |
845
by Brian Aker
Added libmemcached_ping() to memcached utility library. |
6353 |
{"ping", 1, (test_callback_fn)ping_test }, |
504
by Trond Norbye
Added libmemcachedutil containing utility functions |
6354 |
#endif
|
632
by Brian Aker
Update for test system. |
6355 |
{"test_get_last_disconnect", 1, (test_callback_fn)test_get_last_disconnect}, |
818
by Brian Aker
Concurrent memcached_verbosity(). |
6356 |
{"verbosity", 1, (test_callback_fn)test_verbosity}, |
823
by Brian Aker
Improve on algo for disabling bad hosts. |
6357 |
{"test_server_failure", 1, (test_callback_fn)test_server_failure}, |
822
by Brian Aker
Update for last disconnect to stick around even if ejected. |
6358 |
{"cull_servers", 1, (test_callback_fn)test_cull_servers}, |
875
by Brian Aker
Merge in memcached_stat_execute(). |
6359 |
{"memcached_stat_execute", 1, (test_callback_fn)memcached_stat_execute_test}, |
143
by Brian Aker
Refactored out actual test code from test.c |
6360 |
{0, 0, 0} |
6361 |
};
|
|
6362 |
||
651
by Brian Aker
ICC and test fix. |
6363 |
test_st behavior_tests[] ={ |
6364 |
{"behavior_test", 0, (test_callback_fn)behavior_test}, |
|
735
by Brian Aker
Merge Thomason's cork patch. |
6365 |
{"MEMCACHED_BEHAVIOR_CORK", 0, (test_callback_fn)MEMCACHED_BEHAVIOR_CORK_test}, |
821
by Brian Aker
Merge Andre |
6366 |
{"MEMCACHED_BEHAVIOR_TCP_KEEPALIVE", 0, (test_callback_fn)MEMCACHED_BEHAVIOR_TCP_KEEPALIVE_test}, |
6367 |
{"MEMCACHED_BEHAVIOR_TCP_KEEPIDLE", 0, (test_callback_fn)MEMCACHED_BEHAVIOR_TCP_KEEPIDLE_test}, |
|
651
by Brian Aker
ICC and test fix. |
6368 |
{0, 0, 0} |
6369 |
};
|
|
6370 |
||
834
by Brian Aker
Small updates/wins around non-block IO |
6371 |
test_st regression_binary_vs_block[] ={ |
6372 |
{"block add", 1, (test_callback_fn)block_add_regression}, |
|
6373 |
{"binary add", 1, (test_callback_fn)binary_add_regression}, |
|
6374 |
{0, 0, 0} |
|
6375 |
};
|
|
6376 |
||
220
by Brian Aker
New async test. |
6377 |
test_st async_tests[] ={ |
632
by Brian Aker
Update for test system. |
6378 |
{"add", 1, (test_callback_fn)add_wrapper }, |
220
by Brian Aker
New async test. |
6379 |
{0, 0, 0} |
6380 |
};
|
|
6381 |
||
143
by Brian Aker
Refactored out actual test code from test.c |
6382 |
test_st string_tests[] ={ |
632
by Brian Aker
Update for test system. |
6383 |
{"string static with null", 0, (test_callback_fn)string_static_null }, |
6384 |
{"string alloc with null", 0, (test_callback_fn)string_alloc_null }, |
|
6385 |
{"string alloc with 1K", 0, (test_callback_fn)string_alloc_with_size }, |
|
6386 |
{"string alloc with malloc failure", 0, (test_callback_fn)string_alloc_with_size_toobig }, |
|
6387 |
{"string append", 0, (test_callback_fn)string_alloc_append }, |
|
6388 |
{"string append failure (too big)", 0, (test_callback_fn)string_alloc_append_toobig }, |
|
6389 |
{0, 0, (test_callback_fn)0} |
|
143
by Brian Aker
Refactored out actual test code from test.c |
6390 |
};
|
6391 |
||
6392 |
test_st result_tests[] ={ |
|
632
by Brian Aker
Update for test system. |
6393 |
{"result static", 0, (test_callback_fn)result_static}, |
6394 |
{"result alloc", 0, (test_callback_fn)result_alloc}, |
|
6395 |
{0, 0, (test_callback_fn)0} |
|
143
by Brian Aker
Refactored out actual test code from test.c |
6396 |
};
|
6397 |
||
162
by Brian Aker
More tests, and new code for append/prepend. |
6398 |
test_st version_1_2_3[] ={ |
632
by Brian Aker
Update for test system. |
6399 |
{"append", 0, (test_callback_fn)append_test }, |
6400 |
{"prepend", 0, (test_callback_fn)prepend_test }, |
|
6401 |
{"cas", 0, (test_callback_fn)cas_test }, |
|
6402 |
{"cas2", 0, (test_callback_fn)cas2_test }, |
|
6403 |
{"append_binary", 0, (test_callback_fn)append_binary_test }, |
|
6404 |
{0, 0, (test_callback_fn)0} |
|
162
by Brian Aker
More tests, and new code for append/prepend. |
6405 |
};
|
6406 |
||
143
by Brian Aker
Refactored out actual test code from test.c |
6407 |
test_st user_tests[] ={ |
632
by Brian Aker
Update for test system. |
6408 |
{"user_supplied_bug1", 0, (test_callback_fn)user_supplied_bug1 }, |
6409 |
{"user_supplied_bug2", 0, (test_callback_fn)user_supplied_bug2 }, |
|
6410 |
{"user_supplied_bug3", 0, (test_callback_fn)user_supplied_bug3 }, |
|
6411 |
{"user_supplied_bug4", 0, (test_callback_fn)user_supplied_bug4 }, |
|
6412 |
{"user_supplied_bug5", 1, (test_callback_fn)user_supplied_bug5 }, |
|
6413 |
{"user_supplied_bug6", 1, (test_callback_fn)user_supplied_bug6 }, |
|
6414 |
{"user_supplied_bug7", 1, (test_callback_fn)user_supplied_bug7 }, |
|
6415 |
{"user_supplied_bug8", 1, (test_callback_fn)user_supplied_bug8 }, |
|
6416 |
{"user_supplied_bug9", 1, (test_callback_fn)user_supplied_bug9 }, |
|
6417 |
{"user_supplied_bug10", 1, (test_callback_fn)user_supplied_bug10 }, |
|
6418 |
{"user_supplied_bug11", 1, (test_callback_fn)user_supplied_bug11 }, |
|
6419 |
{"user_supplied_bug12", 1, (test_callback_fn)user_supplied_bug12 }, |
|
6420 |
{"user_supplied_bug13", 1, (test_callback_fn)user_supplied_bug13 }, |
|
6421 |
{"user_supplied_bug14", 1, (test_callback_fn)user_supplied_bug14 }, |
|
6422 |
{"user_supplied_bug15", 1, (test_callback_fn)user_supplied_bug15 }, |
|
6423 |
{"user_supplied_bug16", 1, (test_callback_fn)user_supplied_bug16 }, |
|
883.1.2
by Piotr Sikora
Skip "user_supplied_bug17" (Chinese key) becasue OpenBSD's iscntrl() doesn't support multi-byte characters. |
6424 |
#if !defined(__sun) && !defined(__OpenBSD__)
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
6425 |
/*
|
6426 |
** It seems to be something weird with the character sets..
|
|
418.1.1
by Trond Norbye
Disable user_supplied_bug17 on Solaris |
6427 |
** value_fetch is unable to parse the value line (iscntrl "fails"), so I
|
6428 |
** guess I need to find out how this is supposed to work.. Perhaps I need
|
|
6429 |
** to run the test in a specific locale (I tried zh_CN.UTF-8 without success,
|
|
6430 |
** so just disable the code for now...).
|
|
6431 |
*/
|
|
632
by Brian Aker
Update for test system. |
6432 |
{"user_supplied_bug17", 1, (test_callback_fn)user_supplied_bug17 }, |
418.1.1
by Trond Norbye
Disable user_supplied_bug17 on Solaris |
6433 |
#endif
|
632
by Brian Aker
Update for test system. |
6434 |
{"user_supplied_bug18", 1, (test_callback_fn)user_supplied_bug18 }, |
6435 |
{"user_supplied_bug19", 1, (test_callback_fn)user_supplied_bug19 }, |
|
6436 |
{"user_supplied_bug20", 1, (test_callback_fn)user_supplied_bug20 }, |
|
6437 |
{"user_supplied_bug21", 1, (test_callback_fn)user_supplied_bug21 }, |
|
6438 |
{"wrong_failure_counter_test", 1, (test_callback_fn)wrong_failure_counter_test}, |
|
916
by Brian Aker
Merge in test case from JC Redoutey . |
6439 |
{"wrong_failure_counter_two_test", 1, (test_callback_fn)wrong_failure_counter_two_test}, |
632
by Brian Aker
Update for test system. |
6440 |
{0, 0, (test_callback_fn)0} |
143
by Brian Aker
Refactored out actual test code from test.c |
6441 |
};
|
6442 |
||
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
6443 |
test_st replication_tests[]= { |
632
by Brian Aker
Update for test system. |
6444 |
{"set", 1, (test_callback_fn)replication_set_test }, |
6445 |
{"get", 0, (test_callback_fn)replication_get_test }, |
|
6446 |
{"mget", 0, (test_callback_fn)replication_mget_test }, |
|
6447 |
{"delete", 0, (test_callback_fn)replication_delete_test }, |
|
6448 |
{"rand_mget", 0, (test_callback_fn)replication_randomize_mget_test }, |
|
6449 |
{0, 0, (test_callback_fn)0} |
|
535.4.1
by Trond Norbye
Added support for storing replicas on multiple servers |
6450 |
};
|
6451 |
||
580.1.2
by Trond Norbye
Bug #434484: Binary protocol maps NOT_STORED to wrong error code |
6452 |
/*
|
6453 |
* The following test suite is used to verify that we don't introduce
|
|
6454 |
* regression bugs. If you want more information about the bug / test,
|
|
590.1.4
by Trond Norbye
Strip trailing whitespaces |
6455 |
* you should look in the bug report at
|
580.1.2
by Trond Norbye
Bug #434484: Binary protocol maps NOT_STORED to wrong error code |
6456 |
* http://bugs.launchpad.net/libmemcached
|
6457 |
*/
|
|
6458 |
test_st regression_tests[]= { |
|
632
by Brian Aker
Update for test system. |
6459 |
{"lp:434484", 1, (test_callback_fn)regression_bug_434484 }, |
6460 |
{"lp:434843", 1, (test_callback_fn)regression_bug_434843 }, |
|
833
by Brian Aker
Fix for bad name servers. |
6461 |
{"lp:434843-buffered", 1, (test_callback_fn)regression_bug_434843_buffered }, |
632
by Brian Aker
Update for test system. |
6462 |
{"lp:421108", 1, (test_callback_fn)regression_bug_421108 }, |
6463 |
{"lp:442914", 1, (test_callback_fn)regression_bug_442914 }, |
|
6464 |
{"lp:447342", 1, (test_callback_fn)regression_bug_447342 }, |
|
6465 |
{"lp:463297", 1, (test_callback_fn)regression_bug_463297 }, |
|
715
by Brian Aker
Fix for bug #15450 |
6466 |
{"lp:490486", 1, (test_callback_fn)regression_bug_490486 }, |
841
by Brian Aker
Fix (though only partial), for connect timeout. |
6467 |
{"lp:583031", 1, (test_callback_fn)regression_bug_583031 }, |
831
by Brian Aker
Test case |
6468 |
{"lp:?", 1, (test_callback_fn)regression_bug_ }, |
922
by Brian Aker
Fix for memory leak when parsing servers. |
6469 |
{"lp:728286", 1, (test_callback_fn)regression_bug_728286 }, |
926
by Brian Aker
Merge in solution for lp:581030. |
6470 |
{"lp:581030", 1, (test_callback_fn)regression_bug_581030 }, |
632
by Brian Aker
Update for test system. |
6471 |
{0, 0, (test_callback_fn)0} |
580.1.2
by Trond Norbye
Bug #434484: Binary protocol maps NOT_STORED to wrong error code |
6472 |
};
|
6473 |
||
800.1.2
by Trond Norbye
Add support for SASL |
6474 |
test_st sasl_auth_tests[]= { |
6475 |
{"sasl_auth", 1, (test_callback_fn)sasl_auth_test }, |
|
6476 |
{0, 0, (test_callback_fn)0} |
|
6477 |
};
|
|
6478 |
||
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
6479 |
test_st ketama_compatibility[]= { |
632
by Brian Aker
Update for test system. |
6480 |
{"libmemcached", 1, (test_callback_fn)ketama_compatibility_libmemcached }, |
6481 |
{"spymemcached", 1, (test_callback_fn)ketama_compatibility_spymemcached }, |
|
6482 |
{0, 0, (test_callback_fn)0} |
|
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
6483 |
};
|
6484 |
||
145.1.2
by brian@gir.tangent.org
More tests. |
6485 |
test_st generate_tests[] ={ |
632
by Brian Aker
Update for test system. |
6486 |
{"generate_pairs", 1, (test_callback_fn)generate_pairs }, |
6487 |
{"generate_data", 1, (test_callback_fn)generate_data }, |
|
6488 |
{"get_read", 0, (test_callback_fn)get_read }, |
|
6489 |
{"delete_generate", 0, (test_callback_fn)delete_generate }, |
|
6490 |
{"generate_buffer_data", 1, (test_callback_fn)generate_buffer_data }, |
|
6491 |
{"delete_buffer", 0, (test_callback_fn)delete_buffer_generate}, |
|
6492 |
{"generate_data", 1, (test_callback_fn)generate_data }, |
|
6493 |
{"mget_read", 0, (test_callback_fn)mget_read }, |
|
6494 |
{"mget_read_result", 0, (test_callback_fn)mget_read_result }, |
|
6495 |
{"mget_read_function", 0, (test_callback_fn)mget_read_function }, |
|
6496 |
{"cleanup", 1, (test_callback_fn)cleanup_pairs }, |
|
6497 |
{"generate_large_pairs", 1, (test_callback_fn)generate_large_pairs }, |
|
6498 |
{"generate_data", 1, (test_callback_fn)generate_data }, |
|
6499 |
{"generate_buffer_data", 1, (test_callback_fn)generate_buffer_data }, |
|
6500 |
{"cleanup", 1, (test_callback_fn)cleanup_pairs }, |
|
6501 |
{0, 0, (test_callback_fn)0} |
|
145.1.2
by brian@gir.tangent.org
More tests. |
6502 |
};
|
6503 |
||
317.1.68
by brian@localhost.localdomain
More tests for consistent. |
6504 |
test_st consistent_tests[] ={ |
632
by Brian Aker
Update for test system. |
6505 |
{"generate_pairs", 1, (test_callback_fn)generate_pairs }, |
6506 |
{"generate_data", 1, (test_callback_fn)generate_data }, |
|
6507 |
{"get_read", 0, (test_callback_fn)get_read_count }, |
|
6508 |
{"cleanup", 1, (test_callback_fn)cleanup_pairs }, |
|
6509 |
{0, 0, (test_callback_fn)0} |
|
317.1.68
by brian@localhost.localdomain
More tests for consistent. |
6510 |
};
|
143
by Brian Aker
Refactored out actual test code from test.c |
6511 |
|
351
by brian@localhost.localdomain
Pushing weighted ketama code. |
6512 |
test_st consistent_weighted_tests[] ={ |
632
by Brian Aker
Update for test system. |
6513 |
{"generate_pairs", 1, (test_callback_fn)generate_pairs }, |
6514 |
{"generate_data", 1, (test_callback_fn)generate_data_with_stats }, |
|
6515 |
{"get_read", 0, (test_callback_fn)get_read_count }, |
|
6516 |
{"cleanup", 1, (test_callback_fn)cleanup_pairs }, |
|
6517 |
{0, 0, (test_callback_fn)0} |
|
351
by brian@localhost.localdomain
Pushing weighted ketama code. |
6518 |
};
|
6519 |
||
495
by Eric Lambert
Disable hsieh algorithm by default |
6520 |
test_st hsieh_availability[] ={ |
632
by Brian Aker
Update for test system. |
6521 |
{"hsieh_avaibility_test", 0, (test_callback_fn)hsieh_avaibility_test}, |
6522 |
{0, 0, (test_callback_fn)0} |
|
6523 |
};
|
|
6524 |
||
910
by Brian Aker
Merge in bug fix for 677609 |
6525 |
test_st murmur_availability[] ={ |
6526 |
{"murmur_avaibility_test", 0, (test_callback_fn)murmur_avaibility_test}, |
|
6527 |
{0, 0, (test_callback_fn)0} |
|
6528 |
};
|
|
6529 |
||
632
by Brian Aker
Update for test system. |
6530 |
#if 0
|
6531 |
test_st hash_sanity[] ={
|
|
6532 |
{"hash sanity", 0, (test_callback_fn)hash_sanity_test},
|
|
6533 |
{0, 0, (test_callback_fn)0}
|
|
6534 |
};
|
|
6535 |
#endif
|
|
495
by Eric Lambert
Disable hsieh algorithm by default |
6536 |
|
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
6537 |
test_st ketama_auto_eject_hosts[] ={ |
632
by Brian Aker
Update for test system. |
6538 |
{"auto_eject_hosts", 1, (test_callback_fn)auto_eject_hosts }, |
6539 |
{"output_ketama_weighted_keys", 1, (test_callback_fn)output_ketama_weighted_keys }, |
|
6540 |
{0, 0, (test_callback_fn)0} |
|
497
by Robey Pointer
Add support for AUTO_EJECT_HOST |
6541 |
};
|
6542 |
||
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
6543 |
test_st hash_tests[] ={ |
758
by Brian Aker
Updates to libhashkit. |
6544 |
{"one_at_a_time_run", 0, (test_callback_fn)one_at_a_time_run }, |
632
by Brian Aker
Update for test system. |
6545 |
{"md5", 0, (test_callback_fn)md5_run }, |
6546 |
{"crc", 0, (test_callback_fn)crc_run }, |
|
6547 |
{"fnv1_64", 0, (test_callback_fn)fnv1_64_run }, |
|
6548 |
{"fnv1a_64", 0, (test_callback_fn)fnv1a_64_run }, |
|
6549 |
{"fnv1_32", 0, (test_callback_fn)fnv1_32_run }, |
|
6550 |
{"fnv1a_32", 0, (test_callback_fn)fnv1a_32_run }, |
|
6551 |
{"hsieh", 0, (test_callback_fn)hsieh_run }, |
|
6552 |
{"murmur", 0, (test_callback_fn)murmur_run }, |
|
6553 |
{"jenkis", 0, (test_callback_fn)jenkins_run }, |
|
776
by Brian Aker
Adding test, showing off how to add a custom function to libmemcached. |
6554 |
{"memcached_get_hashkit", 0, (test_callback_fn)memcached_get_hashkit_test }, |
632
by Brian Aker
Update for test system. |
6555 |
{0, 0, (test_callback_fn)0} |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
6556 |
};
|
6557 |
||
839
by Brian Aker
Look for regressions in error messages. |
6558 |
test_st error_conditions[] ={ |
859
by Brian Aker
Fix for interface issues (Bug 571909 <571909@bugs.launchpad.net>) |
6559 |
{"memcached_get_MEMCACHED_ERRNO", 0, (test_callback_fn)memcached_get_MEMCACHED_ERRNO }, |
839
by Brian Aker
Look for regressions in error messages. |
6560 |
{"memcached_get_MEMCACHED_NOTFOUND", 0, (test_callback_fn)memcached_get_MEMCACHED_NOTFOUND }, |
859
by Brian Aker
Fix for interface issues (Bug 571909 <571909@bugs.launchpad.net>) |
6561 |
{"memcached_get_by_key_MEMCACHED_ERRNO", 0, (test_callback_fn)memcached_get_by_key_MEMCACHED_ERRNO }, |
840
by Brian Aker
Additional tests. |
6562 |
{"memcached_get_by_key_MEMCACHED_NOTFOUND", 0, (test_callback_fn)memcached_get_by_key_MEMCACHED_NOTFOUND }, |
839
by Brian Aker
Look for regressions in error messages. |
6563 |
{0, 0, (test_callback_fn)0} |
6564 |
};
|
|
6565 |
||
143
by Brian Aker
Refactored out actual test code from test.c |
6566 |
collection_st collection[] ={ |
632
by Brian Aker
Update for test system. |
6567 |
#if 0
|
6568 |
{"hash_sanity", 0, 0, hash_sanity},
|
|
6569 |
#endif
|
|
6570 |
{"hsieh_availability", 0, 0, hsieh_availability}, |
|
910
by Brian Aker
Merge in bug fix for 677609 |
6571 |
{"murmur_availability", 0, 0, murmur_availability}, |
143
by Brian Aker
Refactored out actual test code from test.c |
6572 |
{"block", 0, 0, tests}, |
632
by Brian Aker
Update for test system. |
6573 |
{"binary", (test_callback_fn)pre_binary, 0, tests}, |
6574 |
{"nonblock", (test_callback_fn)pre_nonblock, 0, tests}, |
|
6575 |
{"nodelay", (test_callback_fn)pre_nodelay, 0, tests}, |
|
6576 |
{"settimer", (test_callback_fn)pre_settimer, 0, tests}, |
|
6577 |
{"md5", (test_callback_fn)pre_md5, 0, tests}, |
|
6578 |
{"crc", (test_callback_fn)pre_crc, 0, tests}, |
|
6579 |
{"hsieh", (test_callback_fn)pre_hsieh, 0, tests}, |
|
6580 |
{"jenkins", (test_callback_fn)pre_jenkins, 0, tests}, |
|
6581 |
{"fnv1_64", (test_callback_fn)pre_hash_fnv1_64, 0, tests}, |
|
6582 |
{"fnv1a_64", (test_callback_fn)pre_hash_fnv1a_64, 0, tests}, |
|
6583 |
{"fnv1_32", (test_callback_fn)pre_hash_fnv1_32, 0, tests}, |
|
6584 |
{"fnv1a_32", (test_callback_fn)pre_hash_fnv1a_32, 0, tests}, |
|
6585 |
{"ketama", (test_callback_fn)pre_behavior_ketama, 0, tests}, |
|
6586 |
{"ketama_auto_eject_hosts", (test_callback_fn)pre_behavior_ketama, 0, ketama_auto_eject_hosts}, |
|
6587 |
{"unix_socket", (test_callback_fn)pre_unix_socket, 0, tests}, |
|
6588 |
{"unix_socket_nodelay", (test_callback_fn)pre_nodelay, 0, tests}, |
|
6589 |
{"poll_timeout", (test_callback_fn)poll_timeout, 0, tests}, |
|
6590 |
{"gets", (test_callback_fn)enable_cas, 0, tests}, |
|
642
by Brian Aker
Adding in a consistent test for crc. |
6591 |
{"consistent_crc", (test_callback_fn)enable_consistent_crc, 0, tests}, |
6592 |
{"consistent_hsieh", (test_callback_fn)enable_consistent_hsieh, 0, tests}, |
|
539.1.1
by Trond Norbye
Deprecate the old callback interface to set the memory allocators |
6593 |
#ifdef MEMCACHED_ENABLE_DEPRECATED
|
632
by Brian Aker
Update for test system. |
6594 |
{"deprecated_memory_allocators", (test_callback_fn)deprecated_set_memory_alloc, 0, tests}, |
539.1.1
by Trond Norbye
Deprecate the old callback interface to set the memory allocators |
6595 |
#endif
|
632
by Brian Aker
Update for test system. |
6596 |
{"memory_allocators", (test_callback_fn)set_memory_alloc, 0, tests}, |
6597 |
{"prefix", (test_callback_fn)set_prefix, 0, tests}, |
|
800.1.2
by Trond Norbye
Add support for SASL |
6598 |
{"sasl_auth", (test_callback_fn)pre_sasl, 0, sasl_auth_tests }, |
6599 |
{"sasl", (test_callback_fn)pre_sasl, 0, tests }, |
|
632
by Brian Aker
Update for test system. |
6600 |
{"version_1_2_3", (test_callback_fn)check_for_1_2_3, 0, version_1_2_3}, |
143
by Brian Aker
Refactored out actual test code from test.c |
6601 |
{"string", 0, 0, string_tests}, |
6602 |
{"result", 0, 0, result_tests}, |
|
632
by Brian Aker
Update for test system. |
6603 |
{"async", (test_callback_fn)pre_nonblock, 0, async_tests}, |
6604 |
{"async_binary", (test_callback_fn)pre_nonblock_binary, 0, async_tests}, |
|
143
by Brian Aker
Refactored out actual test code from test.c |
6605 |
{"user", 0, 0, user_tests}, |
145.1.2
by brian@gir.tangent.org
More tests. |
6606 |
{"generate", 0, 0, generate_tests}, |
632
by Brian Aker
Update for test system. |
6607 |
{"generate_hsieh", (test_callback_fn)pre_hsieh, 0, generate_tests}, |
6608 |
{"generate_ketama", (test_callback_fn)pre_behavior_ketama, 0, generate_tests}, |
|
642
by Brian Aker
Adding in a consistent test for crc. |
6609 |
{"generate_hsieh_consistent", (test_callback_fn)enable_consistent_hsieh, 0, generate_tests}, |
632
by Brian Aker
Update for test system. |
6610 |
{"generate_md5", (test_callback_fn)pre_md5, 0, generate_tests}, |
6611 |
{"generate_murmur", (test_callback_fn)pre_murmur, 0, generate_tests}, |
|
6612 |
{"generate_jenkins", (test_callback_fn)pre_jenkins, 0, generate_tests}, |
|
6613 |
{"generate_nonblock", (test_callback_fn)pre_nonblock, 0, generate_tests}, |
|
736
by Brian Aker
Updates for CORK. |
6614 |
// Too slow
|
735
by Brian Aker
Merge Thomason's cork patch. |
6615 |
{"generate_corked", (test_callback_fn)pre_cork, 0, generate_tests}, |
6616 |
{"generate_corked_and_nonblock", (test_callback_fn)pre_cork_and_nonblock, 0, generate_tests}, |
|
317.1.68
by brian@localhost.localdomain
More tests for consistent. |
6617 |
{"consistent_not", 0, 0, consistent_tests}, |
632
by Brian Aker
Update for test system. |
6618 |
{"consistent_ketama", (test_callback_fn)pre_behavior_ketama, 0, consistent_tests}, |
6619 |
{"consistent_ketama_weighted", (test_callback_fn)pre_behavior_ketama_weighted, 0, consistent_weighted_tests}, |
|
612.1.2
by Trond Norbye
Added MEMCACHED_BEHAVIOR_KETAMA_COMPAT_MODE |
6620 |
{"ketama_compat", 0, 0, ketama_compatibility}, |
533
by Brian Aker
Added memcached_generate_hash() and more tests! :) |
6621 |
{"test_hashes", 0, 0, hash_tests}, |
632
by Brian Aker
Update for test system. |
6622 |
{"replication", (test_callback_fn)pre_replication, 0, replication_tests}, |
6623 |
{"replication_noblock", (test_callback_fn)pre_replication_noblock, 0, replication_tests}, |
|
580.1.2
by Trond Norbye
Bug #434484: Binary protocol maps NOT_STORED to wrong error code |
6624 |
{"regression", 0, 0, regression_tests}, |
651
by Brian Aker
ICC and test fix. |
6625 |
{"behaviors", 0, 0, behavior_tests}, |
834
by Brian Aker
Small updates/wins around non-block IO |
6626 |
{"regression_binary_vs_block", (test_callback_fn)key_setup, (test_callback_fn)key_teardown, regression_binary_vs_block}, |
839
by Brian Aker
Look for regressions in error messages. |
6627 |
{"error_conditions", 0, 0, error_conditions}, |
143
by Brian Aker
Refactored out actual test code from test.c |
6628 |
{0, 0, 0, 0} |
6629 |
};
|
|
6630 |
||
292
by Brian Aker
Refactored tests. |
6631 |
#define SERVERS_TO_CREATE 5
|
6632 |
||
632
by Brian Aker
Update for test system. |
6633 |
#include "libmemcached_world.h" |
292
by Brian Aker
Refactored tests. |
6634 |
|
6635 |
void get_world(world_st *world) |
|
6636 |
{
|
|
6637 |
world->collections= collection; |
|
701
by Brian Aker
Absorb test bits into anonymous structure. |
6638 |
|
632
by Brian Aker
Update for test system. |
6639 |
world->create= (test_callback_create_fn)world_create; |
6640 |
world->destroy= (test_callback_fn)world_destroy; |
|
701
by Brian Aker
Absorb test bits into anonymous structure. |
6641 |
|
6642 |
world->test.startup= (test_callback_fn)world_test_startup; |
|
6643 |
world->test.flush= (test_callback_fn)world_flush; |
|
6644 |
world->test.pre_run= (test_callback_fn)world_pre_run; |
|
6645 |
world->test.post_run= (test_callback_fn)world_post_run; |
|
6646 |
world->test.on_error= (test_callback_error_fn)world_on_error; |
|
6647 |
||
703
by Brian Aker
Updated test framework. |
6648 |
world->collection.startup= (test_callback_fn)world_container_startup; |
6649 |
world->collection.shutdown= (test_callback_fn)world_container_shutdown; |
|
6650 |
||
632
by Brian Aker
Update for test system. |
6651 |
world->runner= &defualt_libmemcached_runner; |
143
by Brian Aker
Refactored out actual test code from test.c |
6652 |
}
|