Package the tests

This commit is contained in:
Petr Písař 2022-05-31 14:37:02 +02:00
parent 9f25b954f2
commit a140636d43
2 changed files with 40 additions and 3 deletions

View File

@ -1 +1,2 @@
addFilter('spelling-error .* deskewing')
addFilter('-tests\.noarch: W: no-documentation')

View File

@ -17,12 +17,15 @@ Summary: Post-processing of scanned and photocopied book pages
# other files: GPLv2
# README.md: GPLv2
# version.h.in: 0BSD
## In tests subpackage
# LICENSES/MIT.txt: MIT text
# tests/golden_images/*.license GPLv2
# tests/source_images/*.license GPLv2
# tests/unpaper_tests.py: GPLv2 and MIT
## Not in the binary package
# doc/conf.py: MIT
# LICENSES/Apache-2.0.txt: ASL 2.0 text
# LICENSES/MIT.txt: MIT text
# meson.build: MIT
# tests/unpaper_tests.py: GPLv2 and MIT
# .dir-locals.el: MIT
# .editorconfig: 0BSD
# .github/workflows/meson-build-and-test.yml: ASL 2.0
@ -67,6 +70,21 @@ The program also tries to detect misaligned centering and rotation of pages
and will automatically straighten each page by rotating it to the correct
angle. This process is called "deskewing".
%package tests
Summary: Tests for %{name}
License: GPLv2 and MIT
BuildArch: noarch
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
# python3-pillow for PIL Python module
Requires: python3-pillow
Requires: python3-pytest
# Parallelize tests
Requires: python3-pytest-xdist
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
#%%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
%autosetup -p1
@ -80,6 +98,19 @@ angle. This process is called "deskewing".
%install
%meson_install
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a tests %{buildroot}%{_libexecdir}/%{name}
cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
#!/bin/sh
export TEST_IMGSRC_DIR=tests/source_images
export TEST_GOLDEN_DIR=tests/golden_images
export TEST_UNPAPER_BINARY=%{_bindir}/unpaper
# 391 seconds single-threaded
cd %{_libexecdir}/%{name} && exec pytest -v -n "$(getconf _NPROCESSORS_ONLN)" tests/unpaper_tests.py
EOF
chmod +x %{buildroot}%{_libexecdir}/%{name}/test
%{_fixperms} %{buildroot}/*
%files
%license LICENSES/0BSD.txt LICENSES/GPL-2.0-only.txt
@ -87,10 +118,15 @@ angle. This process is called "deskewing".
%{_mandir}/man1/*
%doc AUTHORS doc/*.md doc/img NEWS README.md
%files tests
%license LICENSES/MIT.txt
%{_libexecdir}/%{name}
%changelog
* Tue May 31 2022 Petr Pisar <ppisar@redhat.com> - 7.0.0-1
- 7.0.0 bump
- License changed from (GPLv2) to (GPLv2 and 0BSD)
- License changed from (GPLv2) to (GPLv2 and 0BSD and MIT)
- Package the tests
* Tue Mar 08 2022 Neal Gompa <ngompa@fedoraproject.org> - 6.1^20220117.gite515408-2
- Rebuild for ffmpeg 5.0 ABI fix (#2061392)