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
);
155 uint8_t append_binary_test(memcached_st
*memc
)
158 char *key
= "numbers";
159 unsigned int *store_ptr
;
160 unsigned int store_list
[] = { 23, 56, 499, 98, 32847, 0 };
166 rc
= memcached_flush(memc
, 0);
167 assert(rc
== MEMCACHED_SUCCESS
);
169 rc
= memcached_set(memc
,
172 (time_t)0, (uint16_t)0);
173 assert(rc
== MEMCACHED_SUCCESS
);
175 for (x
= 0; store_list
[x
] ; x
++)
177 rc
= memcached_append(memc
,
179 (char *)&store_list
[x
], sizeof(unsigned int),
180 (time_t)0, (uint16_t)0);
181 assert(rc
== MEMCACHED_SUCCESS
);
184 value
= memcached_get(memc
, key
, strlen(key
),
185 &value_length
, &flags
, &rc
);
186 assert((value_length
== (sizeof(unsigned int) * x
)));
187 assert(rc
== MEMCACHED_SUCCESS
);
189 store_ptr
= (unsigned int *)value
;
193 assert(*store_ptr
== store_list
[x
++]);
200 uint8_t cas2_test(memcached_st
*memc
)
203 char *keys
[]= {"fudge", "son", "food"};
204 size_t key_length
[]= {5, 3, 4};
205 char *value
= "we the people";
206 size_t value_length
= strlen("we the people");
208 memcached_result_st results_obj
;
209 memcached_result_st
*results
;
212 rc
= memcached_flush(memc
, 0);
213 assert(rc
== MEMCACHED_SUCCESS
);
215 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_SUPPORT_CAS
, &set
);
217 for (x
= 0; x
< 3; x
++)
219 rc
= memcached_set(memc
, keys
[x
], key_length
[x
],
220 keys
[x
], key_length
[x
],
221 (time_t)50, (uint16_t)9);
222 assert(rc
== MEMCACHED_SUCCESS
);
225 rc
= memcached_mget(memc
, keys
, key_length
, 3);
227 results
= memcached_result_create(memc
, &results_obj
);
229 results
= memcached_fetch_result(memc
, &results_obj
, &rc
);
231 assert(results
->cas
);
232 assert(rc
== MEMCACHED_SUCCESS
);
233 WATCHPOINT_ASSERT(memcached_result_cas(results
));
235 assert(!memcmp(value
, "we the people", strlen("we the people")));
236 assert(strlen("we the people") == value_length
);
237 assert(rc
== MEMCACHED_SUCCESS
);
239 memcached_result_free(&results_obj
);
244 uint8_t cas_test(memcached_st
*memc
)
248 size_t key_length
= strlen("fun");
249 char *value
= "we the people";
250 size_t value_length
= strlen("we the people");
251 memcached_result_st results_obj
;
252 memcached_result_st
*results
;
255 rc
= memcached_flush(memc
, 0);
256 assert(rc
== MEMCACHED_SUCCESS
);
258 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_SUPPORT_CAS
, &set
);
260 rc
= memcached_set(memc
, key
, strlen(key
),
261 value
, strlen(value
),
262 (time_t)0, (uint16_t)0);
263 assert(rc
== MEMCACHED_SUCCESS
);
265 rc
= memcached_mget(memc
, &key
, &key_length
, 1);
267 results
= memcached_result_create(memc
, &results_obj
);
269 results
= memcached_fetch_result(memc
, &results_obj
, &rc
);
271 assert(rc
== MEMCACHED_SUCCESS
);
272 WATCHPOINT_ASSERT(memcached_result_cas(results
));
274 assert(!memcmp(value
, "we the people", strlen("we the people")));
275 assert(strlen("we the people") == value_length
);
276 assert(rc
== MEMCACHED_SUCCESS
);
278 memcached_result_free(&results_obj
);
283 uint8_t prepend_test(memcached_st
*memc
)
287 char *value
= "people";
291 rc
= memcached_flush(memc
, 0);
292 assert(rc
== MEMCACHED_SUCCESS
);
294 rc
= memcached_set(memc
, key
, strlen(key
),
295 value
, strlen(value
),
296 (time_t)0, (uint16_t)0);
297 assert(rc
== MEMCACHED_SUCCESS
);
299 rc
= memcached_prepend(memc
, key
, strlen(key
),
300 "the ", strlen("the "),
301 (time_t)0, (uint16_t)0);
302 assert(rc
== MEMCACHED_SUCCESS
);
304 rc
= memcached_prepend(memc
, key
, strlen(key
),
305 "we ", strlen("we "),
306 (time_t)0, (uint16_t)0);
307 assert(rc
== MEMCACHED_SUCCESS
);
309 value
= memcached_get(memc
, key
, strlen(key
),
310 &value_length
, &flags
, &rc
);
311 assert(!memcmp(value
, "we the people", strlen("we the people")));
312 assert(strlen("we the people") == value_length
);
313 assert(rc
== MEMCACHED_SUCCESS
);
318 uint8_t add_test(memcached_st
*memc
)
322 char *value
= "when we sanitize";
324 rc
= memcached_add(memc
, key
, strlen(key
),
325 value
, strlen(value
),
326 (time_t)0, (uint16_t)0);
327 assert(rc
== MEMCACHED_NOTSTORED
);
332 uint8_t replace_test(memcached_st
*memc
)
336 char *value
= "when we sanitize";
338 rc
= memcached_replace(memc
, key
, strlen(key
),
339 value
, strlen(value
),
340 (time_t)0, (uint16_t)0);
341 assert(rc
== MEMCACHED_SUCCESS
);
346 uint8_t delete_test(memcached_st
*memc
)
350 char *value
= "when we sanitize";
352 rc
= memcached_set(memc
, key
, strlen(key
),
353 value
, strlen(value
),
354 (time_t)0, (uint16_t)0);
355 assert(rc
== MEMCACHED_SUCCESS
);
357 rc
= memcached_delete(memc
, key
, strlen(key
), (time_t)0);
358 assert(rc
== MEMCACHED_SUCCESS
);
363 uint8_t flush_test(memcached_st
*memc
)
367 rc
= memcached_flush(memc
, 0);
368 assert(rc
== MEMCACHED_SUCCESS
);
373 uint8_t get_test(memcached_st
*memc
)
378 size_t string_length
;
381 rc
= memcached_delete(memc
, key
, strlen(key
), (time_t)0);
382 assert(rc
== MEMCACHED_SUCCESS
|| rc
== MEMCACHED_NOTFOUND
);
384 string
= memcached_get(memc
, key
, strlen(key
),
385 &string_length
, &flags
, &rc
);
387 assert(rc
== MEMCACHED_NOTFOUND
);
388 assert(string_length
== 0);
394 uint8_t get_test2(memcached_st
*memc
)
398 char *value
= "when we sanitize";
400 size_t string_length
;
403 rc
= memcached_set(memc
, key
, strlen(key
),
404 value
, strlen(value
),
405 (time_t)0, (uint16_t)0);
406 assert(rc
== MEMCACHED_SUCCESS
);
408 string
= memcached_get(memc
, key
, strlen(key
),
409 &string_length
, &flags
, &rc
);
412 assert(rc
== MEMCACHED_SUCCESS
);
413 assert(string_length
== strlen(value
));
414 assert(!memcmp(string
, value
, string_length
));
421 uint8_t set_test2(memcached_st
*memc
)
425 char *value
= "train in the brain";
426 size_t value_length
= strlen(value
);
429 for (x
= 0; x
< 10; x
++)
431 rc
= memcached_set(memc
, key
, strlen(key
),
433 (time_t)0, (uint16_t)0);
434 assert(rc
== MEMCACHED_SUCCESS
);
440 uint8_t set_test3(memcached_st
*memc
)
445 size_t value_length
= 8191;
448 value
= (char*)malloc(value_length
);
451 for (x
= 0; x
< value_length
; x
++)
452 value
[x
] = (char) (x
% 127);
454 for (x
= 0; x
< 1; x
++)
456 rc
= memcached_set(memc
, key
, strlen(key
),
458 (time_t)0, (uint16_t)0);
459 assert(rc
== MEMCACHED_SUCCESS
);
467 uint8_t get_test3(memcached_st
*memc
)
472 size_t value_length
= 8191;
474 size_t string_length
;
478 value
= (char*)malloc(value_length
);
481 for (x
= 0; x
< value_length
; x
++)
482 value
[x
] = (char) (x
% 127);
484 rc
= memcached_set(memc
, key
, strlen(key
),
486 (time_t)0, (uint16_t)0);
487 assert(rc
== MEMCACHED_SUCCESS
);
489 string
= memcached_get(memc
, key
, strlen(key
),
490 &string_length
, &flags
, &rc
);
492 assert(rc
== MEMCACHED_SUCCESS
);
494 assert(string_length
== value_length
);
495 assert(!memcmp(string
, value
, string_length
));
503 uint8_t get_test4(memcached_st
*memc
)
508 size_t value_length
= 8191;
510 size_t string_length
;
514 value
= (char*)malloc(value_length
);
517 for (x
= 0; x
< value_length
; x
++)
518 value
[x
] = (char) (x
% 127);
520 rc
= memcached_set(memc
, key
, strlen(key
),
522 (time_t)0, (uint16_t)0);
523 assert(rc
== MEMCACHED_SUCCESS
);
525 for (x
= 0; x
< 10; x
++)
527 string
= memcached_get(memc
, key
, strlen(key
),
528 &string_length
, &flags
, &rc
);
530 assert(rc
== MEMCACHED_SUCCESS
);
532 assert(string_length
== value_length
);
533 assert(!memcmp(string
, value
, string_length
));
542 uint8_t stats_servername_test(memcached_st
*memc
)
545 memcached_stat_st stat
;
546 rc
= memcached_stat_servername(&stat
, NULL
,
548 MEMCACHED_DEFAULT_PORT
);
553 uint8_t increment_test(memcached_st
*memc
)
560 rc
= memcached_set(memc
, key
, strlen(key
),
561 value
, strlen(value
),
562 (time_t)0, (uint16_t)0);
563 assert(rc
== MEMCACHED_SUCCESS
);
565 rc
= memcached_increment(memc
, key
, strlen(key
),
567 assert(rc
== MEMCACHED_SUCCESS
);
568 assert(new_number
== 1);
570 rc
= memcached_increment(memc
, key
, strlen(key
),
572 assert(rc
== MEMCACHED_SUCCESS
);
573 assert(new_number
== 2);
578 uint8_t decrement_test(memcached_st
*memc
)
585 rc
= memcached_set(memc
, key
, strlen(key
),
586 value
, strlen(value
),
587 (time_t)0, (uint16_t)0);
588 assert(rc
== MEMCACHED_SUCCESS
);
590 rc
= memcached_decrement(memc
, key
, strlen(key
),
592 assert(rc
== MEMCACHED_SUCCESS
);
593 assert(new_number
== 2);
595 rc
= memcached_decrement(memc
, key
, strlen(key
),
597 assert(rc
== MEMCACHED_SUCCESS
);
598 assert(new_number
== 1);
603 uint8_t quit_test(memcached_st
*memc
)
607 char *value
= "sanford and sun";
609 rc
= memcached_set(memc
, key
, strlen(key
),
610 value
, strlen(value
),
611 (time_t)10, (uint16_t)3);
612 assert(rc
== MEMCACHED_SUCCESS
);
613 memcached_quit(memc
);
615 rc
= memcached_set(memc
, key
, strlen(key
),
616 value
, strlen(value
),
617 (time_t)50, (uint16_t)9);
618 assert(rc
== MEMCACHED_SUCCESS
);
623 uint8_t mget_result_test(memcached_st
*memc
)
626 char *keys
[]= {"fudge", "son", "food"};
627 size_t key_length
[]= {5, 3, 4};
630 memcached_result_st results_obj
;
631 memcached_result_st
*results
;
633 results
= memcached_result_create(memc
, &results_obj
);
635 assert(&results_obj
== results
);
637 /* We need to empty the server before continueing test */
638 rc
= memcached_flush(memc
, 0);
639 assert(rc
== MEMCACHED_SUCCESS
);
641 rc
= memcached_mget(memc
, keys
, key_length
, 3);
642 assert(rc
== MEMCACHED_SUCCESS
);
644 while ((results
= memcached_fetch_result(memc
, &results_obj
, &rc
)) != NULL
)
649 while ((results
= memcached_fetch_result(memc
, &results_obj
, &rc
)) != NULL
)
651 assert(rc
== MEMCACHED_NOTFOUND
);
653 for (x
= 0; x
< 3; x
++)
655 rc
= memcached_set(memc
, keys
[x
], key_length
[x
],
656 keys
[x
], key_length
[x
],
657 (time_t)50, (uint16_t)9);
658 assert(rc
== MEMCACHED_SUCCESS
);
661 rc
= memcached_mget(memc
, keys
, key_length
, 3);
662 assert(rc
== MEMCACHED_SUCCESS
);
664 while ((results
= memcached_fetch_result(memc
, &results_obj
, &rc
)))
667 assert(&results_obj
== results
);
668 assert(rc
== MEMCACHED_SUCCESS
);
669 assert(memcached_result_key_length(results
) == memcached_result_length(results
));
670 assert(!memcmp(memcached_result_key_value(results
),
671 memcached_result_value(results
),
672 memcached_result_length(results
)));
675 memcached_result_free(&results_obj
);
680 uint8_t mget_result_alloc_test(memcached_st
*memc
)
683 char *keys
[]= {"fudge", "son", "food"};
684 size_t key_length
[]= {5, 3, 4};
687 memcached_result_st
*results
;
689 /* We need to empty the server before continueing test */
690 rc
= memcached_flush(memc
, 0);
691 assert(rc
== MEMCACHED_SUCCESS
);
693 rc
= memcached_mget(memc
, keys
, key_length
, 3);
694 assert(rc
== MEMCACHED_SUCCESS
);
696 while ((results
= memcached_fetch_result(memc
, NULL
, &rc
)) != NULL
)
701 assert(rc
== MEMCACHED_NOTFOUND
);
703 for (x
= 0; x
< 3; x
++)
705 rc
= memcached_set(memc
, keys
[x
], key_length
[x
],
706 keys
[x
], key_length
[x
],
707 (time_t)50, (uint16_t)9);
708 assert(rc
== MEMCACHED_SUCCESS
);
711 rc
= memcached_mget(memc
, keys
, key_length
, 3);
712 assert(rc
== MEMCACHED_SUCCESS
);
715 while ((results
= memcached_fetch_result(memc
, NULL
, &rc
)))
718 assert(rc
== MEMCACHED_SUCCESS
);
719 assert(memcached_result_key_length(results
) == memcached_result_length(results
));
720 assert(!memcmp(memcached_result_key_value(results
),
721 memcached_result_value(results
),
722 memcached_result_length(results
)));
723 memcached_result_free(results
);
730 uint8_t mget_test(memcached_st
*memc
)
733 char *keys
[]= {"fudge", "son", "food"};
734 size_t key_length
[]= {5, 3, 4};
738 char return_key
[MEMCACHED_MAX_KEY
];
739 size_t return_key_length
;
741 size_t return_value_length
;
743 /* We need to empty the server before continueing test */
744 rc
= memcached_flush(memc
, 0);
745 assert(rc
== MEMCACHED_SUCCESS
);
747 rc
= memcached_mget(memc
, keys
, key_length
, 3);
748 assert(rc
== MEMCACHED_SUCCESS
);
750 while ((return_value
= memcached_fetch(memc
, return_key
, &return_key_length
,
751 &return_value_length
, &flags
, &rc
)) != NULL
)
753 assert(return_value
);
755 assert(!return_value
);
756 assert(return_value_length
== 0);
757 assert(rc
== MEMCACHED_NOTFOUND
);
759 for (x
= 0; x
< 3; x
++)
761 rc
= memcached_set(memc
, keys
[x
], key_length
[x
],
762 keys
[x
], key_length
[x
],
763 (time_t)50, (uint16_t)9);
764 assert(rc
== MEMCACHED_SUCCESS
);
767 rc
= memcached_mget(memc
, keys
, key_length
, 3);
768 assert(rc
== MEMCACHED_SUCCESS
);
771 while ((return_value
= memcached_fetch(memc
, return_key
, &return_key_length
,
772 &return_value_length
, &flags
, &rc
)))
774 assert(return_value
);
775 assert(rc
== MEMCACHED_SUCCESS
);
776 assert(return_key_length
== return_value_length
);
777 assert(!memcmp(return_value
, return_key
, return_value_length
));
785 uint8_t get_stats_keys(memcached_st
*memc
)
789 memcached_stat_st stat
;
792 list
= memcached_stat_get_keys(memc
, &stat
, &rc
);
793 assert(rc
== MEMCACHED_SUCCESS
);
794 for (ptr
= list
; *ptr
; ptr
++)
795 printf("Found key %s\n", *ptr
);
803 uint8_t get_stats(memcached_st
*memc
)
809 memcached_stat_st
*stat
;
811 stat
= memcached_stat(memc
, NULL
, &rc
);
812 assert(rc
== MEMCACHED_SUCCESS
);
814 assert(rc
== MEMCACHED_SUCCESS
);
817 for (x
= 0; x
< memcached_server_count(memc
); x
++)
819 list
= memcached_stat_get_keys(memc
, &stat
[x
], &rc
);
820 assert(rc
== MEMCACHED_SUCCESS
);
821 for (ptr
= list
; *ptr
; ptr
++)
822 printf("Found key %s\n", *ptr
);
827 memcached_stat_free(NULL
, stat
);
832 uint8_t add_host_test(memcached_st
*memc
)
835 memcached_server_st
*servers
;
837 char servername
[]= "0.example.com";
839 servers
= memcached_server_list_append(NULL
, servername
, 400, &rc
);
841 assert(1 == memcached_server_list_count(servers
));
843 for (x
= 2; x
< 20; x
++)
845 char buffer
[SMALL_STRING_LEN
];
847 snprintf(buffer
, SMALL_STRING_LEN
, "%u.example.com", 400+x
);
848 servers
= memcached_server_list_append(servers
, buffer
, 401,
850 assert(rc
== MEMCACHED_SUCCESS
);
851 assert(x
== memcached_server_list_count(servers
));
854 rc
= memcached_server_push(memc
, servers
);
855 assert(rc
== MEMCACHED_SUCCESS
);
856 rc
= memcached_server_push(memc
, servers
);
857 assert(rc
== MEMCACHED_SUCCESS
);
859 memcached_server_list_free(servers
);
864 /* We don't test the behavior itself, we test the switches */
865 uint8_t behavior_test(memcached_st
*memc
)
867 unsigned long long value
;
870 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
, &set
);
871 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
);
874 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
, &set
);
875 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
);
878 set
= MEMCACHED_HASH_MD5
;
879 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &set
);
880 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_HASH
);
881 assert(value
== MEMCACHED_HASH_MD5
);
885 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
, &set
);
886 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
);
889 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
, &set
);
890 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
);
893 set
= MEMCACHED_HASH_DEFAULT
;
894 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &set
);
895 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_HASH
);
896 assert(value
== MEMCACHED_HASH_DEFAULT
);
898 set
= MEMCACHED_HASH_CRC
;
899 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &set
);
900 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_HASH
);
901 assert(value
== MEMCACHED_HASH_CRC
);
903 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
);
906 value
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
);
912 /* Test case provided by Cal Haldenbrand */
913 uint8_t user_supplied_bug1(memcached_st
*memc
)
915 unsigned int setter
= 1;
918 unsigned long long total
= 0;
921 char randomstuff
[6 * 1024];
924 memset(randomstuff
, 0, 6 * 1024);
926 /* We just keep looking at the same values over and over */
929 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
, &setter
);
930 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
, &setter
);
934 for (x
= 0 ; total
< 20 * 1024576 ; x
++ )
938 size
= (rand() % ( 5 * 1024 ) ) + 400;
939 memset(randomstuff
, 0, 6 * 1024);
940 assert(size
< 6 * 1024); /* Being safe here */
942 for (j
= 0 ; j
< size
;j
++)
943 randomstuff
[j
] = (char) (rand() % 26) + 97;
946 sprintf(key
, "%d", x
);
947 rc
= memcached_set(memc
, key
, strlen(key
),
948 randomstuff
, strlen(randomstuff
), 10, 0);
949 /* If we fail, lets try again */
950 if (rc
!= MEMCACHED_SUCCESS
)
951 rc
= memcached_set(memc
, key
, strlen(key
),
952 randomstuff
, strlen(randomstuff
), 10, 0);
953 assert(rc
== MEMCACHED_SUCCESS
);
959 /* Test case provided by Cal Haldenbrand */
960 uint8_t user_supplied_bug2(memcached_st
*memc
)
965 unsigned long long total
;
968 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
, &setter
);
969 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
, &setter
);
971 setter
= 20 * 1024576;
972 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
, &setter
);
973 setter
= 20 * 1024576;
974 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
, &setter
);
975 getter
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
);
976 getter
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
);
978 for (x
= 0, errors
= 0, total
= 0 ; total
< 20 * 1024576 ; x
++)
981 for (x
= 0, errors
= 0, total
= 0 ; total
< 24576 ; x
++)
983 memcached_return rc
= MEMCACHED_SUCCESS
;
984 char buffer
[SMALL_STRING_LEN
];
989 memset(buffer
, 0, SMALL_STRING_LEN
);
991 snprintf(buffer
, SMALL_STRING_LEN
, "%u", x
);
992 getval
= memcached_get(memc
, buffer
, strlen(buffer
),
993 &val_len
, &flags
, &rc
);
994 if (rc
!= MEMCACHED_SUCCESS
)
996 if (rc
== MEMCACHED_NOTFOUND
)
1011 /* Do a large mget() over all the keys we think exist */
1012 #define KEY_COUNT 3000 // * 1024576
1013 uint8_t user_supplied_bug3(memcached_st
*memc
)
1015 memcached_return rc
;
1016 unsigned int setter
;
1019 size_t key_lengths
[KEY_COUNT
];
1022 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
, &setter
);
1023 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
, &setter
);
1025 setter
= 20 * 1024576;
1026 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
, &setter
);
1027 setter
= 20 * 1024576;
1028 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
, &setter
);
1029 getter
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE
);
1030 getter
= memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE
);
1033 keys
= (char **)malloc(sizeof(char *) * KEY_COUNT
);
1035 memset(keys
, 0, (sizeof(char *) * KEY_COUNT
));
1036 for (x
= 0; x
< KEY_COUNT
; x
++)
1040 snprintf(buffer
, 30, "%u", x
);
1041 keys
[x
]= strdup(buffer
);
1042 key_lengths
[x
]= strlen(keys
[x
]);
1045 rc
= memcached_mget(memc
, keys
, key_lengths
, KEY_COUNT
);
1046 assert(rc
== MEMCACHED_SUCCESS
);
1048 /* Turn this into a help function */
1050 char return_key
[MEMCACHED_MAX_KEY
];
1051 size_t return_key_length
;
1053 size_t return_value_length
;
1056 while ((return_value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1057 &return_value_length
, &flags
, &rc
)))
1059 assert(return_value
);
1060 assert(rc
== MEMCACHED_SUCCESS
);
1065 for (x
= 0; x
< KEY_COUNT
; x
++)
1072 /* Make sure we behave properly if server list has no values */
1073 uint8_t user_supplied_bug4(memcached_st
*memc
)
1075 memcached_return rc
;
1076 char *keys
[]= {"fudge", "son", "food"};
1077 size_t key_length
[]= {5, 3, 4};
1081 /* Here we free everything before running a bunch of mget tests */
1083 memcached_server_list_free(memc
->hosts
);
1085 memc
->number_of_hosts
= 0;
1088 char return_key
[MEMCACHED_MAX_KEY
];
1089 size_t return_key_length
;
1091 size_t return_value_length
;
1093 /* We need to empty the server before continueing test */
1094 rc
= memcached_flush(memc
, 0);
1095 assert(rc
== MEMCACHED_NO_SERVERS
);
1097 rc
= memcached_mget(memc
, keys
, key_length
, 3);
1098 assert(rc
== MEMCACHED_NO_SERVERS
);
1100 while ((return_value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1101 &return_value_length
, &flags
, &rc
)) != NULL
)
1103 assert(return_value
);
1105 assert(!return_value
);
1106 assert(return_value_length
== 0);
1107 assert(rc
== MEMCACHED_NO_SERVERS
);
1109 for (x
= 0; x
< 3; x
++)
1111 rc
= memcached_set(memc
, keys
[x
], key_length
[x
],
1112 keys
[x
], key_length
[x
],
1113 (time_t)50, (uint16_t)9);
1114 assert(rc
== MEMCACHED_NO_SERVERS
);
1117 rc
= memcached_mget(memc
, keys
, key_length
, 3);
1118 assert(rc
== MEMCACHED_NO_SERVERS
);
1121 while ((return_value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1122 &return_value_length
, &flags
, &rc
)))
1124 assert(return_value
);
1125 assert(rc
== MEMCACHED_SUCCESS
);
1126 assert(return_key_length
== return_value_length
);
1127 assert(!memcmp(return_value
, return_key
, return_value_length
));
1135 #define VALUE_SIZE_BUG5 1048064
1136 uint8_t user_supplied_bug5(memcached_st
*memc
)
1138 memcached_return rc
;
1139 char *keys
[]= {"036790384900", "036790384902", "036790384904", "036790384906"};
1140 size_t key_length
[]= {strlen("036790384900"), strlen("036790384902"), strlen("036790384904"), strlen("036790384906")};
1141 char return_key
[MEMCACHED_MAX_KEY
];
1142 size_t return_key_length
;
1144 size_t value_length
;
1148 char insert_data
[VALUE_SIZE_BUG5
];
1150 for (x
= 0; x
< VALUE_SIZE_BUG5
; x
++)
1151 insert_data
[x
]= rand();
1153 memcached_flush(memc
, 0);
1154 value
= memcached_get(memc
, keys
[0], key_length
[0],
1155 &value_length
, &flags
, &rc
);
1156 assert(value
== NULL
);
1157 rc
= memcached_mget(memc
, keys
, key_length
, 4);
1160 while ((value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1161 &value_length
, &flags
, &rc
)))
1165 for (x
= 0; x
< 4; x
++)
1167 rc
= memcached_set(memc
, keys
[x
], key_length
[x
],
1168 insert_data
, VALUE_SIZE_BUG5
,
1169 (time_t)0, (uint16_t)0);
1170 assert(rc
== MEMCACHED_SUCCESS
);
1173 for (x
= 0; x
< 10; x
++)
1175 value
= memcached_get(memc
, keys
[0], key_length
[0],
1176 &value_length
, &flags
, &rc
);
1180 rc
= memcached_mget(memc
, keys
, key_length
, 4);
1182 while ((value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1183 &value_length
, &flags
, &rc
)))
1194 uint8_t user_supplied_bug6(memcached_st
*memc
)
1196 memcached_return rc
;
1197 char *keys
[]= {"036790384900", "036790384902", "036790384904", "036790384906"};
1198 size_t key_length
[]= {strlen("036790384900"), strlen("036790384902"), strlen("036790384904"), strlen("036790384906")};
1199 char return_key
[MEMCACHED_MAX_KEY
];
1200 size_t return_key_length
;
1202 size_t value_length
;
1206 char insert_data
[VALUE_SIZE_BUG5
];
1208 for (x
= 0; x
< VALUE_SIZE_BUG5
; x
++)
1209 insert_data
[x
]= rand();
1211 memcached_flush(memc
, 0);
1212 value
= memcached_get(memc
, keys
[0], key_length
[0],
1213 &value_length
, &flags
, &rc
);
1214 assert(value
== NULL
);
1215 rc
= memcached_mget(memc
, keys
, key_length
, 4);
1218 while ((value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1219 &value_length
, &flags
, &rc
)))
1223 for (x
= 0; x
< 4; x
++)
1225 rc
= memcached_set(memc
, keys
[x
], key_length
[x
],
1226 insert_data
, VALUE_SIZE_BUG5
,
1227 (time_t)0, (uint16_t)0);
1228 assert(rc
== MEMCACHED_SUCCESS
);
1231 for (x
= 0; x
< 10; x
++)
1233 value
= memcached_get(memc
, keys
[0], key_length
[0],
1234 &value_length
, &flags
, &rc
);
1238 rc
= memcached_mget(memc
, keys
, key_length
, 4);
1240 /* We test for purge of partial complete fetches */
1241 for (count
= 3; count
; count
--)
1243 value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1244 &value_length
, &flags
, &rc
);
1246 assert(rc
== MEMCACHED_SUCCESS
);
1253 /* Test flag store/retrieve */
1254 uint8_t user_supplied_bug7(memcached_st
*memc
)
1256 memcached_return rc
;
1257 char *keys
= "036790384900";
1258 size_t key_length
= strlen("036790384900");
1259 char return_key
[MEMCACHED_MAX_KEY
];
1260 size_t return_key_length
;
1262 size_t value_length
;
1265 char insert_data
[VALUE_SIZE_BUG5
];
1267 for (x
= 0; x
< VALUE_SIZE_BUG5
; x
++)
1268 insert_data
[x
]= rand();
1270 memcached_flush(memc
, 0);
1273 rc
= memcached_set(memc
, keys
, key_length
,
1274 insert_data
, VALUE_SIZE_BUG5
,
1276 assert(rc
== MEMCACHED_SUCCESS
);
1279 value
= memcached_get(memc
, keys
, key_length
,
1280 &value_length
, &flags
, &rc
);
1281 assert(flags
== 245);
1285 rc
= memcached_mget(memc
, &keys
, &key_length
, 1);
1288 value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1289 &value_length
, &flags
, &rc
);
1290 assert(flags
== 245);
1298 uint8_t result_static(memcached_st
*memc
)
1300 memcached_result_st result
;
1301 memcached_result_st
*result_ptr
;
1303 result_ptr
= memcached_result_create(memc
, &result
);
1304 assert(result
.is_allocated
== MEMCACHED_NOT_ALLOCATED
);
1306 memcached_result_free(&result
);
1311 uint8_t result_alloc(memcached_st
*memc
)
1313 memcached_result_st
*result
;
1315 result
= memcached_result_create(memc
, NULL
);
1317 memcached_result_free(result
);
1322 uint8_t string_static_null(memcached_st
*memc
)
1324 memcached_string_st string
;
1325 memcached_string_st
*string_ptr
;
1327 string_ptr
= memcached_string_create(memc
, &string
, 0);
1328 assert(string
.is_allocated
== MEMCACHED_NOT_ALLOCATED
);
1330 memcached_string_free(&string
);
1335 uint8_t string_alloc_null(memcached_st
*memc
)
1337 memcached_string_st
*string
;
1339 string
= memcached_string_create(memc
, NULL
, 0);
1341 memcached_string_free(string
);
1346 uint8_t string_alloc_with_size(memcached_st
*memc
)
1348 memcached_string_st
*string
;
1350 string
= memcached_string_create(memc
, NULL
, 1024);
1352 memcached_string_free(string
);
1357 uint8_t string_alloc_with_size_toobig(memcached_st
*memc
)
1359 memcached_string_st
*string
;
1361 string
= memcached_string_create(memc
, NULL
, INT64_MAX
);
1362 assert(string
== NULL
);
1367 uint8_t string_alloc_append(memcached_st
*memc
)
1370 char buffer
[SMALL_STRING_LEN
];
1371 memcached_string_st
*string
;
1373 /* Ring the bell! */
1374 memset(buffer
, 6, SMALL_STRING_LEN
);
1376 string
= memcached_string_create(memc
, NULL
, 100);
1379 for (x
= 0; x
< 1024; x
++)
1381 memcached_return rc
;
1382 rc
= memcached_string_append(string
, buffer
, SMALL_STRING_LEN
);
1383 assert(rc
== MEMCACHED_SUCCESS
);
1385 memcached_string_free(string
);
1390 uint8_t string_alloc_append_toobig(memcached_st
*memc
)
1392 memcached_return rc
;
1394 char buffer
[SMALL_STRING_LEN
];
1395 memcached_string_st
*string
;
1397 /* Ring the bell! */
1398 memset(buffer
, 6, SMALL_STRING_LEN
);
1400 string
= memcached_string_create(memc
, NULL
, 100);
1403 for (x
= 0; x
< 1024; x
++)
1405 rc
= memcached_string_append(string
, buffer
, SMALL_STRING_LEN
);
1406 assert(rc
== MEMCACHED_SUCCESS
);
1408 rc
= memcached_string_append(string
, buffer
, INT64_MAX
);
1409 assert(rc
== MEMCACHED_MEMORY_ALLOCATION_FAILURE
);
1410 memcached_string_free(string
);
1415 uint8_t generate_data(memcached_st
*memc
)
1417 unsigned long long x
;
1418 global_pairs
= pairs_generate(GLOBAL_COUNT
);
1419 execute_set(memc
, global_pairs
, GLOBAL_COUNT
);
1421 for (x
= 0; x
< GLOBAL_COUNT
; x
++)
1423 global_keys
[x
]= global_pairs
[x
].key
;
1424 global_keys_length
[x
]= global_pairs
[x
].key_length
;
1430 uint8_t get_read(memcached_st
*memc
)
1433 memcached_return rc
;
1437 size_t return_value_length
;
1440 for (x
= 0; x
< GLOBAL_COUNT
; x
++)
1442 return_value
= memcached_get(memc
, global_keys
[x
], global_keys_length
[x
],
1443 &return_value_length
, &flags
, &rc
);
1445 assert(return_value);
1446 assert(rc == MEMCACHED_SUCCESS);
1448 if (rc
== MEMCACHED_SUCCESS
&& return_value
)
1456 uint8_t mget_read(memcached_st
*memc
)
1458 memcached_return rc
;
1460 rc
= memcached_mget(memc
, global_keys
, global_keys_length
, GLOBAL_COUNT
);
1461 assert(rc
== MEMCACHED_SUCCESS
);
1462 /* Turn this into a help function */
1464 char return_key
[MEMCACHED_MAX_KEY
];
1465 size_t return_key_length
;
1467 size_t return_value_length
;
1470 while ((return_value
= memcached_fetch(memc
, return_key
, &return_key_length
,
1471 &return_value_length
, &flags
, &rc
)))
1473 assert(return_value
);
1474 assert(rc
== MEMCACHED_SUCCESS
);
1482 uint8_t mget_read_result(memcached_st
*memc
)
1484 memcached_return rc
;
1486 rc
= memcached_mget(memc
, global_keys
, global_keys_length
, GLOBAL_COUNT
);
1487 assert(rc
== MEMCACHED_SUCCESS
);
1488 /* Turn this into a help function */
1490 memcached_result_st results_obj
;
1491 memcached_result_st
*results
;
1493 results
= memcached_result_create(memc
, &results_obj
);
1495 while ((results
= memcached_fetch_result(memc
, &results_obj
, &rc
)))
1498 assert(rc
== MEMCACHED_SUCCESS
);
1501 memcached_result_free(&results_obj
);
1507 uint8_t free_data(memcached_st
*memc
)
1509 pairs_free(global_pairs
);
1514 uint8_t add_host_test1(memcached_st
*memc
)
1517 memcached_return rc
;
1518 char servername
[]= "0.example.com";
1519 memcached_server_st
*servers
;
1521 servers
= memcached_server_list_append(NULL
, servername
, 400, &rc
);
1523 assert(1 == memcached_server_list_count(servers
));
1525 for (x
= 2; x
< 20; x
++)
1527 char buffer
[SMALL_STRING_LEN
];
1529 snprintf(buffer
, SMALL_STRING_LEN
, "%u.example.com", 400+x
);
1530 servers
= memcached_server_list_append(servers
, buffer
, 401,
1532 assert(rc
== MEMCACHED_SUCCESS
);
1533 assert(x
== memcached_server_list_count(servers
));
1536 rc
= memcached_server_push(memc
, servers
);
1537 assert(rc
== MEMCACHED_SUCCESS
);
1538 rc
= memcached_server_push(memc
, servers
);
1539 assert(rc
== MEMCACHED_SUCCESS
);
1541 memcached_server_list_free(servers
);
1546 memcached_return
pre_nonblock(memcached_st
*memc
)
1548 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
, NULL
);
1550 return MEMCACHED_SUCCESS
;
1553 memcached_return
pre_md5(memcached_st
*memc
)
1555 memcached_hash value
= MEMCACHED_HASH_MD5
;
1556 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &value
);
1558 return MEMCACHED_SUCCESS
;
1561 memcached_return
pre_crc(memcached_st
*memc
)
1563 memcached_hash value
= MEMCACHED_HASH_CRC
;
1564 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &value
);
1566 return MEMCACHED_SUCCESS
;
1569 memcached_return
pre_hash_fnv1_64(memcached_st
*memc
)
1571 memcached_hash value
= MEMCACHED_HASH_FNV1_64
;
1572 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &value
);
1574 return MEMCACHED_SUCCESS
;
1577 memcached_return
pre_hash_fnv1a_64(memcached_st
*memc
)
1579 memcached_hash value
= MEMCACHED_HASH_FNV1A_64
;
1580 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &value
);
1582 return MEMCACHED_SUCCESS
;
1585 memcached_return
pre_hash_fnv1_32(memcached_st
*memc
)
1587 memcached_hash value
= MEMCACHED_HASH_FNV1_32
;
1588 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &value
);
1590 return MEMCACHED_SUCCESS
;
1593 memcached_return
pre_hash_fnv1a_32(memcached_st
*memc
)
1595 memcached_hash value
= MEMCACHED_HASH_FNV1A_32
;
1596 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &value
);
1598 return MEMCACHED_SUCCESS
;
1601 memcached_return
pre_hash_ketama(memcached_st
*memc
)
1603 memcached_hash value
= MEMCACHED_HASH_KETAMA
;
1604 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_HASH
, &value
);
1606 return MEMCACHED_SUCCESS
;
1609 memcached_return
enable_cas(memcached_st
*memc
)
1611 unsigned int set
= 1;
1613 memcached_version(memc
);
1615 if (memc
->hosts
[0].major_version
>= 1 &&
1616 memc
->hosts
[0].minor_version
>= 2 &&
1617 memc
->hosts
[0].micro_version
>= 4)
1619 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_SUPPORT_CAS
, &set
);
1621 return MEMCACHED_SUCCESS
;
1624 return MEMCACHED_FAILURE
;
1627 memcached_return
check_for_1_2_3(memcached_st
*memc
)
1629 memcached_version(memc
);
1631 if (memc
->hosts
[0].major_version
>= 1 &&
1632 memc
->hosts
[0].minor_version
>= 2 &&
1633 memc
->hosts
[0].micro_version
>= 4)
1634 return MEMCACHED_SUCCESS
;
1636 return MEMCACHED_FAILURE
;
1639 memcached_return
pre_unix_socket(memcached_st
*memc
)
1641 memcached_return rc
;
1644 memcached_server_list_free(memc
->hosts
);
1646 memc
->number_of_hosts
= 0;
1648 if (stat("/tmp/memcached.socket", &buf
))
1649 return MEMCACHED_FAILURE
;
1651 rc
= memcached_server_add_unix_socket(memc
, "/tmp/memcached.socket");
1656 memcached_return
pre_udp(memcached_st
*memc
)
1658 memcached_return rc
;
1660 memcached_server_list_free(memc
->hosts
);
1662 memc
->number_of_hosts
= 0;
1665 return MEMCACHED_FAILURE
;
1667 rc
= memcached_server_add_udp(memc
, "localhost", MEMCACHED_DEFAULT_PORT
);
1672 memcached_return
pre_nodelay(memcached_st
*memc
)
1674 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_NO_BLOCK
, NULL
);
1675 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_TCP_NODELAY
, NULL
);
1677 return MEMCACHED_SUCCESS
;
1680 memcached_return
poll_timeout(memcached_st
*memc
)
1686 memcached_behavior_set(memc
, MEMCACHED_BEHAVIOR_POLL_TIMEOUT
, &timeout
);
1688 timeout
= (int32_t)memcached_behavior_get(memc
, MEMCACHED_BEHAVIOR_POLL_TIMEOUT
);
1690 assert(timeout
== 100);
1692 return MEMCACHED_SUCCESS
;
1696 /* Clean the server before beginning testing */
1698 {"flush", 0, flush_test
},
1699 {"init", 0, init_test
},
1700 {"allocation", 0, allocation_test
},
1701 {"clone_test", 0, clone_test
},
1702 {"error", 0, error_test
},
1703 {"set", 0, set_test
},
1704 {"set2", 0, set_test2
},
1705 {"set3", 0, set_test3
},
1706 {"add", 0, add_test
},
1707 {"replace", 0, replace_test
},
1708 {"delete", 1, delete_test
},
1709 {"get", 1, get_test
},
1710 {"get2", 0, get_test2
},
1711 {"get3", 0, get_test3
},
1712 {"get4", 0, get_test4
},
1713 {"stats_servername", 0, stats_servername_test
},
1714 {"increment", 0, increment_test
},
1715 {"decrement", 0, decrement_test
},
1716 {"quit", 0, quit_test
},
1717 {"mget", 1, mget_test
},
1718 {"mget_result", 1, mget_result_test
},
1719 {"mget_result_alloc", 1, mget_result_alloc_test
},
1720 {"get_stats", 0, get_stats
},
1721 {"add_host_test", 0, add_host_test
},
1722 {"get_stats_keys", 0, get_stats_keys
},
1723 {"behavior_test", 0, get_stats_keys
},
1727 test_st string_tests
[] ={
1728 {"string static with null", 0, string_static_null
},
1729 {"string alloc with null", 0, string_alloc_null
},
1730 {"string alloc with 1K", 0, string_alloc_with_size
},
1731 {"string alloc with malloc failure", 0, string_alloc_with_size_toobig
},
1732 {"string append", 0, string_alloc_append
},
1733 {"string append failure (too big)", 0, string_alloc_append_toobig
},
1737 test_st result_tests
[] ={
1738 {"result static", 0, result_static
},
1739 {"result alloc", 0, result_alloc
},
1743 test_st version_1_2_3
[] ={
1744 {"append", 0, append_test
},
1745 {"prepend", 0, prepend_test
},
1746 {"cas", 0, cas_test
},
1747 {"cas2", 0, cas2_test
},
1748 {"append_binary", 0, append_binary_test
},
1752 test_st user_tests
[] ={
1753 {"user_supplied_bug1", 0, user_supplied_bug1
},
1754 {"user_supplied_bug2", 0, user_supplied_bug2
},
1755 {"user_supplied_bug3", 0, user_supplied_bug3
},
1756 {"user_supplied_bug4", 0, user_supplied_bug4
},
1757 {"user_supplied_bug5", 1, user_supplied_bug5
},
1758 {"user_supplied_bug6", 1, user_supplied_bug6
},
1759 {"user_supplied_bug7", 1, user_supplied_bug7
},
1763 test_st generate_tests
[] ={
1764 {"generate_data", 0, generate_data
},
1765 {"get_read", 0, get_read
},
1766 {"mget_read", 0, mget_read
},
1767 {"mget_read_result", 0, mget_read_result
},
1772 collection_st collection
[] ={
1773 {"block", 0, 0, tests
},
1774 {"nonblock", pre_nonblock
, 0, tests
},
1775 {"nodelay", pre_nodelay
, 0, tests
},
1776 {"md5", pre_md5
, 0, tests
},
1777 {"crc", pre_crc
, 0, tests
},
1778 {"fnv1_64", pre_hash_fnv1_64
, 0, tests
},
1779 {"fnv1a_64", pre_hash_fnv1a_64
, 0, tests
},
1780 {"fnv1_32", pre_hash_fnv1_32
, 0, tests
},
1781 {"fnv1a_32", pre_hash_fnv1a_32
, 0, tests
},
1782 {"ketama", pre_hash_ketama
, 0, tests
},
1783 {"unix_socket", pre_unix_socket
, 0, tests
},
1784 {"unix_socket_nodelay", pre_nodelay
, 0, tests
},
1785 {"poll_timeout", poll_timeout
, 0, tests
},
1786 {"gets", enable_cas
, 0, tests
},
1787 // {"udp", pre_udp, 0, tests},
1788 {"version_1_2_3", check_for_1_2_3
, 0, version_1_2_3
},
1789 {"string", 0, 0, string_tests
},
1790 {"result", 0, 0, result_tests
},
1791 {"user", 0, 0, user_tests
},
1792 {"generate", 0, 0, generate_tests
},
1793 {"generate_nonblock", pre_nonblock
, 0, generate_tests
},
1797 collection_st
*gets_collections(void)