X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Flibmemcached-1.0%2Fmem_functions.cc;h=2155f7f3157c1130edd81d6065f52de07be129ae;hb=3db2fad1ae84c7235507bf1adf471461856ddee4;hp=9fdf6bf3fdd934990ac415bf239d447ce84dddde;hpb=d40eca3b5b67ef4403f92254e8c6d0253da62553;p=awesomized%2Flibmemcached diff --git a/tests/libmemcached-1.0/mem_functions.cc b/tests/libmemcached-1.0/mem_functions.cc index 9fdf6bf3..2155f7f3 100644 --- a/tests/libmemcached-1.0/mem_functions.cc +++ b/tests/libmemcached-1.0/mem_functions.cc @@ -598,7 +598,7 @@ test_return_t append_binary_test(memcached_st *memc) test_compare(value_length, sizeof(uint32_t) * count); test_compare(MEMCACHED_SUCCESS, rc); - for (uint32_t counter= count, *ptr= value; counter; counter--) + for (uint32_t counter= uint32_t(count), *ptr= value; counter; counter--) { test_compare(*ptr, store_list[count - counter]); ptr++; @@ -644,7 +644,7 @@ test_return_t memcached_mget_mixed_memcached_get_TEST(memcached_st *memc) } else { - int which_key= random() %keys.size(); + int which_key= random() % int(keys.size()); size_t value_length; uint32_t flags; memcached_return_t rc; @@ -1754,6 +1754,11 @@ test_return_t block_add_regression(memcached_st *memc) global_pairs[x].key, global_pairs[x].key_length, &blob[0], blob.size(), time_t(0), uint32_t(0)); + if (rc == MEMCACHED_MEMORY_ALLOCATION_FAILURE) + { + Error << memcached_last_error_message(memc); + return TEST_SKIPPED; + } test_compare(*memc, MEMCACHED_SUCCESS); test_compare(rc, MEMCACHED_SUCCESS); } @@ -2629,7 +2634,7 @@ test_return_t user_supplied_bug20(memcached_st *memc) */ /* sighandler_t function that always asserts false */ -static void fail(int) +static __attribute__((noreturn)) void fail(int) { fatal_assert(0); } @@ -3162,7 +3167,7 @@ test_return_t noreply_test(memcached_st *memc) for (size_t x= 0; x < 100; ++x) { char key[MEMCACHED_MAXIMUM_INTEGER_DISPLAY_LENGTH +1]; - int check_length= (size_t)snprintf(key, sizeof(key), "%lu", (unsigned long)x); + int check_length= snprintf(key, sizeof(key), "%lu", (unsigned long)x); test_false((size_t)check_length >= sizeof(key) || check_length < 0); size_t len= (size_t)check_length; @@ -3217,7 +3222,7 @@ test_return_t noreply_test(memcached_st *memc) { char key[10]; - int check_length= (size_t)snprintf(key, sizeof(key), "%lu", (unsigned long)x); + int check_length= snprintf(key, sizeof(key), "%lu", (unsigned long)x); test_false((size_t)check_length >= sizeof(key) || check_length < 0); @@ -3312,7 +3317,7 @@ test_return_t analyzer_test(memcached_st *memc) test_return_t util_version_test(memcached_st *memc) { - test_compare(MEMCACHED_SUCCESS, memcached_version(memc)); + test_compare(memcached_version(memc), MEMCACHED_SUCCESS); test_true(libmemcached_util_version_check(memc, 0, 0, 0)); bool if_successful= libmemcached_util_version_check(memc, 9, 9, 9); @@ -4474,6 +4479,27 @@ test_return_t regression_bug_490486(memcached_st *original_memc) return TEST_SUCCESS; } +test_return_t regression_1021819_TEST(memcached_st *original) +{ + memcached_st *memc= memcached_clone(NULL, original); + test_true(memc); + + test_compare(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SND_TIMEOUT, 2000000), MEMCACHED_SUCCESS); + test_compare(memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_RCV_TIMEOUT, 3000000), MEMCACHED_SUCCESS); + + memcached_return_t rc; + + memcached_get(memc, + test_literal_param(__func__), + NULL, NULL, &rc); + + test_compare(rc, MEMCACHED_NOTFOUND); + + memcached_free(memc); + + return TEST_SUCCESS; +} + test_return_t regression_bug_583031(memcached_st *) { memcached_st *memc= memcached_create(NULL);