X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Ffunction.c;h=7d2de7032d281f8cf439426d5ace817d0d2ffa6a;hb=3bcf5c0efffbf64b6b6eccf140f057d2373fa974;hp=d5291eae3c72fbc7fe67761555bf5264d00a9b65;hpb=27ed7884526a4cf01d57437648c20e59caffefa2;p=m6w6%2Flibmemcached diff --git a/tests/function.c b/tests/function.c index d5291eae..7d2de703 100644 --- a/tests/function.c +++ b/tests/function.c @@ -992,6 +992,65 @@ uint8_t user_supplied_bug5(memcached_st *memc) return 0; } +uint8_t user_supplied_bug6(memcached_st *memc) +{ + memcached_return rc; + char *keys[]= {"036790384900", "036790384902", "036790384904", "036790384906"}; + size_t key_length[]= {strlen("036790384900"), strlen("036790384902"), strlen("036790384904"), strlen("036790384906")}; + char return_key[MEMCACHED_MAX_KEY]; + size_t return_key_length; + char *value; + size_t value_length; + uint16_t flags; + unsigned int count; + unsigned int x; + char insert_data[VALUE_SIZE_BUG5]; + + for (x= 0; x < VALUE_SIZE_BUG5; x++) + insert_data[x]= rand(); + + memcached_flush(memc, 0); + value= memcached_get(memc, keys[0], key_length[0], + &value_length, &flags, &rc); + assert(value == NULL); + rc= memcached_mget(memc, keys, key_length, 4); + + count= 0; + while ((value= memcached_fetch(memc, return_key, &return_key_length, + &value_length, &flags, &rc))) + count++; + assert(count == 0); + + for (x= 0; x < 4; x++) + { + rc= memcached_set(memc, keys[x], key_length[x], + insert_data, VALUE_SIZE_BUG5, + (time_t)0, (uint16_t)0); + assert(rc == MEMCACHED_SUCCESS); + } + + for (x= 0; x < 10; x++) + { + value= memcached_get(memc, keys[0], key_length[0], + &value_length, &flags, &rc); + assert(value); + free(value); + + rc= memcached_mget(memc, keys, key_length, 4); + count= 3; + /* We test for purge of partial complete fetches */ + for (count= 3; count; count--) + { + value= memcached_fetch(memc, return_key, &return_key_length, + &value_length, &flags, &rc); + free(value); + assert(rc == MEMCACHED_SUCCESS); + } + } + + return 0; +} + uint8_t result_static(memcached_st *memc) { memcached_result_st result; @@ -1320,6 +1379,22 @@ memcached_return pre_unix_socket(memcached_st *memc) return rc; } +memcached_return pre_udp(memcached_st *memc) +{ + memcached_return rc; + + memcached_server_list_free(memc->hosts); + memc->hosts= NULL; + memc->number_of_hosts= 0; + + if (0) + return MEMCACHED_FAILURE; + + rc= memcached_server_add_udp(memc, "localhost", MEMCACHED_DEFAULT_PORT); + + return rc; +} + memcached_return pre_nodelay(memcached_st *memc) { memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, NULL); @@ -1382,6 +1457,7 @@ test_st user_tests[] ={ {"user_supplied_bug3", 0, user_supplied_bug3 }, {"user_supplied_bug4", 0, user_supplied_bug4 }, {"user_supplied_bug5", 1, user_supplied_bug5 }, + {"user_supplied_bug6", 1, user_supplied_bug6 }, {0, 0, 0} }; @@ -1407,6 +1483,7 @@ collection_st collection[] ={ {"ketama", pre_hash_ketama, 0, tests}, {"unix_socket", pre_unix_socket, 0, tests}, {"unix_socket_nodelay", pre_nodelay, 0, tests}, +// {"udp", pre_udp, 0, tests}, {"string", 0, 0, string_tests}, {"result", 0, 0, result_tests}, {"user", 0, 0, user_tests},