summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2015-06-12 14:27:27 +0200
committerRemi Collet <fedora@famillecollet.com>2015-06-12 14:27:27 +0200
commit6ca3095e2c8a149d5b9ef915661985b93c4caf31 (patch)
tree06f7c0fec67ee768b24d384547a6334374d42376
parentd77ecf9c54b7f7bfb5fefe73f7d8fb22df717bc7 (diff)
php-pecl-yar: run upstream test suite during build
-rw-r--r--php-pecl-yar-dev.spec37
1 files changed, 37 insertions, 0 deletions
diff --git a/php-pecl-yar-dev.spec b/php-pecl-yar-dev.spec
index 73eeab2..ec5eee3 100644
--- a/php-pecl-yar-dev.spec
+++ b/php-pecl-yar-dev.spec
@@ -18,6 +18,7 @@
%global gh_date 20150612
%global with_zts 0%{?__ztsphp:1}
%global pecl_name yar
+%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
%if "%{php_version}" < "5.6"
# After json, msgpack
%global ini_name %{pecl_name}.ini
@@ -43,6 +44,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: curl-devel
BuildRequires: %{?scl_prefix}php-devel
BuildRequires: %{?scl_prefix}php-pear
+BuildRequires: %{?scl_prefix}php-json
BuildRequires: %{?scl_prefix}php-pecl-msgpack-devel
Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
@@ -231,6 +233,41 @@ fi
--modules | grep %{pecl_name}
%endif
+%if %{with_tests}
+cd NTS
+
+: Create test configuration
+export TEST_PHP_EXECUTABLE=%{__php}
+export TEST_PHP_ARGS="-n -d extension=json.so -d extension=msgpack.so -d extension=$PWD/modules/%{pecl_name}.so"
+export NO_INTERACTION=1
+export REPORT_EXIT_STATUS=1
+RET=0
+
+%ifarch x86_64
+PORT=8088
+%else
+PORT=8084
+%endif
+
+sed -e "/YAR_API_HOST/s|localhost:8090|127.0.0.1:$PORT|" \
+ -e "/YAR_API_URI/s|/yar/|/|" \
+ -i tests/yar.inc
+
+: launch the server
+%{__php} $TEST_PHP_ARGS -S 127.0.0.1:$PORT -t tests/htdocs &>serv.log &
+PID=$!
+
+: Run the upstream test suite
+%{__php} -n run-tests.php --show-diff || RET=1
+
+: Cleanup
+kill $PID
+
+exit $RET
+%else
+: upstream test suite disabled
+%endif
+
%clean
rm -rf %{buildroot}