From f31cc693595d5b4a900d05c9957e65594e720301 Mon Sep 17 00:00:00 2001 From: lingsheng Date: Tue, 24 Aug 2021 14:56:25 +0800 Subject: [PATCH] Fix memcapable tests --- ...-memcapable-fix-quit-test-with-v1.6+.patch | 47 +++++++++++++ ...mcapable-fix-version-test-with-v1.6+.patch | 66 +++++++++++++++++++ ...mcached-tests-fix-clients-memcapable.patch | 22 +++++++ libmemcached.spec | 10 ++- 4 files changed, 143 insertions(+), 2 deletions(-) create mode 100644 libmemcached-memcapable-fix-quit-test-with-v1.6+.patch create mode 100644 libmemcached-memcapable-fix-version-test-with-v1.6+.patch create mode 100644 libmemcached-tests-fix-clients-memcapable.patch diff --git a/libmemcached-memcapable-fix-quit-test-with-v1.6+.patch b/libmemcached-memcapable-fix-quit-test-with-v1.6+.patch new file mode 100644 index 0000000..81e6415 --- /dev/null +++ b/libmemcached-memcapable-fix-quit-test-with-v1.6+.patch @@ -0,0 +1,47 @@ +From bf236d8b2a533d2a1380ad51140f61ae9a730971 Mon Sep 17 00:00:00 2001 +From: Michael Wallner +Date: Mon, 14 Sep 2020 11:05:06 +0200 +Subject: [PATCH] memcapable: fix quit test with v1.6+ + +--- + clients/memcapable.cc | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/clients/memcapable.cc b/clients/memcapable.cc +index 6ae0aeea..65ae027f 100644 +--- a/clients/memcapable.cc ++++ b/clients/memcapable.cc +@@ -1262,14 +1262,16 @@ static enum test_return receive_error_response(void) + + static enum test_return test_ascii_quit(void) + { +- /* Verify that quit handles unknown options */ +- execute(send_string("quit foo bar\r\n")); +- execute(receive_error_response()); +- +- /* quit doesn't support noreply */ +- execute(send_string("quit noreply\r\n")); +- execute(receive_error_response()); ++ if (!v16x_or_greater) { ++ /* Verify that quit handles unknown options */ ++ execute(send_string("quit foo bar\r\n")); ++ execute(receive_error_response()); + ++ /* quit doesn't support noreply */ ++ execute(send_string("quit noreply\r\n")); ++ execute(receive_error_response()); ++ } ++ + /* Verify that quit works */ + execute(send_string("quit\r\n")); + +@@ -2024,8 +2026,8 @@ struct testcase + }; + + struct testcase testcases[]= { +- { "ascii quit", test_ascii_quit }, + { "ascii version", test_ascii_version }, ++ { "ascii quit", test_ascii_quit }, + { "ascii verbosity", test_ascii_verbosity }, + { "ascii set", test_ascii_set }, + { "ascii set noreply", test_ascii_set_noreply }, diff --git a/libmemcached-memcapable-fix-version-test-with-v1.6+.patch b/libmemcached-memcapable-fix-version-test-with-v1.6+.patch new file mode 100644 index 0000000..8661972 --- /dev/null +++ b/libmemcached-memcapable-fix-version-test-with-v1.6+.patch @@ -0,0 +1,66 @@ +From 88d2e7e6a9e0eafbdc1c75068ef1b319d7a34e18 Mon Sep 17 00:00:00 2001 +From: Michael Wallner +Date: Mon, 14 Sep 2020 11:00:58 +0200 +Subject: [PATCH] memcapable: fix version test with v1.6+ + +--- + clients/memcapable.cc | 34 +++++++++++++++++++++++++--------- + 1 file changed, 25 insertions(+), 9 deletions(-) + +diff --git a/clients/memcapable.cc b/clients/memcapable.cc +index f735c2a5..6ae0aeea 100644 +--- a/clients/memcapable.cc ++++ b/clients/memcapable.cc +@@ -63,6 +63,9 @@ static bool verbose= false; + /* The number of seconds to wait for an IO-operation */ + static int timeout= 2; + ++/* v1.6.x is more permissible */ ++static bool v16x_or_greater = false; ++ + /* + * Instead of having to cast between the different datatypes we create + * a union of all of the different types of pacages we want to send. +@@ -1279,20 +1282,33 @@ static enum test_return test_ascii_quit(void) + + static enum test_return test_ascii_version(void) + { +- /* Verify that version command handles unknown options */ +- execute(send_string("version foo bar\r\n")); +- execute(receive_error_response()); +- +- /* version doesn't support noreply */ +- execute(send_string("version noreply\r\n")); +- execute(receive_error_response()); +- +- /* Verify that verify works */ ++ /* Verify that version works */ + execute(send_string("version\r\n")); + char buffer[256]; + execute(receive_line(buffer, sizeof(buffer))); + verify(strncmp(buffer, "VERSION ", 8) == 0); + ++ char *version = &buffer[sizeof("VERSION") + 2]; ++ if (version[0] >= '1' || (version[0] == '1' && version[2] >= '6')) { ++ v16x_or_greater = true; ++ } ++ ++ /* Verify that version command handles unknown options */ ++ execute(send_string("version foo bar\r\n")); ++ if (v16x_or_greater) { ++ execute(receive_line(buffer, sizeof(buffer))); ++ verify(strncmp(buffer, "VERSION ", 8) == 0); ++ } else { ++ execute(receive_error_response()); ++ } ++ /* version doesn't support noreply */ ++ execute(send_string("version noreply\r\n")); ++ if (v16x_or_greater) { ++ execute(receive_line(buffer, sizeof(buffer))); ++ verify(strncmp(buffer, "VERSION ", 8) == 0); ++ } else { ++ execute(receive_error_response()); ++ } + return TEST_PASS; + } + diff --git a/libmemcached-tests-fix-clients-memcapable.patch b/libmemcached-tests-fix-clients-memcapable.patch new file mode 100644 index 0000000..e9f082e --- /dev/null +++ b/libmemcached-tests-fix-clients-memcapable.patch @@ -0,0 +1,22 @@ +From 8c84f5e265f1fc68681f0856a7d96fa8aa034e80 Mon Sep 17 00:00:00 2001 +From: Michael Wallner +Date: Mon, 13 Jan 2020 11:36:53 +0100 +Subject: [PATCH] tests: fix clients/memcapable + +--- + clients/memcapable.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/clients/memcapable.cc b/clients/memcapable.cc +index af120d0b..fc956fe0 100644 +--- a/clients/memcapable.cc ++++ b/clients/memcapable.cc +@@ -1302,7 +1302,7 @@ static enum test_return test_ascii_verbosity(void) + execute(receive_error_response()); + + execute(send_string("verbosity noreply\r\n")); +- execute(receive_error_response()); ++ execute(test_ascii_version()); + + execute(send_string("verbosity 0 noreply\r\n")); + execute(test_ascii_version()); diff --git a/libmemcached.spec b/libmemcached.spec index 013f25f..39691b0 100644 --- a/libmemcached.spec +++ b/libmemcached.spec @@ -1,7 +1,7 @@ Name: libmemcached Summary: Client library and command line tools for memcached server Version: 1.0.18 -Release: 19 +Release: 20 License: BSD URL: http://libmemcached.org/ #origin source:https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz @@ -20,6 +20,9 @@ Patch0002: libmemcached-build.patch Patch0003: libmemcached-fix-memdump-version.patch Patch0004: libmemcached-Ignore-specific-errors-from-memcached_dump.patch Patch0005: libmemcached-fix-multiple-definition.patch +Patch0006: libmemcached-memcapable-fix-version-test-with-v1.6+.patch +Patch0007: libmemcached-memcapable-fix-quit-test-with-v1.6+.patch +Patch0008: libmemcached-tests-fix-clients-memcapable.patch %description @@ -101,7 +104,10 @@ make test %{_mandir}/man3/hashkit* %changelog -* Web Aug 04 2021 Liu Yinsi - 1.0.18-19 +* Tue Aug 24 2021 lingsheng - 1.0.18-20 +- Fix memcapable tests + +* Wed Aug 04 2021 Liu Yinsi - 1.0.18-19 - fix multiple definition to support gcc 10 * Mon Aug 02 2021 Liu Yinsi - 1.0.18-18