[packages/php-pecl-apcu_bc] run tests

glen glen at pld-linux.org
Thu Nov 9 20:29:52 CET 2017


commit 83684d57390d456270d5418d08f399decc53b21f
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Thu Nov 9 21:29:45 2017 +0200

    run tests

 php-pecl-apcu_bc.spec | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
---
diff --git a/php-pecl-apcu_bc.spec b/php-pecl-apcu_bc.spec
index 03db7e6..68bc16c 100644
--- a/php-pecl-apcu_bc.spec
+++ b/php-pecl-apcu_bc.spec
@@ -1,3 +1,7 @@
+#
+# Conditional build:
+%bcond_without	tests		# build without tests
+
 %define		php_name	php%{?php_suffix}
 %define		modname	apcu_bc
 Summary:	APCu Backwards Compatibility Module
@@ -9,9 +13,13 @@ Group:		Development/Languages/PHP
 Source0:	https://pecl.php.net/get/%{modname}-%{version}.tgz
 # Source0-md5:	2ba61ea2cf887814e702e25ad7f1a5e1
 URL:		https://pecl.php.net/package/apcu_bc
+BuildRequires:	%{php_name}-cli
 BuildRequires:	%{php_name}-devel >= 4:7.0.0
 BuildRequires:	%{php_name}-pecl-apcu-devel
 BuildRequires:	rpmbuild(macros) >= 1.666
+%if %{with tests}
+BuildRequires:	%{php_name}-pecl-apcu
+%endif
 %{?requires_php_extension}
 Requires:	%{php_name}-pecl-apcu
 Provides:	php(apcu) = %{version}
@@ -25,11 +33,33 @@ This module provides a backwards APC compatible API using APCu.
 %setup -qc
 mv %{modname}-%{version}/* .
 
+cat <<'EOF' > run-tests.sh
+#!/bin/sh
+export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
+exec %{__make} test \
+	PHP_EXECUTABLE=%{__php} \
+	PHP_TEST_SHARED_SYSTEM_EXTENSIONS="apcu" \
+	RUN_TESTS_SETTINGS="-q $*"
+EOF
+chmod +x run-tests.sh
+
 %build
 phpize
 %configure
 %{__make}
 
+# simple module load test
+%{__php} -n -q \
+	-d extension_dir=modules \
+	-d extension=%{php_extensiondir}/apcu.so \
+	-d extension=apc.so \
+	-m > modules.log
+grep apc modules.log
+
+%if %{with tests}
+./run-tests.sh --show-diff
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
 %{__make} install \
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/php-pecl-apcu_bc.git/commitdiff/83684d57390d456270d5418d08f399decc53b21f



More information about the pld-cvs-commit mailing list