X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Ffunction.c;h=bcf08fe6c8cdd54dd586830204b2ca2568c81b6a;hb=7da8c66e35fdba886b69a2cf063044d9c451f22a;hp=2258757d646981c1d9dc537b29ef0f37f09ac447;hpb=51aa1233e4981967f06dd3432cd3a6ed83a35607;p=m6w6%2Flibmemcached diff --git a/tests/function.c b/tests/function.c index 2258757d..bcf08fe6 100644 --- a/tests/function.c +++ b/tests/function.c @@ -2,7 +2,6 @@ Sample test application. */ #include -#include #include #include #include @@ -12,9 +11,8 @@ #include #include #include "server.h" -#include "../lib/common.h" -#include "../src/generator.h" -#include "../src/execute.h" +#include "../clients/generator.h" +#include "../clients/execute.h" #ifndef INT64_MAX #define INT64_MAX LONG_MAX @@ -1835,6 +1833,46 @@ uint8_t user_supplied_bug14(memcached_st *memc) return 0; } +/* + Look for zero length value problems + */ +uint8_t user_supplied_bug15(memcached_st *memc) +{ + uint32_t x; + memcached_return rc; + char *key= "mykey"; + char *value; + size_t length; + uint32_t flags; + + for (x= 0; x < 2; x++) + { + rc= memcached_set(memc, key, strlen(key), + NULL, 0, + (time_t)0, (uint32_t)0); + + assert(rc == MEMCACHED_SUCCESS); + + value= memcached_get(memc, key, strlen(key), + &length, &flags, &rc); + + assert(rc == MEMCACHED_SUCCESS); + assert(value == NULL); + assert(length == 0); + assert(flags == 0); + + value= memcached_get(memc, key, strlen(key), + &length, &flags, &rc); + + assert(rc == MEMCACHED_SUCCESS); + assert(value == NULL); + assert(length == 0); + assert(flags == 0); + } + + return 0; +} + uint8_t result_static(memcached_st *memc) { memcached_result_st result; @@ -2174,66 +2212,65 @@ memcached_return pre_nonblock(memcached_st *memc) return MEMCACHED_SUCCESS; } +memcached_return pre_murmur(memcached_st *memc) +{ + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_MURMUR); + + return MEMCACHED_SUCCESS; +} + memcached_return pre_md5(memcached_st *memc) { - memcached_hash value= MEMCACHED_HASH_MD5; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_MD5); return MEMCACHED_SUCCESS; } memcached_return pre_crc(memcached_st *memc) { - memcached_hash value= MEMCACHED_HASH_CRC; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_CRC); return MEMCACHED_SUCCESS; } memcached_return pre_hsieh(memcached_st *memc) { - memcached_hash value= MEMCACHED_HASH_HSIEH; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_HSIEH); return MEMCACHED_SUCCESS; } memcached_return pre_hash_fnv1_64(memcached_st *memc) { - memcached_hash value= MEMCACHED_HASH_FNV1_64; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_FNV1_64); return MEMCACHED_SUCCESS; } memcached_return pre_hash_fnv1a_64(memcached_st *memc) { - memcached_hash value= MEMCACHED_HASH_FNV1A_64; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_FNV1A_64); return MEMCACHED_SUCCESS; } memcached_return pre_hash_fnv1_32(memcached_st *memc) { - memcached_hash value= MEMCACHED_HASH_FNV1_32; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_FNV1_32); return MEMCACHED_SUCCESS; } memcached_return pre_hash_fnv1a_32(memcached_st *memc) { - memcached_hash value= MEMCACHED_HASH_FNV1A_32; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_FNV1A_32); return MEMCACHED_SUCCESS; } memcached_return pre_hash_ketama(memcached_st *memc) { - memcached_hash value= MEMCACHED_HASH_KETAMA; - memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, value); + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_KETAMA); return MEMCACHED_SUCCESS; } @@ -2478,6 +2515,7 @@ test_st user_tests[] ={ {"user_supplied_bug12", 1, user_supplied_bug12 }, {"user_supplied_bug13", 1, user_supplied_bug13 }, {"user_supplied_bug14", 1, user_supplied_bug14 }, + {"user_supplied_bug15", 1, user_supplied_bug15 }, {0, 0, 0} }; @@ -2529,6 +2567,7 @@ collection_st collection[] ={ {"generate_hsieh", pre_hsieh, 0, generate_tests}, {"generate_hsieh_consistent", enable_consistent, 0, generate_tests}, {"generate_md5", pre_md5, 0, generate_tests}, + {"generate_murmur", pre_murmur, 0, generate_tests}, {"generate_nonblock", pre_nonblock, 0, generate_tests}, {0, 0, 0, 0} };