X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Fmem_functions.c;h=72b3b193be0d5fec3c05938544308952fc1e63a0;hb=dc421179c0d159f1ca8a6b2b64b89163a7e0c639;hp=e3f6426a9ecd692352a97d809451e703b6b3ea96;hpb=de46e62fe493ce152e1804feec0d19d5d0cfaa9f;p=m6w6%2Flibmemcached diff --git a/tests/mem_functions.c b/tests/mem_functions.c index e3f6426a..72b3b193 100644 --- a/tests/mem_functions.c +++ b/tests/mem_functions.c @@ -35,6 +35,7 @@ #include #include "tests/parser.h" +#include "tests/pool.h" #include "tests/string.h" #include "tests/replication.h" #include "tests/basic.h" @@ -231,7 +232,12 @@ static memcached_return_t server_display_unsort_function(const memcached_st *ptr uint32_t x= *((uint32_t *)(context)); (void)ptr; - assert(test_ports[x] == server->port); + if (! (test_ports[x] == server->port)) + { + fprintf(stderr, "%lu -> %lu\n", (unsigned long)test_ports[x], (unsigned long)server->port); + return MEMCACHED_FAILURE; + } + *((uint32_t *)(context))= ++x; return MEMCACHED_SUCCESS; @@ -314,8 +320,6 @@ static test_return_t clone_test(memcached_st *memc) { // Test all of the flags test_true(memc_clone->flags.no_block == memc->flags.no_block); test_true(memc_clone->flags.tcp_nodelay == memc->flags.tcp_nodelay); - test_true(memc_clone->flags.reuse_memory == memc->flags.reuse_memory); - test_true(memc_clone->flags.use_cache_lookups == memc->flags.use_cache_lookups); test_true(memc_clone->flags.support_cas == memc->flags.support_cas); test_true(memc_clone->flags.buffer_requests == memc->flags.buffer_requests); test_true(memc_clone->flags.use_sort_hosts == memc->flags.use_sort_hosts); @@ -405,7 +409,7 @@ static test_return_t error_test(memcached_st *memc) 54481931U, 4186304426U, 1741088401U, 2979625118U, 4159057246U, 3425930182U, 2593724503U, 1868899624U, 1769812374U, 2302537950U, 1110330676U, 3365377466U, - 1336171666U, 3365377466U }; + 1336171666U, 3021258493U, 3365377466U }; // You have updated the memcache_error messages but not updated docs/tests. for (rc= MEMCACHED_SUCCESS; rc < MEMCACHED_MAXIMUM_RETURN; rc++) @@ -421,7 +425,7 @@ static test_return_t error_test(memcached_st *memc) } test_true(values[rc] == hash_val); } - test_true(MEMCACHED_MAXIMUM_RETURN == 45); + test_true(MEMCACHED_MAXIMUM_RETURN == 46); return TEST_SUCCESS; } @@ -2000,21 +2004,15 @@ static test_return_t MEMCACHED_BEHAVIOR_CORK_test(memcached_st *memc) { memcached_return_t rc; bool set= true; - bool value; rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_CORK, set); - test_true(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_NOT_SUPPORTED); - - value= (bool)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_CORK); + test_true(rc == MEMCACHED_DEPRECATED); - if (rc == MEMCACHED_SUCCESS) - { - test_true((bool)value == set); - } - else - { - test_false((bool)value == set); - } + // Platform dependent +#if 0 + bool value= (bool)memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_CORK); + test_false(value); +#endif return TEST_SUCCESS; } @@ -5477,7 +5475,7 @@ static test_return_t test_cull_servers(memcached_st *memc) uint32_t count = memcached_server_count(memc); // Do not do this in your code, it is not supported. - memc->servers[1].state.is_dead= true; + memc->servers[1].options.is_dead= true; memc->state.is_time_for_rebuild= true; uint32_t new_count= memcached_server_count(memc); @@ -5752,7 +5750,7 @@ static test_return_t regression_bug_583031(memcached_st *unused) (void)memcached_get(memc, "dsf", 3, &length, &flags, &rc); - test_true_got(rc == MEMCACHED_TIMEOUT || rc == MEMCACHED_ERRNO, memcached_strerror(memc, rc)); + test_true_got(rc == MEMCACHED_TIMEOUT || rc == MEMCACHED_ERRNO || rc == MEMCACHED_FAILURE, memcached_strerror(memc, rc)); memcached_free(memc); @@ -5983,10 +5981,9 @@ test_st tests[] ={ {"delete_through", 1, (test_callback_fn)delete_through }, {"noreply", 1, (test_callback_fn)noreply_test}, {"analyzer", 1, (test_callback_fn)analyzer_test}, -#ifdef HAVE_LIBMEMCACHEDUTIL {"connectionpool", 1, (test_callback_fn)connection_pool_test }, + {"memcached_pool_test", 1, (test_callback_fn)memcached_pool_test }, {"ping", 1, (test_callback_fn)ping_test }, -#endif {"test_get_last_disconnect", 1, (test_callback_fn)test_get_last_disconnect}, {"verbosity", 1, (test_callback_fn)test_verbosity}, {"test_server_failure", 1, (test_callback_fn)test_server_failure}, @@ -6220,12 +6217,12 @@ test_st parser_tests[] ={ {"hash", 0, (test_callback_fn)parser_hash_test }, {"libmemcached_check_configuration", 0, (test_callback_fn)libmemcached_check_configuration_test }, {"libmemcached_check_configuration_with_filename", 0, (test_callback_fn)libmemcached_check_configuration_with_filename_test }, - {"memcached_parse_configure_file", 0, (test_callback_fn)memcached_parse_configure_file_test }, {"number_options", 0, (test_callback_fn)parser_number_options_test }, {"randomly generated options", 0, (test_callback_fn)random_statement_build_test }, {"prefix_key", 0, (test_callback_fn)parser_key_prefix_test }, {"server", 0, (test_callback_fn)server_test }, - {"servers", 0, (test_callback_fn)servers_test }, + {"bad server strings", 0, (test_callback_fn)servers_bad_test }, + {"server with weights", 0, (test_callback_fn)server_with_weight_test }, {0, 0, (test_callback_fn)0} }; @@ -6302,8 +6299,6 @@ collection_st collection[] ={ {0, 0, 0, 0} }; -#define SERVERS_TO_CREATE 5 - #include "libmemcached_world.h" void get_world(world_st *world)