summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2023-03-23 10:23:42 +0100
committerRemi Collet <remi@php.net>2023-03-23 10:23:42 +0100
commitca9cc1dd109ed589e3eaa6c03af135da1fad0fbb (patch)
tree71ad22a7887e75c9c79efe818de527d835189715
parent95c33b377427f633c770ad218b5808988095f4e0 (diff)
add patch for test suite with redis 7.2 from
https://github.com/phpredis/phpredis/pull/2335
-rw-r--r--php-pecl-redis5.spec18
-rw-r--r--redis-tests.patch53
2 files changed, 66 insertions, 5 deletions
diff --git a/php-pecl-redis5.spec b/php-pecl-redis5.spec
index dd04480..0bd2289 100644
--- a/php-pecl-redis5.spec
+++ b/php-pecl-redis5.spec
@@ -1,7 +1,7 @@
# remirepo spec file for php-pecl-redis5
#
-# Copyright (c) 2012-2022 Remi Collet
-# License: CC-BY-SA
+# Copyright (c) 2012-2023 Remi Collet
+# License: CC-BY-SA-4.0
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
@@ -30,11 +30,13 @@
Summary: Extension for communicating with the Redis key-value store
Name: %{?scl_prefix}php-pecl-redis5
Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}}
-Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
-License: PHP
+Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+License: PHP-3.01
URL: https://pecl.php.net/package/redis
Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz
+Patch0: %{pecl_name}-tests.patch
+
BuildRequires: make
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel >= 7.0
@@ -84,7 +86,7 @@ Conflicts: %{?scl_prefix}php-pecl-%{pecl_name} < 5
Conflicts: %{?scl_prefix}php-pecl-%{pecl_name}4 < 5
%endif
-%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
+%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} == 7
# Other third party repo stuff
%if "%{php_version}" > "7.1"
Obsoletes: php71u-pecl-%{pecl_name} <= %{version}
@@ -133,6 +135,8 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd NTS
+%patch0 -p1 -b.pr2335
+
# Use system library
rm -r liblzf
@@ -353,6 +357,10 @@ fi
%changelog
+* Thu Mar 23 2023 Remi Collet <remi@remirepo.net> - 5.3.7-3
+- add patch for test suite with redis 7.2 from
+ https://github.com/phpredis/phpredis/pull/2335
+
* Fri Sep 9 2022 Remi Collet <remi@remirepo.net> - 5.3.7-2
- rebuild for PHP 8.2 with msgpack and igbinary
diff --git a/redis-tests.patch b/redis-tests.patch
new file mode 100644
index 0000000..e76bb78
--- /dev/null
+++ b/redis-tests.patch
@@ -0,0 +1,53 @@
+Adapted for version 5.3.7 from
+
+From 67f2b31d5dbb7ba0ad423d07a1256f14b6f019c5 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Thu, 23 Mar 2023 10:05:04 +0100
+Subject: [PATCH] fix testObject for redis 7.2
+
+---
+ tests/RedisTest.php | 8 +++++---
+ tests/TestSuite.php | 6 +++---
+ 2 files changed, 8 insertions(+), 6 deletions(-)
+
+diff -up ./tests/RedisTest.php.pr2335 ./tests/RedisTest.php
+--- ./tests/RedisTest.php.pr2335 2023-03-23 10:17:56.611597097 +0100
++++ ./tests/RedisTest.php 2023-03-23 10:19:48.911307411 +0100
+@@ -2744,14 +2744,15 @@ class Redis_Test extends TestSuite
+ /* Newer versions of redis are going to encode lists as 'quicklists',
+ * so 'quicklist' or 'ziplist' is valid here */
+ $str_encoding = $this->redis->object('encoding', 'key');
+- $this->assertTrue($str_encoding === "ziplist" || $str_encoding === 'quicklist');
++ $this->assertTrue($str_encoding === "ziplist" || $str_encoding === 'quicklist' || $str_encoding === 'listpack', $str_encoding);
+
+ $this->assertTrue($this->redis->object('refcount', 'key') === 1);
+ $this->assertTrue($this->redis->object('idletime', 'key') === 0);
+
+ $this->redis->del('key');
+ $this->redis->sadd('key', 'value');
+- $this->assertTrue($this->redis->object('encoding', 'key') === "hashtable");
++ $str_encoding = $this->redis->object('encoding', 'key');
++ $this->assertTrue($str_encoding === "hashtable" || $str_encoding === 'listpack', $str_encoding);
+ $this->assertTrue($this->redis->object('refcount', 'key') === 1);
+ $this->assertTrue($this->redis->object('idletime', 'key') === 0);
+
+diff -up ./tests/TestSuite.php.pr2335 ./tests/TestSuite.php
+--- ./tests/TestSuite.php.pr2335 2022-02-15 19:25:22.000000000 +0100
++++ ./tests/TestSuite.php 2023-03-23 10:17:56.611597097 +0100
+@@ -99,13 +99,13 @@ class TestSuite
+ return false;
+ }
+
+- protected function assertTrue($bool) {
++ protected function assertTrue($bool, $msg='') {
+ if($bool)
+ return true;
+
+ $bt = debug_backtrace(false);
+- self::$errors []= sprintf("Assertion failed: %s:%d (%s)\n",
+- $bt[0]["file"], $bt[0]["line"], $bt[1]["function"]);
++ self::$errors []= sprintf("Assertion failed: %s:%d (%s) %s\n",
++ $bt[0]["file"], $bt[0]["line"], $bt[1]["function"], $msg);
+
+ return false;
+ }