Fix memcapable tests
This commit is contained in:
parent
c22e7874f2
commit
f31cc69359
47
libmemcached-memcapable-fix-quit-test-with-v1.6+.patch
Normal file
47
libmemcached-memcapable-fix-quit-test-with-v1.6+.patch
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
From bf236d8b2a533d2a1380ad51140f61ae9a730971 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Wallner <mike@php.net>
|
||||||
|
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 },
|
||||||
66
libmemcached-memcapable-fix-version-test-with-v1.6+.patch
Normal file
66
libmemcached-memcapable-fix-version-test-with-v1.6+.patch
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
From 88d2e7e6a9e0eafbdc1c75068ef1b319d7a34e18 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Wallner <mike@php.net>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
22
libmemcached-tests-fix-clients-memcapable.patch
Normal file
22
libmemcached-tests-fix-clients-memcapable.patch
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
From 8c84f5e265f1fc68681f0856a7d96fa8aa034e80 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Wallner <mike@php.net>
|
||||||
|
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());
|
||||||
@ -1,7 +1,7 @@
|
|||||||
Name: libmemcached
|
Name: libmemcached
|
||||||
Summary: Client library and command line tools for memcached server
|
Summary: Client library and command line tools for memcached server
|
||||||
Version: 1.0.18
|
Version: 1.0.18
|
||||||
Release: 19
|
Release: 20
|
||||||
License: BSD
|
License: BSD
|
||||||
URL: http://libmemcached.org/
|
URL: http://libmemcached.org/
|
||||||
#origin source:https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
|
#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
|
Patch0003: libmemcached-fix-memdump-version.patch
|
||||||
Patch0004: libmemcached-Ignore-specific-errors-from-memcached_dump.patch
|
Patch0004: libmemcached-Ignore-specific-errors-from-memcached_dump.patch
|
||||||
Patch0005: libmemcached-fix-multiple-definition.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
|
%description
|
||||||
@ -101,7 +104,10 @@ make test
|
|||||||
%{_mandir}/man3/hashkit*
|
%{_mandir}/man3/hashkit*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Web Aug 04 2021 Liu Yinsi <liuyinsi@163.com> - 1.0.18-19
|
* Tue Aug 24 2021 lingsheng <lingsheng@huawei.com> - 1.0.18-20
|
||||||
|
- Fix memcapable tests
|
||||||
|
|
||||||
|
* Wed Aug 04 2021 Liu Yinsi <liuyinsi@163.com> - 1.0.18-19
|
||||||
- fix multiple definition to support gcc 10
|
- fix multiple definition to support gcc 10
|
||||||
|
|
||||||
* Mon Aug 02 2021 Liu Yinsi <liuyinsi@163.com> - 1.0.18-18
|
* Mon Aug 02 2021 Liu Yinsi <liuyinsi@163.com> - 1.0.18-18
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user