From: Trond Norbye Date: Tue, 6 Jan 2009 13:27:05 +0000 (+0100) Subject: Run the async tests on the binary protocol as well X-Git-Tag: 0.26~26^2~1 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=d8b43c1e7767621b4b492629b12090ee33f00d52;p=m6w6%2Flibmemcached Run the async tests on the binary protocol as well --- diff --git a/tests/function.c b/tests/function.c index 91b64352..deccab14 100644 --- a/tests/function.c +++ b/tests/function.c @@ -2605,6 +2605,29 @@ static memcached_return pre_nonblock(memcached_st *memc) return MEMCACHED_SUCCESS; } +static memcached_return pre_nonblock_binary(memcached_st *memc) +{ + memcached_return rc= MEMCACHED_FAILURE; + memcached_st *clone; + + clone= memcached_clone(NULL, memc); + assert(clone); + // The memcached_version needs to be done on a clone, because the server + // will not toggle protocol on an connection. + memcached_version(clone); + + if (clone->hosts[0].major_version >= 1 && clone->hosts[0].minor_version > 2) + { + memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_NO_BLOCK, 0); + rc = memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1); + assert(rc == MEMCACHED_SUCCESS); + assert(memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL) == 1); + } + + memcached_free(clone); + return rc; +} + static memcached_return pre_murmur(memcached_st *memc) { memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, (uint64_t)MEMCACHED_HASH_MURMUR); @@ -3104,6 +3127,7 @@ collection_st collection[] ={ {"string", 0, 0, string_tests}, {"result", 0, 0, result_tests}, {"async", pre_nonblock, 0, async_tests}, + {"async_binary", pre_nonblock_binary, 0, async_tests}, {"user", 0, 0, user_tests}, {"generate", 0, 0, generate_tests}, {"generate_hsieh", pre_hsieh, 0, generate_tests},