X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fmemcapable.c;h=9921f1f147fd26ce5460c2ed48aefb687dfa5f7a;hb=0cc042d0d2b3e81eabc05600d1e4d26bf3d9691f;hp=67146658821506d49307045cd00118b671febb36;hpb=7da7d839bffc2b41ea532c70dbe386fb742e714d;p=m6w6%2Flibmemcached diff --git a/clients/memcapable.c b/clients/memcapable.c index 67146658..9921f1f1 100644 --- a/clients/memcapable.c +++ b/clients/memcapable.c @@ -575,18 +575,31 @@ static enum test_return do_validate_response_header(response *rsp, #define validate_response_header(a,b,c) \ do_validate_response_header(a,b,c) == TEST_PASS -static enum test_return test_binary_noop(void) + +static enum test_return send_binary_noop(void) { command cmd; - response rsp; raw_command(&cmd, PROTOCOL_BINARY_CMD_NOOP, NULL, 0, NULL, 0); execute(send_packet(&cmd)); + return TEST_PASS; +} + +static enum test_return receive_binary_noop(void) +{ + response rsp; execute(recv_packet(&rsp)); verify(validate_response_header(&rsp, PROTOCOL_BINARY_CMD_NOOP, PROTOCOL_BINARY_RESPONSE_SUCCESS)); return TEST_PASS; } +static enum test_return test_binary_noop(void) +{ + execute(send_binary_noop()); + execute(receive_binary_noop()); + return TEST_PASS; +} + static enum test_return test_binary_quit_impl(uint8_t cc) { command cmd; @@ -854,19 +867,23 @@ static enum test_return test_binary_get_impl(const char *key, uint8_t cc) raw_command(&cmd, cc, key, strlen(key), NULL, 0); execute(send_packet(&cmd)); + execute(send_binary_noop()); if (cc == PROTOCOL_BINARY_CMD_GET || cc == PROTOCOL_BINARY_CMD_GETK) { execute(recv_packet(&rsp)); verify(validate_response_header(&rsp, cc, PROTOCOL_BINARY_RESPONSE_KEY_ENOENT)); } - else - execute(test_binary_noop()); + + execute(receive_binary_noop()); execute(binary_set_item(key, key)); execute(resend_packet(&cmd)); + execute(send_binary_noop()); + execute(recv_packet(&rsp)); verify(validate_response_header(&rsp, cc, PROTOCOL_BINARY_RESPONSE_SUCCESS)); + execute(receive_binary_noop()); return TEST_PASS; } @@ -1114,24 +1131,6 @@ static enum test_return test_binary_stat(void) return TEST_PASS; } -static enum test_return test_binary_illegal(void) -{ - command cmd; - response rsp; - uint8_t cc= 0x1b; - - while (cc != 0x00) - { - raw_command(&cmd, cc, NULL, 0, NULL, 0); - execute(send_packet(&cmd)); - execute(recv_packet(&rsp)); - verify(validate_response_header(&rsp, cc, PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND)); - ++cc; - } - - return TEST_PASS_RECONNECT; -} - static enum test_return send_string(const char *cmd) { execute(retry_write(cmd, strlen(cmd))); @@ -1851,7 +1850,6 @@ struct testcase testcases[]= { { "binary prepend", test_binary_prepend }, { "binary prependq", test_binary_prependq }, { "binary stat", test_binary_stat }, - { "binary illegal", test_binary_illegal }, { NULL, NULL} };