2 Sample test application.
10 #include <sys/types.h>
14 #include "../lib/common.h"
15 #include "../src/generator.h"
16 #include "../src/execute.h"
20 #define GLOBAL_COUNT 100000
21 static pairs_st
*global_pairs
;
22 static char *global_keys
[GLOBAL_COUNT
];
23 static size_t global_keys_length
[GLOBAL_COUNT
];
25 uint8_t init_test(memcached_st
*not_used
)
29 (void)memcached_create(&memc
);
30 memcached_free(&memc
);
35 uint8_t allocation_test(memcached_st
*not_used
)
38 memc
= memcached_create(NULL
);
45 uint8_t clone_test(memcached_st
*memc
)
50 clone
= memcached_clone(NULL
, NULL
);
52 memcached_free(clone
);
55 /* Can we init from null? */
58 clone
= memcached_clone(NULL
, memc
);
60 memcached_free(clone
);
63 /* Can we init from struct? */
65 memcached_st declared_clone
;
67 clone
= memcached_clone(&declared_clone
, NULL
);
69 memcached_free(clone
);
72 /* Can we init from struct? */
74 memcached_st declared_clone
;
76 clone
= memcached_clone(&declared_clone
, memc
);
78 memcached_free(clone
);
84 uint8_t connection_test(memcached_st
*memc
)
88 rc
= memcached_server_add(memc
, "localhost", 0);
89 assert(rc
== MEMCACHED_SUCCESS
);
94 uint8_t error_test(memcached_st
*memc
)
98 for (rc
= MEMCACHED_SUCCESS
; rc
< MEMCACHED_MAXIMUM_RETURN
; rc
++)
100 printf("Error %d -> %s\n", rc
, memcached_strerror(memc
, rc
));
106 uint8_t set_test(memcached_st
*memc
)
110 char *value
= "when we sanitize";
112 rc
= memcached_set(memc
, key
, strlen(key
),
113 value
, strlen(value
),
114 (time_t)0, (uint16_t)0);
115 assert(rc
== MEMCACHED_SUCCESS
);
120 uint8_t append_test(memcached_st
*memc
)
128 rc
= memcached_flush(memc
, 0);
129 assert(rc
== MEMCACHED_SUCCESS
);
131 rc
= memcached_set(memc
, key
, strlen(key
),
132 value
, strlen(value
),
133 (time_t)0, (uint16_t)0);
134 assert(rc
== MEMCACHED_SUCCESS
);
136 rc
= memcached_append(memc
, key
, strlen(key
),
137 " the", strlen(" the"),
138 (time_t)0, (uint16_t)0);
139 assert(rc
== MEMCACHED_SUCCESS
);
141 rc
= memcached_append(memc
, key
, strlen(key
),
142 " people", strlen(" people"),
143 (time_t)0, (uint16_t)0);
144 assert(rc
== MEMCACHED_SUCCESS
);
146 value
= memcached_get(memc
, key
, strlen(key
),
147 &value_length
, &flags
, &rc
);
148 assert(!memcmp(value
, "we the people", strlen("we the people")));
149 assert(strlen("we the people") == value_length
);
150 assert(rc
== MEMCACHED_SUCCESS
);
156 uint8_t append_binary_test(memcached_st
*memc
)
159 char *key
= "numbers";
160 unsigned int *store_ptr
;
161 unsigned int store_list
[] = { 23, 56, 499, 98, 32847, 0 };
167 rc
= memcached_flush(memc
, 0);
168 assert(rc
== MEMCACHED_SUCCESS
);
170 rc
= memcached_set(memc
,
173 (time_t)0, (uint16_t)0);
174 assert(rc
== MEMCACHED_SUCCESS
);
176 for (x
= 0; store_list
[x
] ; x
++)
178 rc
= memcached_append(memc
,
180 (char *)&store_list
[x
], sizeof(unsigned int),
181 (time_t)0, (uint16_t)0);
182 assert(rc
== MEMCACHED_SUCCESS
);
185 value
= memcached_get(memc
, key
, strlen(key
),
186 &value_length
, &flags
, &rc
);
187 assert((value_length
== (sizeof(unsigned int) * x
)));
188 assert(rc
== MEMCACHED_SUCCESS
);
190 store_ptr
= (unsigned int *)value
;
192 while ((size_t)store_ptr
< (size_t)(value
+ value_length
))
194 assert(*store_ptr
== store_list
[x
++]);
202 uint8_t cas2_test(memcached_st
*memc
)
205 char *keys
[]= {"fudge", "son", "food"};
206 size_t key_length
[]= {5, 3, 4};
207 char *value
= "we the people";
208 size_t value_length
= strlen("we the people");
210 memcached_result_st results_obj
;
211 memcached_result_st
*results
;
214 rc
= memcached_flush(memc
, 0);
215 assert(rc
== MEMCACHED_SUCCESS
);
217 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_SUPPORT_CAS
, &set
);
219 for (x
= 0; x
< 3; x
++)
221 rc
= memcached_set(memc
, keys
[x
], key_length
[x
],
222 keys
[x
], key_length
[x
],
223 (time_t)50, (uint16_t)9);
224 assert(rc
== MEMCACHED_SUCCESS
);
227 rc
= memcached_mget(memc
, keys
, key_length
, 3);
229 results
= memcached_result_create(memc
, &results_obj
);
231 results
= memcached_fetch_result(memc
, &results_obj
, &rc
);
233 assert(results
->cas
);
234 assert(rc
== MEMCACHED_SUCCESS
);
235 WATCHPOINT_ASSERT(memcached_result_cas(results
));
237 assert(!memcmp(value
, "we the people", strlen("we the people")));
238 assert(strlen("we the people") == value_length
);
239 assert(rc
== MEMCACHED_SUCCESS
);
241 memcached_result_free(&results_obj
);
246 uint8_t cas_test(memcached_st
*memc
)
250 size_t key_length
= strlen("fun");
251 char *value
= "we the people";
252 size_t value_length
= strlen("we the people");
253 memcached_result_st results_obj
;
254 memcached_result_st
*results
;
257 rc
= memcached_flush(memc
, 0);
258 assert(rc
== MEMCACHED_SUCCESS
);
260 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_SUPPORT_CAS
, &set
);
262 rc
= memcached_set(memc
, key
, strlen(key
),
263 value
, strlen(value
),
264 (time_t)0, (uint16_t)0);
265 assert(rc
== MEMCACHED_SUCCESS
);
267 rc
= memcached_mget(memc
, &key
, &key_length
, 1);
269 results
= memcached_result_create(memc
, &results_obj
);
271 results
= memcached_fetch_result(memc
, &results_obj
, &rc
);
273 assert(rc
== MEMCACHED_SUCCESS
);
274 WATCHPOINT_ASSERT(memcached_result_cas(results
));
276 assert(!memcmp(value
, "we the people", strlen("we the people")));
277 assert(strlen("we the people") == value_length
);
278 assert(rc
== MEMCACHED_SUCCESS
);
280 memcached_result_free(&results_obj
);
285 uint8_t prepend_test(memcached_st
*memc
)
289 char *value
= "people";
293 rc
= memcached_flush(memc
, 0);
294 assert(rc
== MEMCACHED_SUCCESS
);
296 rc
= memcached_set(memc
, key
, strlen(key
),
297 value
, strlen(value
),
298 (time_t)0, (uint16_t)0);
299 assert(rc
== MEMCACHED_SUCCESS
);
301 rc
= memcached_prepend(memc
, key
, strlen(key
),
302 "the ", strlen("the "),
303 (time_t)0, (uint16_t)0);
304 assert(rc
== MEMCACHED_SUCCESS
);
306 rc
= memcached_prepend(memc
, key
, strlen(key
),
307 "we ", strlen("we "),
308 (time_t)0, (uint16_t)0);
309 assert(rc
== MEMCACHED_SUCCESS
);
311 value
= memcached_get(memc
, key
, strlen(key
),
312 &value_length
, &flags
, &rc
);
313 assert(!memcmp(value
, "we the people", strlen("we the people")));
314 assert(strlen("we the people") == value_length
);
315 assert(rc
== MEMCACHED_SUCCESS
);
321 uint8_t add_test(memcached_st
*memc
)
325 char *value
= "when we sanitize";
327 rc
= memcached_add(memc
, key
, strlen(key
),
328 value
, strlen(value
),
329 (time_t)0, (uint16_t)0);
330 assert(rc
== MEMCACHED_NOTSTORED
);
335 uint8_t replace_test(memcached_st
*memc
)
339 char *value
= "when we sanitize";
341 rc
= memcached_replace(memc
, key
, strlen(key
),
342 value
, strlen(value
),
343 (time_t)0, (uint16_t)0);
344 assert(rc
== MEMCACHED_SUCCESS
);
349 uint8_t delete_test(memcached_st
*memc
)
353 char *value
= "when we sanitize";
355 rc
= memcached_set(memc
, key
, strlen(key
),
356 value
, strlen(value
),
357 (time_t)0, (uint16_t)0);
358 assert(rc
== MEMCACHED_SUCCESS
);
360 rc
= memcached_delete(memc
, key
, strlen(key
), (time_t)0);
361 assert(rc
== MEMCACHED_SUCCESS
);
366 uint8_t flush_test(memcached_st
*memc
)
370 rc
= memcached_flush(memc
, 0);
371 assert(rc
== MEMCACHED_SUCCESS
);
376 uint8_t get_test(memcached_st
*memc
)
381 size_t string_length
;
384 rc
= memcached_delete(memc
, key
, strlen(key
), (time_t)0);
385 assert(rc
== MEMCACHED_SUCCESS
|| rc
== MEMCACHED_NOTFOUND
);
387 string
= memcached_get(memc
, key
, strlen(key
),
388 &string_length
, &flags
, &rc
);
390 assert(rc
== MEMCACHED_NOTFOUND
);
391 assert(string_length
== 0);
397 uint8_t get_test2(memcached_st
*memc
)
401 char *value
= "when we sanitize";
403 size_t string_length
;
406 rc
= memcached_set(memc
, key
, strlen(key
),
407 value
, strlen(value
),
408 (time_t)0, (uint16_t)0);
409 assert(rc
== MEMCACHED_SUCCESS
);
411 string
= memcached_get(memc
, key
, strlen(key
),
412 &string_length
, &flags
, &rc
);
415 assert(rc
== MEMCACHED_SUCCESS
);
416 assert(string_length
== strlen(value
));
417 assert(!memcmp(string
, value
, string_length
));
424 uint8_t set_test2(memcached_st
*memc
)
428 char *value
= "train in the brain";
429 size_t value_length
= strlen(value
);
432 for (x
= 0; x
< 10; x
++)
434 rc
= memcached_set(memc
, key
, strlen(key
),
436 (time_t)0, (uint16_t)0);
437 assert(rc
== MEMCACHED_SUCCESS
);
443 uint8_t set_test3(memcached_st
*memc
)
448 size_t value_length
= 8191;
451 value
= (char*)malloc(value_length
);
454 for (x
= 0; x
< value_length
; x
++)
455 value
[x
] = (char) (x
% 127);
457 for (x
= 0; x
< 1; x
++)
459 rc
= memcached_set(memc
, key
, strlen(key
),
461 (time_t)0, (uint16_t)0);
462 assert(rc
== MEMCACHED_SUCCESS
);
470 uint8_t get_test3(memcached_st
*memc
)
475 size_t value_length
= 8191;
477 size_t string_length
;
481 value
= (char*)malloc(value_length
);
484 for (x
= 0; x
< value_length
; x
++)
485 value
[x
] = (char) (x
% 127);
487 rc
= memcached_set(memc
, key
, strlen(key
),
489 (time_t)0, (uint16_t)0);
490 assert(rc
== MEMCACHED_SUCCESS
);
492 string
= memcached_get(memc
, key
, strlen(key
),
493 &string_length
, &flags
, &rc
);
495 assert(rc
== MEMCACHED_SUCCESS
);
497 assert(string_length
== value_length
);
498 assert(!memcmp(string
, value
, string_length
));
506 uint8_t get_test4(memcached_st
*memc
)
511 size_t value_length
= 8191;
513 size_t string_length
;
517 value
= (char*)malloc(value_length
);
520 for (x
= 0; x
< value_length
; x
++)
521 value
[x
] = (char) (x
% 127);
523 rc
= memcached_set(memc
, key
, strlen(key
),
525 (time_t)0, (uint16_t)0);
526 assert(rc
== MEMCACHED_SUCCESS
);
528 for (x
= 0; x
< 10; x
++)
530 string
= memcached_get(memc
, key
, strlen(key
),
531 &string_length
, &flags
, &rc
);
533 assert(rc
== MEMCACHED_SUCCESS
);
535 assert(string_length
== value_length
);
536 assert(!memcmp(string
, value
, string_length
));
545 uint8_t stats_servername_test(memcached_st
*memc
)
548 memcached_stat_st stat
;
549 rc
= memcached_stat_servername(&stat
, NULL
,
551 MEMCACHED_DEFAULT_PORT
);
556 uint8_t increment_test(memcached_st
*memc
)
563 rc
= memcached_set(memc
, key
, strlen(key
),
564 value
, strlen(value
),
565 (time_t)0, (uint16_t)0);
566 assert(rc
== MEMCACHED_SUCCESS
);
568 rc
= memcached_increment(memc
, key
, strlen(key
),
570 assert(rc
== MEMCACHED_SUCCESS
);
571 assert(new_number
== 1);
573 rc
= memcached_increment(memc
, key
, strlen(key
),
575 assert(rc
== MEMCACHED_SUCCESS
);
576 assert(new_number
== 2);
581 uint8_t decrement_test(memcached_st
*memc
)
588 rc
= memcached_set(memc
, key
, strlen(key
),
589 value
, strlen(value
),
590 (time_t)0, (uint16_t)0);
591 assert(rc
== MEMCACHED_SUCCESS
);
593 rc
= memcached_decrement(memc
, key
, strlen(key
),
595 assert(rc
== MEMCACHED_SUCCESS
);
596 assert(new_number
== 2);
598 rc
= memcached_decrement(memc
, key
, strlen(key
),
600 assert(rc
== MEMCACHED_SUCCESS
);
601 assert(new_number
== 1);
606 uint8_t quit_test(memcached_st
*memc
)
610 char *value
= "sanford and sun";
612 rc
= memcached_set(memc
, key
, strlen(key
),
613 value
, strlen(value
),
614 (time_t)10, (uint16_t)3);
615 assert(rc
== MEMCACHED_SUCCESS
);
616 memcached_quit(memc
);
618 rc
= memcached_set(memc
, key
, strlen(key
),
619 value
, strlen(value
),
620 (time_t)50, (uint16_t)9);
621 assert(rc
== MEMCACHED_SUCCESS
);
626 uint8_t mget_result_test(memcached_st
*memc
)
629 char *keys
[]= {"fudge", "son", "food"};
630 size_t key_length
[]= {5, 3, 4};
633 memcached_result_st results_obj
;
634 memcached_result_st
*results
;
636 results
= memcached_result_create(memc
, &results_obj
);
638 assert(&results_obj
== results
);
640 /* We need to empty the server before continueing test */
641 rc
= memcached_flush(memc
, 0);
642 assert(rc
== MEMCACHED_SUCCESS
);
644 rc
= memcached_mget(memc
, keys
, key_length
, 3);
645 assert(rc
== MEMCACHED_SUCCESS
);
647 while ((results
= memcached_fetch_result(memc
, &results_obj
, &rc
)) != NULL
)
652 while ((results
= memcached_fetch_result(memc
, &results_obj
, &rc
)) != NULL
)
654 assert(rc
== MEMCACHED_NOTFOUND
);
656 for (x
= 0; x
< 3; x
++)
658 rc
= memcached_set(memc
, keys
[x
], key_length
[x
],
659 keys
[x
], key_length
[x
],
660 (time_t)50, (uint16_t)9);
661 assert(rc
== MEMCACHED_SUCCESS
);
664 rc
= memcached_mget(memc
, keys
, key_length
, 3);
665 assert(rc
== MEMCACHED_SUCCESS
);
667 while ((results
= memcached_fetch_result(memc
, &results_obj
, &rc
)))
670 assert(&results_obj
== results
);
671 assert(rc
== MEMCACHED_SUCCESS
);
672 assert(memcached_result_key_length(results
) == memcached_result_length(results
));
673 assert(!memcmp(memcached_result_key_value(results
),
674 memcached_result_value(results
),
675 memcached_result_length(results
)));
678 memcached_result_free(&results_obj
);
683 uint8_t mget_result_alloc_test(memcached_st
*memc
)
686 char *keys
[]= {"fudge", "son", "food"};
687 size_t key_length
[]= {5, 3, 4};
690 memcached_result_st
*results
;
692 /* We need to empty the server before continueing test */
693 rc
= memcached_flush(memc
, 0);
694 assert(rc
== MEMCACHED_SUCCESS
);
696 rc
= memcached_mget(memc
, keys
, key_length
, 3);
697 assert(rc
== MEMCACHED_SUCCESS
);
699 while ((results
= memcached_fetch_result(memc
, NULL
, &rc
)) != NULL
)
704 assert(rc
== MEMCACHED_NOTFOUND
);
706 for (x
= 0; x
< 3; x
++)
708 rc
= memcached_set(memc
, keys
[x
], key_length
[x
],
709 keys
[x
], key_length
[x
],
710 (time_t)50, (uint16_t)9);
711 assert(rc
== MEMCACHED_SUCCESS
);
714 rc
= memcached_mget(memc
, keys
, key_length
, 3);
715 assert(rc
== MEMCACHED_SUCCESS
);
718 while ((results
= memcached_fetch_result(memc
, NULL
, &rc
)))
721 assert(rc
== MEMCACHED_SUCCESS
);
722 assert(memcached_result_key_length(results
) == memcached_result_length(results
));
723 assert(!memcmp(memcached_result_key_value(results
),
724 memcached_result_value(results
),
725 memcached_result_length(results
)));
726 memcached_result_free(results
);
733 uint8_t mget_test(memcached_st
*memc
)
736 char *keys
[]= {"fudge", "son", "food"};
737 size_t key_length
[]= {5, 3, 4};
741 char return_key
[MEMCACHED_MAX_KEY
];
742 size_t return_key_length
;
744 size_t return_value_length
;
746 /* We need to empty the server before continueing test */
747 rc
= memcached_flush(memc
, 0);
748 assert(rc
== MEMCACHED_SUCCESS
);
750 rc
= memcached_mget(memc
, keys
, key_length
, 3);
751 assert(rc
== MEMCACHED_SUCCESS
);
753 while ((return_value
= memcached_fetch(memc
, return_key
, &return_key_length
,
754 &return_value_length
, &flags
, &rc
)) != NULL
)
756 assert(return_value
);
758 assert(!return_value
);
759 assert(return_value_length
== 0);
760 assert(rc
== MEMCACHED_NOTFOUND
);
762 for (x
= 0; x
< 3; x
++)
764 rc
= memcached_set(memc
, keys
[x
], key_length
[x
],
765 keys
[x
], key_length
[x
],
766 (time_t)50, (uint16_t)9);
767 assert(rc
== MEMCACHED_SUCCESS
);
770 rc
= memcached_mget(memc
, keys
, key_length
, 3);
771 assert(rc
== MEMCACHED_SUCCESS
);
774 while ((return_value
= memcached_fetch(memc
, return_key
, &return_key_length
,
775 &return_value_length
, &flags
, &rc
)))
777 assert(return_value
);
778 assert(rc
== MEMCACHED_SUCCESS
);
779 assert(return_key_length
== return_value_length
);
780 assert(!memcmp(return_value
, return_key
, return_value_length
));
788 uint8_t get_stats_keys(memcached_st
*memc
)
792 memcached_stat_st stat
;
795 list
= memcached_stat_get_keys(memc
, &stat
, &rc
);
796 assert(rc
== MEMCACHED_SUCCESS
);
797 for (ptr
= list
; *ptr
; ptr
++)
798 printf("Found key %s\n", *ptr
);
806 uint8_t get_stats(memcached_st
*memc
)
812 memcached_stat_st
*stat
;
814 stat
= memcached_stat(memc
, NULL
, &rc
);
815 assert(rc
== MEMCACHED_SUCCESS
);
817 assert(rc
== MEMCACHED_SUCCESS
);
820 for (x
= 0; x
< memcached_server_count(memc
); x
++)
822 list
= memcached_stat_get_keys(memc
, &stat
[x
], &rc
);
823 assert(rc
== MEMCACHED_SUCCESS
);
824 for (ptr
= list
; *ptr
; ptr
++)
825 printf("Found key %s\n", *ptr
);
830 memcached_stat_free(NULL
, stat
);
835 uint8_t add_host_test(memcached_st
*memc
)
838 memcached_server_st
*servers
;
840 char servername
[]= "0.example.com";
842 servers
= memcached_server_list_append(NULL
, servername
, 400, &rc
);
844 assert(1 == memcached_server_list_count(servers
));
846 for (x
= 2; x
< 20; x
++)
848 char buffer
[SMALL_STRING_LEN
];
850 snprintf(buffer
, SMALL_STRING_LEN
, "%u.example.com", 400+x
);
851 servers
= memcached_server_list_append(servers
, buffer
, 401,
853 assert(rc
== MEMCACHED_SUCCESS
);
854 assert(x
== memcached_server_list_count(servers
));
857 rc
= memcached_server_push(memc
, servers
);
858 assert(rc
== MEMCACHED_SUCCESS
);
859 rc
= memcached_server_push(memc
, servers
);
860 assert(rc
== MEMCACHED_SUCCESS
);
862 memcached_server_list_free(servers
);
867 /* We don't test the behavior itself, we test the switches */
868 uint8_t behavior_test(memcached_st
*memc
)
870 unsigned long long value
;
873 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
, &set
);
874 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
);
877 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
, &set
);
878 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
);
881 set
= MEMCACHED_HASH_MD5
;
882 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &set
);
883 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_HASH
);
884 assert(value
== MEMCACHED_HASH_MD5
);
888 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
, &set
);
889 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
);
892 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
, &set
);
893 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
);
896 set
= MEMCACHED_HASH_DEFAULT
;
897 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &set
);
898 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_HASH
);
899 assert(value
== MEMCACHED_HASH_DEFAULT
);
901 set
= MEMCACHED_HASH_CRC
;
902 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &set
);
903 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_HASH
);
904 assert(value
== MEMCACHED_HASH_CRC
);
906 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
);
909 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
);
915 /* Test case provided by Cal Haldenbrand */
916 uint8_t user_supplied_bug1(memcached_st
*memc
)
918 unsigned int setter
= 1;
921 unsigned long long total
= 0;
924 char randomstuff
[6 * 1024];
927 memset(randomstuff
, 0, 6 * 1024);
929 /* We just keep looking at the same values over and over */
932 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
, &setter
);
933 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
, &setter
);
937 for (x
= 0 ; total
< 20 * 1024576 ; x
++ )
941 size
= (rand() % ( 5 * 1024 ) ) + 400;
942 memset(randomstuff
, 0, 6 * 1024);
943 assert(size
< 6 * 1024); /* Being safe here */
945 for (j
= 0 ; j
< size
;j
++)
946 randomstuff
[j
] = (char) (rand() % 26) + 97;
949 sprintf(key
, "%d", x
);
950 rc
= memcached_set(memc
, key
, strlen(key
),
951 randomstuff
, strlen(randomstuff
), 10, 0);
952 /* If we fail, lets try again */
953 if (rc
!= MEMCACHED_SUCCESS
)
954 rc
= memcached_set(memc
, key
, strlen(key
),
955 randomstuff
, strlen(randomstuff
), 10, 0);
956 assert(rc
== MEMCACHED_SUCCESS
);
962 /* Test case provided by Cal Haldenbrand */
963 uint8_t user_supplied_bug2(memcached_st
*memc
)
968 unsigned long long total
;
971 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
, &setter
);
972 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
, &setter
);
974 setter
= 20 * 1024576;
975 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
, &setter
);
976 setter
= 20 * 1024576;
977 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
, &setter
);
978 getter
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
);
979 getter
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
);
981 for (x
= 0, errors
= 0, total
= 0 ; total
< 20 * 1024576 ; x
++)
984 for (x
= 0, errors
= 0, total
= 0 ; total
< 24576 ; x
++)
986 memcached_return rc
= MEMCACHED_SUCCESS
;
987 char buffer
[SMALL_STRING_LEN
];
992 memset(buffer
, 0, SMALL_STRING_LEN
);
994 snprintf(buffer
, SMALL_STRING_LEN
, "%u", x
);
995 getval
= memcached_get(memc
, buffer
, strlen(buffer
),
996 &val_len
, &flags
, &rc
);
997 if (rc
!= MEMCACHED_SUCCESS
)
999 if (rc
== MEMCACHED_NOTFOUND
)
1014 /* Do a large mget() over all the keys we think exist */
1015 #define KEY_COUNT 3000 // * 1024576
1016 uint8_t user_supplied_bug3(memcached_st
*memc
)
1018 memcached_return rc
;
1019 unsigned int setter
;
1022 size_t key_lengths
[KEY_COUNT
];
1025 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
, &setter
);
1026 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
, &setter
);
1028 setter
= 20 * 1024576;
1029 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
, &setter
);
1030 setter
= 20 * 1024576;
1031 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
, &setter
);
1032 getter
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
);
1033 getter
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
);
1036 keys
= (char **)malloc(sizeof(char *) * KEY_COUNT
);
1038 memset(keys
, 0, (sizeof(char *) * KEY_COUNT
));
1039 for (x
= 0; x
< KEY_COUNT
; x
++)
1043 snprintf(buffer
, 30, "%u", x
);
1044 keys
[x
]= strdup(buffer
);
1045 key_lengths
[x
]= strlen(keys
[x
]);
1048 rc
= memcached_mget(memc
, keys
, key_lengths
, KEY_COUNT
);
1049 assert(rc
== MEMCACHED_SUCCESS
);
1051 /* Turn this into a help function */
1053 char return_key
[MEMCACHED_MAX_KEY
];
1054 size_t return_key_length
;
1056 size_t return_value_length
;
1059 while ((return_value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1060 &return_value_length
, &flags
, &rc
)))
1062 assert(return_value
);
1063 assert(rc
== MEMCACHED_SUCCESS
);
1068 for (x
= 0; x
< KEY_COUNT
; x
++)
1075 /* Make sure we behave properly if server list has no values */
1076 uint8_t user_supplied_bug4(memcached_st
*memc
)
1078 memcached_return rc
;
1079 char *keys
[]= {"fudge", "son", "food"};
1080 size_t key_length
[]= {5, 3, 4};
1084 /* Here we free everything before running a bunch of mget tests */
1086 memcached_server_list_free(memc
->hosts
);
1088 memc
->number_of_hosts
= 0;
1091 char return_key
[MEMCACHED_MAX_KEY
];
1092 size_t return_key_length
;
1094 size_t return_value_length
;
1096 /* We need to empty the server before continueing test */
1097 rc
= memcached_flush(memc
, 0);
1098 assert(rc
== MEMCACHED_NO_SERVERS
);
1100 rc
= memcached_mget(memc
, keys
, key_length
, 3);
1101 assert(rc
== MEMCACHED_NO_SERVERS
);
1103 while ((return_value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1104 &return_value_length
, &flags
, &rc
)) != NULL
)
1106 assert(return_value
);
1108 assert(!return_value
);
1109 assert(return_value_length
== 0);
1110 assert(rc
== MEMCACHED_NO_SERVERS
);
1112 for (x
= 0; x
< 3; x
++)
1114 rc
= memcached_set(memc
, keys
[x
], key_length
[x
],
1115 keys
[x
], key_length
[x
],
1116 (time_t)50, (uint16_t)9);
1117 assert(rc
== MEMCACHED_NO_SERVERS
);
1120 rc
= memcached_mget(memc
, keys
, key_length
, 3);
1121 assert(rc
== MEMCACHED_NO_SERVERS
);
1124 while ((return_value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1125 &return_value_length
, &flags
, &rc
)))
1127 assert(return_value
);
1128 assert(rc
== MEMCACHED_SUCCESS
);
1129 assert(return_key_length
== return_value_length
);
1130 assert(!memcmp(return_value
, return_key
, return_value_length
));
1138 #define VALUE_SIZE_BUG5 1048064
1139 uint8_t user_supplied_bug5(memcached_st
*memc
)
1141 memcached_return rc
;
1142 char *keys
[]= {"036790384900", "036790384902", "036790384904", "036790384906"};
1143 size_t key_length
[]= {strlen("036790384900"), strlen("036790384902"), strlen("036790384904"), strlen("036790384906")};
1144 char return_key
[MEMCACHED_MAX_KEY
];
1145 size_t return_key_length
;
1147 size_t value_length
;
1151 char insert_data
[VALUE_SIZE_BUG5
];
1153 for (x
= 0; x
< VALUE_SIZE_BUG5
; x
++)
1154 insert_data
[x
]= rand();
1156 memcached_flush(memc
, 0);
1157 value
= memcached_get(memc
, keys
[0], key_length
[0],
1158 &value_length
, &flags
, &rc
);
1159 assert(value
== NULL
);
1160 rc
= memcached_mget(memc
, keys
, key_length
, 4);
1163 while ((value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1164 &value_length
, &flags
, &rc
)))
1168 for (x
= 0; x
< 4; x
++)
1170 rc
= memcached_set(memc
, keys
[x
], key_length
[x
],
1171 insert_data
, VALUE_SIZE_BUG5
,
1172 (time_t)0, (uint16_t)0);
1173 assert(rc
== MEMCACHED_SUCCESS
);
1176 for (x
= 0; x
< 10; x
++)
1178 value
= memcached_get(memc
, keys
[0], key_length
[0],
1179 &value_length
, &flags
, &rc
);
1183 rc
= memcached_mget(memc
, keys
, key_length
, 4);
1185 while ((value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1186 &value_length
, &flags
, &rc
)))
1197 uint8_t user_supplied_bug6(memcached_st
*memc
)
1199 memcached_return rc
;
1200 char *keys
[]= {"036790384900", "036790384902", "036790384904", "036790384906"};
1201 size_t key_length
[]= {strlen("036790384900"), strlen("036790384902"), strlen("036790384904"), strlen("036790384906")};
1202 char return_key
[MEMCACHED_MAX_KEY
];
1203 size_t return_key_length
;
1205 size_t value_length
;
1209 char insert_data
[VALUE_SIZE_BUG5
];
1211 for (x
= 0; x
< VALUE_SIZE_BUG5
; x
++)
1212 insert_data
[x
]= rand();
1214 memcached_flush(memc
, 0);
1215 value
= memcached_get(memc
, keys
[0], key_length
[0],
1216 &value_length
, &flags
, &rc
);
1217 assert(value
== NULL
);
1218 rc
= memcached_mget(memc
, keys
, key_length
, 4);
1221 while ((value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1222 &value_length
, &flags
, &rc
)))
1226 for (x
= 0; x
< 4; x
++)
1228 rc
= memcached_set(memc
, keys
[x
], key_length
[x
],
1229 insert_data
, VALUE_SIZE_BUG5
,
1230 (time_t)0, (uint16_t)0);
1231 assert(rc
== MEMCACHED_SUCCESS
);
1234 for (x
= 0; x
< 10; x
++)
1236 value
= memcached_get(memc
, keys
[0], key_length
[0],
1237 &value_length
, &flags
, &rc
);
1241 rc
= memcached_mget(memc
, keys
, key_length
, 4);
1243 /* We test for purge of partial complete fetches */
1244 for (count
= 3; count
; count
--)
1246 value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1247 &value_length
, &flags
, &rc
);
1249 assert(rc
== MEMCACHED_SUCCESS
);
1256 /* Test flag store/retrieve */
1257 uint8_t user_supplied_bug7(memcached_st
*memc
)
1259 memcached_return rc
;
1260 char *keys
= "036790384900";
1261 size_t key_length
= strlen("036790384900");
1262 char return_key
[MEMCACHED_MAX_KEY
];
1263 size_t return_key_length
;
1265 size_t value_length
;
1268 char insert_data
[VALUE_SIZE_BUG5
];
1270 for (x
= 0; x
< VALUE_SIZE_BUG5
; x
++)
1271 insert_data
[x
]= rand();
1273 memcached_flush(memc
, 0);
1276 rc
= memcached_set(memc
, keys
, key_length
,
1277 insert_data
, VALUE_SIZE_BUG5
,
1279 assert(rc
== MEMCACHED_SUCCESS
);
1282 value
= memcached_get(memc
, keys
, key_length
,
1283 &value_length
, &flags
, &rc
);
1284 assert(flags
== 245);
1288 rc
= memcached_mget(memc
, &keys
, &key_length
, 1);
1291 value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1292 &value_length
, &flags
, &rc
);
1293 assert(flags
== 245);
1301 uint8_t result_static(memcached_st
*memc
)
1303 memcached_result_st result
;
1304 memcached_result_st
*result_ptr
;
1306 result_ptr
= memcached_result_create(memc
, &result
);
1307 assert(result
.is_allocated
== MEMCACHED_NOT_ALLOCATED
);
1309 memcached_result_free(&result
);
1314 uint8_t result_alloc(memcached_st
*memc
)
1316 memcached_result_st
*result
;
1318 result
= memcached_result_create(memc
, NULL
);
1320 memcached_result_free(result
);
1325 uint8_t string_static_null(memcached_st
*memc
)
1327 memcached_string_st string
;
1328 memcached_string_st
*string_ptr
;
1330 string_ptr
= memcached_string_create(memc
, &string
, 0);
1331 assert(string
.is_allocated
== MEMCACHED_NOT_ALLOCATED
);
1333 memcached_string_free(&string
);
1338 uint8_t string_alloc_null(memcached_st
*memc
)
1340 memcached_string_st
*string
;
1342 string
= memcached_string_create(memc
, NULL
, 0);
1344 memcached_string_free(string
);
1349 uint8_t string_alloc_with_size(memcached_st
*memc
)
1351 memcached_string_st
*string
;
1353 string
= memcached_string_create(memc
, NULL
, 1024);
1355 memcached_string_free(string
);
1360 uint8_t string_alloc_with_size_toobig(memcached_st
*memc
)
1362 memcached_string_st
*string
;
1364 string
= memcached_string_create(memc
, NULL
, INT64_MAX
);
1365 assert(string
== NULL
);
1370 uint8_t string_alloc_append(memcached_st
*memc
)
1373 char buffer
[SMALL_STRING_LEN
];
1374 memcached_string_st
*string
;
1376 /* Ring the bell! */
1377 memset(buffer
, 6, SMALL_STRING_LEN
);
1379 string
= memcached_string_create(memc
, NULL
, 100);
1382 for (x
= 0; x
< 1024; x
++)
1384 memcached_return rc
;
1385 rc
= memcached_string_append(string
, buffer
, SMALL_STRING_LEN
);
1386 assert(rc
== MEMCACHED_SUCCESS
);
1388 memcached_string_free(string
);
1393 uint8_t string_alloc_append_toobig(memcached_st
*memc
)
1395 memcached_return rc
;
1397 char buffer
[SMALL_STRING_LEN
];
1398 memcached_string_st
*string
;
1400 /* Ring the bell! */
1401 memset(buffer
, 6, SMALL_STRING_LEN
);
1403 string
= memcached_string_create(memc
, NULL
, 100);
1406 for (x
= 0; x
< 1024; x
++)
1408 rc
= memcached_string_append(string
, buffer
, SMALL_STRING_LEN
);
1409 assert(rc
== MEMCACHED_SUCCESS
);
1411 rc
= memcached_string_append(string
, buffer
, INT64_MAX
);
1412 assert(rc
== MEMCACHED_MEMORY_ALLOCATION_FAILURE
);
1413 memcached_string_free(string
);
1418 uint8_t cleanup_pairs(memcached_st
*memc
)
1420 pairs_free(global_pairs
);
1425 uint8_t generate_data(memcached_st
*memc
)
1427 unsigned long long x
;
1428 global_pairs
= pairs_generate(GLOBAL_COUNT
);
1429 execute_set(memc
, global_pairs
, GLOBAL_COUNT
);
1431 for (x
= 0; x
< GLOBAL_COUNT
; x
++)
1433 global_keys
[x
]= global_pairs
[x
].key
;
1434 global_keys_length
[x
]= global_pairs
[x
].key_length
;
1440 uint8_t get_read(memcached_st
*memc
)
1443 memcached_return rc
;
1447 size_t return_value_length
;
1450 for (x
= 0; x
< GLOBAL_COUNT
; x
++)
1452 return_value
= memcached_get(memc
, global_keys
[x
], global_keys_length
[x
],
1453 &return_value_length
, &flags
, &rc
);
1455 assert(return_value);
1456 assert(rc == MEMCACHED_SUCCESS);
1458 if (rc
== MEMCACHED_SUCCESS
&& return_value
)
1466 uint8_t mget_read(memcached_st
*memc
)
1468 memcached_return rc
;
1470 rc
= memcached_mget(memc
, global_keys
, global_keys_length
, GLOBAL_COUNT
);
1471 assert(rc
== MEMCACHED_SUCCESS
);
1472 /* Turn this into a help function */
1474 char return_key
[MEMCACHED_MAX_KEY
];
1475 size_t return_key_length
;
1477 size_t return_value_length
;
1480 while ((return_value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1481 &return_value_length
, &flags
, &rc
)))
1483 assert(return_value
);
1484 assert(rc
== MEMCACHED_SUCCESS
);
1492 uint8_t mget_read_result(memcached_st
*memc
)
1494 memcached_return rc
;
1496 rc
= memcached_mget(memc
, global_keys
, global_keys_length
, GLOBAL_COUNT
);
1497 assert(rc
== MEMCACHED_SUCCESS
);
1498 /* Turn this into a help function */
1500 memcached_result_st results_obj
;
1501 memcached_result_st
*results
;
1503 results
= memcached_result_create(memc
, &results_obj
);
1505 while ((results
= memcached_fetch_result(memc
, &results_obj
, &rc
)))
1508 assert(rc
== MEMCACHED_SUCCESS
);
1511 memcached_result_free(&results_obj
);
1517 uint8_t free_data(memcached_st
*memc
)
1519 pairs_free(global_pairs
);
1524 uint8_t add_host_test1(memcached_st
*memc
)
1527 memcached_return rc
;
1528 char servername
[]= "0.example.com";
1529 memcached_server_st
*servers
;
1531 servers
= memcached_server_list_append(NULL
, servername
, 400, &rc
);
1533 assert(1 == memcached_server_list_count(servers
));
1535 for (x
= 2; x
< 20; x
++)
1537 char buffer
[SMALL_STRING_LEN
];
1539 snprintf(buffer
, SMALL_STRING_LEN
, "%u.example.com", 400+x
);
1540 servers
= memcached_server_list_append(servers
, buffer
, 401,
1542 assert(rc
== MEMCACHED_SUCCESS
);
1543 assert(x
== memcached_server_list_count(servers
));
1546 rc
= memcached_server_push(memc
, servers
);
1547 assert(rc
== MEMCACHED_SUCCESS
);
1548 rc
= memcached_server_push(memc
, servers
);
1549 assert(rc
== MEMCACHED_SUCCESS
);
1551 memcached_server_list_free(servers
);
1556 memcached_return
pre_nonblock(memcached_st
*memc
)
1558 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
, NULL
);
1560 return MEMCACHED_SUCCESS
;
1563 memcached_return
pre_md5(memcached_st
*memc
)
1565 memcached_hash value
= MEMCACHED_HASH_MD5
;
1566 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &value
);
1568 return MEMCACHED_SUCCESS
;
1571 memcached_return
pre_crc(memcached_st
*memc
)
1573 memcached_hash value
= MEMCACHED_HASH_CRC
;
1574 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &value
);
1576 return MEMCACHED_SUCCESS
;
1579 memcached_return
pre_hash_fnv1_64(memcached_st
*memc
)
1581 memcached_hash value
= MEMCACHED_HASH_FNV1_64
;
1582 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &value
);
1584 return MEMCACHED_SUCCESS
;
1587 memcached_return
pre_hash_fnv1a_64(memcached_st
*memc
)
1589 memcached_hash value
= MEMCACHED_HASH_FNV1A_64
;
1590 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &value
);
1592 return MEMCACHED_SUCCESS
;
1595 memcached_return
pre_hash_fnv1_32(memcached_st
*memc
)
1597 memcached_hash value
= MEMCACHED_HASH_FNV1_32
;
1598 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &value
);
1600 return MEMCACHED_SUCCESS
;
1603 memcached_return
pre_hash_fnv1a_32(memcached_st
*memc
)
1605 memcached_hash value
= MEMCACHED_HASH_FNV1A_32
;
1606 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &value
);
1608 return MEMCACHED_SUCCESS
;
1611 memcached_return
pre_hash_ketama(memcached_st
*memc
)
1613 memcached_hash value
= MEMCACHED_HASH_KETAMA
;
1614 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &value
);
1616 return MEMCACHED_SUCCESS
;
1619 memcached_return
enable_cas(memcached_st
*memc
)
1621 unsigned int set
= 1;
1623 memcached_version(memc
);
1625 if (memc
->hosts
[0].major_version
>= 1 &&
1626 memc
->hosts
[0].minor_version
>= 2 &&
1627 memc
->hosts
[0].micro_version
>= 4)
1629 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_SUPPORT_CAS
, &set
);
1631 return MEMCACHED_SUCCESS
;
1634 return MEMCACHED_FAILURE
;
1637 memcached_return
check_for_1_2_3(memcached_st
*memc
)
1639 memcached_version(memc
);
1641 if (memc
->hosts
[0].major_version
>= 1 &&
1642 memc
->hosts
[0].minor_version
>= 2 &&
1643 memc
->hosts
[0].micro_version
>= 4)
1644 return MEMCACHED_SUCCESS
;
1646 return MEMCACHED_FAILURE
;
1649 memcached_return
pre_unix_socket(memcached_st
*memc
)
1651 memcached_return rc
;
1654 memcached_server_list_free(memc
->hosts
);
1656 memc
->number_of_hosts
= 0;
1658 if (stat("/tmp/memcached.socket", &buf
))
1659 return MEMCACHED_FAILURE
;
1661 rc
= memcached_server_add_unix_socket(memc
, "/tmp/memcached.socket");
1666 memcached_return
pre_udp(memcached_st
*memc
)
1668 memcached_return rc
;
1670 memcached_server_list_free(memc
->hosts
);
1672 memc
->number_of_hosts
= 0;
1675 return MEMCACHED_FAILURE
;
1677 rc
= memcached_server_add_udp(memc
, "localhost", MEMCACHED_DEFAULT_PORT
);
1682 memcached_return
pre_nodelay(memcached_st
*memc
)
1684 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
, NULL
);
1685 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
, NULL
);
1687 return MEMCACHED_SUCCESS
;
1690 memcached_return
poll_timeout(memcached_st
*memc
)
1696 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_POLL_TIMEOUT
, &timeout
);
1698 timeout
= (int32_t)memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_POLL_TIMEOUT
);
1700 assert(timeout
== 100);
1702 return MEMCACHED_SUCCESS
;
1706 /* Clean the server before beginning testing */
1708 {"flush", 0, flush_test
},
1709 {"init", 0, init_test
},
1710 {"allocation", 0, allocation_test
},
1711 {"clone_test", 0, clone_test
},
1712 {"error", 0, error_test
},
1713 {"set", 0, set_test
},
1714 {"set2", 0, set_test2
},
1715 {"set3", 0, set_test3
},
1716 {"add", 0, add_test
},
1717 {"replace", 0, replace_test
},
1718 {"delete", 1, delete_test
},
1719 {"get", 1, get_test
},
1720 {"get2", 0, get_test2
},
1721 {"get3", 0, get_test3
},
1722 {"get4", 0, get_test4
},
1723 {"stats_servername", 0, stats_servername_test
},
1724 {"increment", 0, increment_test
},
1725 {"decrement", 0, decrement_test
},
1726 {"quit", 0, quit_test
},
1727 {"mget", 1, mget_test
},
1728 {"mget_result", 1, mget_result_test
},
1729 {"mget_result_alloc", 1, mget_result_alloc_test
},
1730 {"get_stats", 0, get_stats
},
1731 {"add_host_test", 0, add_host_test
},
1732 {"get_stats_keys", 0, get_stats_keys
},
1733 {"behavior_test", 0, get_stats_keys
},
1737 test_st string_tests
[] ={
1738 {"string static with null", 0, string_static_null
},
1739 {"string alloc with null", 0, string_alloc_null
},
1740 {"string alloc with 1K", 0, string_alloc_with_size
},
1741 {"string alloc with malloc failure", 0, string_alloc_with_size_toobig
},
1742 {"string append", 0, string_alloc_append
},
1743 {"string append failure (too big)", 0, string_alloc_append_toobig
},
1747 test_st result_tests
[] ={
1748 {"result static", 0, result_static
},
1749 {"result alloc", 0, result_alloc
},
1753 test_st version_1_2_3
[] ={
1754 {"append", 0, append_test
},
1755 {"prepend", 0, prepend_test
},
1756 {"cas", 0, cas_test
},
1757 {"cas2", 0, cas2_test
},
1758 {"append_binary", 0, append_binary_test
},
1762 test_st user_tests
[] ={
1763 {"user_supplied_bug1", 0, user_supplied_bug1
},
1764 {"user_supplied_bug2", 0, user_supplied_bug2
},
1765 {"user_supplied_bug3", 0, user_supplied_bug3
},
1766 {"user_supplied_bug4", 0, user_supplied_bug4
},
1767 {"user_supplied_bug5", 1, user_supplied_bug5
},
1768 {"user_supplied_bug6", 1, user_supplied_bug6
},
1769 {"user_supplied_bug7", 1, user_supplied_bug7
},
1773 test_st generate_tests
[] ={
1774 {"generate_data", 0, generate_data
},
1775 {"get_read", 0, get_read
},
1776 {"mget_read", 0, mget_read
},
1777 {"mget_read_result", 0, mget_read_result
},
1778 {"cleanup", 0, cleanup_pairs
},
1783 collection_st collection
[] ={
1784 {"block", 0, 0, tests
},
1785 {"nonblock", pre_nonblock
, 0, tests
},
1786 {"nodelay", pre_nodelay
, 0, tests
},
1787 {"md5", pre_md5
, 0, tests
},
1788 {"crc", pre_crc
, 0, tests
},
1789 {"fnv1_64", pre_hash_fnv1_64
, 0, tests
},
1790 {"fnv1a_64", pre_hash_fnv1a_64
, 0, tests
},
1791 {"fnv1_32", pre_hash_fnv1_32
, 0, tests
},
1792 {"fnv1a_32", pre_hash_fnv1a_32
, 0, tests
},
1793 {"ketama", pre_hash_ketama
, 0, tests
},
1794 {"unix_socket", pre_unix_socket
, 0, tests
},
1795 {"unix_socket_nodelay", pre_nodelay
, 0, tests
},
1796 {"poll_timeout", poll_timeout
, 0, tests
},
1797 {"gets", enable_cas
, 0, tests
},
1798 // {"udp", pre_udp, 0, tests},
1799 {"version_1_2_3", check_for_1_2_3
, 0, version_1_2_3
},
1800 {"string", 0, 0, string_tests
},
1801 {"result", 0, 0, result_tests
},
1802 {"user", 0, 0, user_tests
},
1803 {"generate", 0, 0, generate_tests
},
1804 {"generate_nonblock", pre_nonblock
, 0, generate_tests
},
1808 collection_st
*gets_collections(void)