From 1e67d643f04e930f98215e38eae992156b538639 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 11 Jan 2017 14:57:03 +0200 Subject: [PATCH] run tests --- php-pecl-translit.spec | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/php-pecl-translit.spec b/php-pecl-translit.spec index df4efb0..ee3a921 100644 --- a/php-pecl-translit.spec +++ b/php-pecl-translit.spec @@ -1,5 +1,8 @@ +# +# Conditional build: +%bcond_without tests # build without tests + %define php_name php%{?php_suffix} -%define status beta %define modname translit Summary: %{modname} - transliterates non-latin character sets to latin Summary(pl.UTF-8): %{modname} - translitacja alfabetów niełacińskich do łacińskiego @@ -14,6 +17,10 @@ URL: https://github.com/derickr/pecl-translit BuildRequires: %{php_name}-devel >= 3:5.0.4 BuildRequires: libtool BuildRequires: rpmbuild(macros) >= 1.650 +%if %{with tests} +BuildRequires: %{php_name}-cli +BuildRequires: %{php_name}-iconv +%endif %{?requires_php_extension} Requires: %{php_name}-iconv Provides: php(%{modname}) = %{version} @@ -29,8 +36,6 @@ forms of transliteration such as converting ligatures such as the Norwegian "ae" ligature to separate "ae" characters and normalizing punctuation and spacing. -In PECL status of this extension is: %{status}. - %description -l pl.UTF-8 To rozszerzenie umożliwia transliterację tekstu ze znaków niełacińskich (takich jak chińskie, cyrilica, greckie) na znaki @@ -40,8 +45,6 @@ specjalne formy transliteracji, takie jak konwersja ligatur takich jak norweska ligatura "ae" na oddzielne znaki "ae" oraz normalizacja znaków przestankowych i odstępów. -To rozszerzenie ma w PECL status: %{status}. - %prep %setup -qc mv pecl-translit-*/* . @@ -51,6 +54,28 @@ phpize %configure %{__make} +%if %{with tests} +# simple module load test +%{__php} -n -q \ + -d extension_dir=modules \ + -d extension=%{php_extensiondir}/iconv.so \ + -d extension=%{modname}.so \ + -m > modules.log +grep %{modname} modules.log + +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="iconv" \ + RUN_TESTS_SETTINGS="-q $*" +EOF +chmod +x run-tests.sh + +./run-tests.sh +%endif + %install rm -rf $RPM_BUILD_ROOT install -d $RPM_BUILD_ROOT{%{php_sysconfdir}/conf.d,%{php_extensiondir}} -- 2.44.0