X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=tests%2Fdebug.cc;h=5e72a0b6b52bf5c0496fa9797906f4d1d3653ecf;hb=15cb8f72fc3382dd80a88028cf45c05dcb2fa1ef;hp=4ba46eaed4c3b1f0d015a2952e17eeb17fbf56ca;hpb=04b8554c3724eae57fbd75dc6b3e69dca8b58187;p=m6w6%2Flibmemcached diff --git a/tests/debug.cc b/tests/debug.cc index 4ba46eae..5e72a0b6 100644 --- a/tests/debug.cc +++ b/tests/debug.cc @@ -44,6 +44,7 @@ using namespace libtest; #include #include +#include /* Dump each server's keys */ static memcached_return_t print_keys_callback(const memcached_st *, @@ -96,7 +97,7 @@ static memcached_return_t server_wrapper_for_dump_callback(const memcached_st *, } -test_return_t confirm_keys_exist(memcached_st *memc, const char * const *keys, const size_t number_of_keys, bool key_matches_value) +test_return_t confirm_keys_exist(memcached_st *memc, const char * const *keys, const size_t number_of_keys, bool key_matches_value, bool require_all) { for (size_t x= 0; x < number_of_keys; ++x) { @@ -106,12 +107,27 @@ test_return_t confirm_keys_exist(memcached_st *memc, const char * const *keys, c test_string_make_from_cstr(keys[x]), // Keys &value_length, 0, &rc); - test_true_got(value, keys[x]); - if (key_matches_value) + if (require_all) { - test_strcmp(keys[x], value); + test_true_got(value, keys[x]); + if (key_matches_value) + { + test_strcmp(keys[x], value); + } + } + else if (memcached_success(rc)) + { + test_warn_hint(value, keys[x]); + if (value and key_matches_value) + { + test_strcmp(keys[x], value); + } + } + + if (value) + { + free(value); } - free(value); } return TEST_SUCCESS; @@ -179,3 +195,10 @@ size_t confirm_key_count(memcached_st *memc) memcached_free(clone); return count; } + +void print_servers(memcached_st *memc) +{ + memcached_server_fn callbacks[1]; + callbacks[0]= server_print_callback; + memcached_server_cursor(memc, callbacks, NULL, 1); +}