[devel] [PATCH for apt 37/38] Enable integration test suite during package build

Aleksei Nikiforov darktemplar на altlinux.org
Вт Дек 10 18:23:42 MSK 2019


---
 apt.spec | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/apt.spec b/apt.spec
index 5291a4a..7c91f70 100644
--- a/apt.spec
+++ b/apt.spec
@@ -1,3 +1,5 @@
+%def_enable check
+
 Name: apt
 Version: 0.5.15lorg2
 Release: alt71
@@ -56,6 +58,13 @@ BuildPreReq: liblua5.3-devel
 BuildRequires: bzlib-devel cvs docbook-utils gcc-c++ libreadline-devel librpm-devel setproctitle-devel zlib-devel
 BuildRequires: libgnutls-devel
 
+# dependencies of tests
+%if_enabled check
+BuildRequires: /usr/bin/genbasedir
+BuildRequires: /usr/sbin/nginx
+BuildRequires: /usr/bin/openssl
+%endif
+
 %package -n libapt
 Summary: APT's core libraries
 Group: System/Libraries
@@ -92,6 +101,12 @@ Summary(ru_RU.UTF-8): Поддержка метода https для APT
 Group: Other
 Requires: %name = %EVR
 
+%package tests
+Summary: Test suite for APT
+Summary(ru_RU.UTF-8): Набор тестов для APT
+Group: Other
+Requires: %name = %EVR
+
 # {{{ descriptions 
 %define risk_usage_en This package is still under development.
 
@@ -153,6 +168,9 @@ This package contains method 'https' for APT.
 
 %risk_usage_en
 
+%description tests
+This package contains test suite for APT.
+
 %description -n libapt -l ru_RU.UTF-8
 В этом пакете находится библиотеки управления пакетами
 из комплекта APT. В отличие от оригинальной версии для Debian, этот
@@ -195,7 +213,8 @@ This package contains method 'https' for APT.
 
 %risk_usage
 
-# }}}
+%description tests -l ru_RU.UTF-8
+В этом пакете находится набор тестов для APT.
 
 %prep
 %setup
@@ -245,6 +264,7 @@ mkdir -p %buildroot%_sysconfdir/%name/{%name.conf,sources.list,vendors.list,pref
 mkdir -p %buildroot%_libdir/%name/scripts
 mkdir -p %buildroot%_localstatedir/%name/{lists/partial,prefetch}
 mkdir -p %buildroot%_cachedir/%name/{archives/partial,gen{pkg,src}list}
+mkdir -p %buildroot%_libdir/%name/tests
 
 %makeinstall includedir=%buildroot%_includedir/apt-pkg
 
@@ -272,17 +292,28 @@ find %buildroot%_includedir -type f -name '*.h' |while read f; do
 EOF
 done
 
+cp -r test/integration %buildroot%_libdir/%name/tests/
+
 %find_lang %name
 
 unset RPM_PYTHON
 
 %set_verify_elf_method strict
 
+%check
+# run tests multiple times to make sure no tests are randomly failing
+pushd test/integration
+for i in $(seq 1 10) ; do
+LD_LIBRARY_PATH=%buildroot%_libdir PATH=$PATH:%buildroot%_bindir METHODSDIR=%buildroot%_libdir/apt/methods ./run-tests
+done
+popd
+
 %files -f %name.lang
 %_bindir/apt-*
 %_libdir/%name
 %exclude %_libdir/%name/methods/rsync
 %exclude %_libdir/%name/methods/https
+%exclude %_libdir/%name/tests
 %dir %_sysconfdir/%name
 %config(noreplace) %_sysconfdir/%name/%name.conf
 %dir %_sysconfdir/%name/*.d
@@ -319,6 +350,9 @@ unset RPM_PYTHON
 %dir %_libdir/%name/methods
 %_libdir/%name/methods/https
 
+%files tests
+%_libdir/%name/tests
+
 %changelog
 * Mon Jul 22 2019 Aleksei Nikiforov <darktemplar на altlinux.org> 0.5.15lorg2-alt71
 - Introduced new function ListUpdate for improved packagekit support.
-- 
2.24.0



Подробная информация о списке рассылки Devel