Compare commits

..

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
f051ce6de5 !11 Fix memcapable tests
From: @ultra_planet
Reviewed-by: @small_leek
Signed-off-by: @small_leek
2021-08-24 07:49:26 +00:00
lingsheng
f31cc69359 Fix memcapable tests 2021-08-24 14:56:25 +08:00
openeuler-ci-bot
c22e7874f2 !10 删除参数-fcommon并真正解决变量重复定义
From: @liu-yinsi
Reviewed-by: @small_leek
Signed-off-by: @small_leek
2021-08-04 14:44:14 +00:00
liu-yinsi
a4fd0aed29 define variables only in one .c file to fix multiple definition
add CFLAGS="$CLASS -fcommon" in libmemcached.spec is bad to fix
multiple definition, it only masks error messages, but define
variables only in one .c file is better choice.

Signed-off-by: liu-yinsi <liuyinsi@163.com>
2021-08-04 21:07:11 +08:00
openeuler-ci-bot
ab7cca1dcd !9 compile with fcommon to support gcc 10
From: @liu-yinsi
Reviewed-by: @small_leek
Signed-off-by: @small_leek
2021-08-02 12:10:37 +00:00
liu yinsi
6f9557e3d1 compile with fcommon to support gcc 10 2021-08-02 07:13:25 +00:00
openeuler-ci-bot
0ddfbfc3bd !4 Fix memdump unexpected errors
From: @ultra_planet
Reviewed-by: @small_leek
Signed-off-by: @small_leek
2020-10-30 17:25:17 +08:00
lingsheng
2612f2ce77 Fix memdump unexpected errors 2020-10-30 16:36:05 +08:00
openeuler-ci-bot
9206866cde !1 package init
Merge pull request !1 from sherlock2010/master
2020-03-02 14:46:00 +08:00
sherlock2010
3e6024beee package init 2020-03-02 14:42:48 +08:00
10 changed files with 385 additions and 0 deletions

BIN
libmemcached-1.0.18.tar.gz Normal file

Binary file not shown.

View File

@ -0,0 +1,33 @@
From e96f7e024e860a67424282efd6dcc11cbb2b681d Mon Sep 17 00:00:00 2001
From: lingsheng <lingsheng@huawei.com>
Date: Fri, 30 Oct 2020 16:00:14 +0800
Subject: [PATCH] Ignore specific errors from memcached_dump
https://github.com/php-memcached-dev/php-memcached/pull/315
Signed-off-by: lingsheng <lingsheng@huawei.com>
---
clients/memdump.cc | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/clients/memdump.cc b/clients/memdump.cc
index 48c35d3..5c6d693 100644
--- a/clients/memdump.cc
+++ b/clients/memdump.cc
@@ -123,7 +123,13 @@ int main(int argc, char *argv[])
memcached_return_t rc= memcached_dump(memc, callbacks, NULL, 1);
int exit_code= EXIT_SUCCESS;
- if (memcached_failed(rc))
+ /* Ignore two errors. libmemcached has a hardcoded loop of 200 slab
+ * classes that matches memcached < 1.4.24, at which version the server
+ * has only 63 slabs and throws an error when requesting the 64th slab.
+ *
+ * In multi-server some non-deterministic number of elements will be dropped.
+ */
+ if (rc != MEMCACHED_CLIENT_ERROR && rc != MEMCACHED_SERVER_ERROR && memcached_failed(rc))
{
if (opt_verbose)
{
--
2.23.0

21
libmemcached-build.patch Normal file
View File

@ -0,0 +1,21 @@
diff -up ./clients/memflush.cc.old ./clients/memflush.cc
--- ./clients/memflush.cc.old 2017-02-12 10:12:59.615209225 +0100
+++ ./clients/memflush.cc 2017-02-12 10:13:39.998382783 +0100
@@ -39,7 +39,7 @@ int main(int argc, char *argv[])
{
options_parse(argc, argv);
- if (opt_servers == false)
+ if (!opt_servers)
{
char *temp;
@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
opt_servers= strdup(temp);
}
- if (opt_servers == false)
+ if (!opt_servers)
{
std::cerr << "No Servers provided" << std::endl;
exit(EXIT_FAILURE);

View File

@ -0,0 +1,19 @@
diff -up libmemcached-1.0.16/build-aux/ltmain.sh.orig libmemcached-1.0.16/build-aux/ltmain.sh
--- libmemcached-1.0.16/build-aux/ltmain.sh.orig 2013-12-03 16:36:53.222107642 +0100
+++ libmemcached-1.0.16/build-aux/ltmain.sh 2013-12-03 16:37:35.770132249 +0100
@@ -5664,6 +5664,15 @@ func_mode_link ()
*" $arg "*) ;;
* ) func_append new_inherited_linker_flags " $arg" ;;
esac
+ # As we are forced to pass -nostdlib to g++ during linking, the option
+ # -pthread{,s} is not in effect; add the -lpthread to $deplist
+ # explicitly to link correctly.
+ if test "$tagname" = CXX -a x"$with_gcc" = xyes; then
+ case "$arg" in
+ -pthread*) func_append deplibs " -lpthread" ;;
+ esac
+ fi
+
continue
;;

View File

@ -0,0 +1,25 @@
From b83f34708cb7465f57edc29a2f56f8bf8ad60118 Mon Sep 17 00:00:00 2001
From: lingsheng <lingsheng@huawei.com>
Date: Fri, 30 Oct 2020 14:21:02 +0800
Subject: [PATCH] fix memdump --version
---
clients/memdump.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clients/memdump.cc b/clients/memdump.cc
index 48c35d3..ab2444e 100644
--- a/clients/memdump.cc
+++ b/clients/memdump.cc
@@ -190,7 +190,7 @@ static void options_parse(int argc, char *argv[])
break;
case OPT_VERSION: /* --version or -V */
- opt_verbose= true;
+ opt_version= true;
break;
case OPT_HELP: /* --help or -h */
--
2.23.0

View File

@ -0,0 +1,32 @@
--- a/clients/ms_memslap.h 2021-08-04 20:25:20.314194660 +0800
+++ b/clients/ms_memslap.h 2021-08-04 20:26:01.154700115 +0800
@@ -117,13 +117,13 @@
} ms_global_t;
/* global structure */
-ms_global_t ms_global;
+extern ms_global_t ms_global;
/* global stats information structure */
-ms_stats_t ms_stats;
+extern ms_stats_t ms_stats;
/* global statistic structure */
-ms_statistic_t ms_statistic;
+extern ms_statistic_t ms_statistic;
#ifdef __cplusplus
}
--- a/clients/ms_sigsegv.c 2014-02-09 19:52:42.000000000 +0800
+++ b/clients/ms_sigsegv.c 2021-08-04 20:35:49.725984452 +0800
@@ -21,6 +21,10 @@
#include <pthread.h>
#include "ms_memslap.h"
+ms_global_t ms_global;
+ms_stats_t ms_stats;
+ms_statistic_t ms_statistic;
+
#include "ms_setting.h"
/* prototypes */

View 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 },

View 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;
}

View 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());

120
libmemcached.spec Normal file
View File

@ -0,0 +1,120 @@
Name: libmemcached
Summary: Client library and command line tools for memcached server
Version: 1.0.18
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
#remove hsieh.cc which license of it is not free
Source0: libmemcached-1.0.18.tar.gz
BuildRequires: gcc-c++ cyrus-sasl-devel flex bison python-sphinx memcached
BuildRequires: systemtap-sdt-devel libevent-devel
Provides: bundled(bobjenkins-hash)
Provides: libmemcached-libs
Obsoletes: libmemcached-libs < %{version}-%{release}
Patch0001: libmemcached-fix-linking-with-libpthread.patch
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
Memcached is an in-memory key-value store for small arbitrary data
(strings, objects) from results of database calls, API calls, or
page rendering. libmemcached is a C/C++ client library and tools
for the memcached server (http://memcached.org/).
%package devel
Summary: Header files and development libraries for libmemcached
Requires: libmemcached = %{version}-%{release}
Requires: pkgconfig cyrus-sasl-devel
%description devel
This package contains the header files and development libraries
for libmemcached. If you like to develop programs using libmemcached,
you will need to install libmemcached-devel.
%package help
Summary: Help document for the libmemcached package
Buildarch: noarch
%description help
Help document for the libmemcached package.
%prep
%autosetup -n libmemcached-%{version} -p1
mkdir examples
cp -p tests/*.{cc,h} examples/
%build
%configure \
--with-memcached=%{_bindir}/memcached \
--enable-sasl --enable-libmemcachedprotocol \
--enable-memaslap --enable-dtrace --disable-static
%make_build V=1
%install
%make_install
if [ ! -d %{buildroot}%{_mandir}/man1 ]; then
install -D -p -m 644 man/*1 %{buildroot}%{_mandir}/man1
install -D -p -m 644 man/*3 %{buildroot}%{_mandir}/man3
fi
%check
%if %{?_with_tests:1}%{!?_with_check:0}
make test
%endif
%files
%{_bindir}/mem*
%exclude %{_libdir}/lib*.la
%doc COPYING COPYING AUTHORS README THANKS TODO ChangeLog
%{_libdir}/libhashkit.so.2*
%{_libdir}/libmemcached.so.11*
%{_libdir}/libmemcachedprotocol.so.0*
%{_libdir}/libmemcachedutil.so.2*
%files devel
%doc examples
%{_includedir}/libmemcached
%{_includedir}/libmemcached*.0
%{_includedir}/libhashkit*/
%{_libdir}/libhashkit.so
%{_libdir}/libmemcached*.so
%{_libdir}/pkgconfig/libmemcached.pc
%{_datadir}/aclocal/ax_libmemcached.m4
%files help
%{_mandir}/man1/mem*
%{_mandir}/man3/libmemcached*
%{_mandir}/man3/libhashkit*
%{_mandir}/man3/memcached*
%{_mandir}/man3/hashkit*
%changelog
* 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
* Mon Aug 02 2021 Liu Yinsi <liuyinsi@163.com> - 1.0.18-18
- compile with -fcommon to support gcc 10
* Fri Oct 30 2020 lingsheng <lingsheng@huawei.com> - 1.0.18-17
- Fix memdump unexpected errors
* Fri Feb 28 2020 zhouyihang <zhouyihang1@huawei.com> - 1.0.18-16
- Package init