Package tests

f38
Jitka Plesnikova 2 years ago
parent 7ea5186071
commit 6047bb48f8

@ -1,8 +0,0 @@
diff -up DBICx-TestDatabase-0.05/Makefile.PL.orig DBICx-TestDatabase-0.05/Makefile.PL
--- DBICx-TestDatabase-0.05/Makefile.PL.orig 2017-05-26 13:28:09.152226934 +0200
+++ DBICx-TestDatabase-0.05/Makefile.PL 2017-05-26 13:29:02.488834875 +0200
@@ -1,3 +1,4 @@
+BEGIN { push @INC, '.'; }
use inc::Module::Install;
name 'DBICx-TestDatabase';

@ -11,6 +11,7 @@ BuildRequires: coreutils
BuildRequires: make
BuildRequires: perl-generators
BuildRequires: perl-interpreter
BuildRequires: perl(Config)
BuildRequires: perl(inc::Module::Install)
BuildRequires: perl(Module::Install::Metadata)
BuildRequires: perl(Module::Install::WriteAll)
@ -35,6 +36,11 @@ Requires: perl(SQL::Translator)
%{?perl_default_filter}
# Filter modules bundled for tests
%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir}
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(MySchema.*\\)
%global __requires_exclude %{__requires_exclude}|^perl\\(TestDatabase\\)
%description
This module creates a temporary SQLite database, deploys your DBIC
schema, and then connects to it. This lets you easily test your DBIC
@ -42,6 +48,14 @@ schema. Since you have a fresh database for every test, you don't have
to worry about cleaning up after your tests, ordering of tests affecting
failure, etc.
%package tests
Summary: Tests for %{name}
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep
%setup -q -n DBICx-TestDatabase-%{version}
@ -50,6 +64,12 @@ rm -r inc
perl -i -ne 'print $_ unless m{^inc/}' MANIFEST
find -type f -exec chmod -x {} +
# Help generators to recognize Perl scripts
for F in t/*.t; do
perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F"
chmod +x "$F"
done
%build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
%{make_build}
@ -58,7 +78,18 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
%{make_install}
%{_fixperms} %{buildroot}/*
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a t %{buildroot}%{_libexecdir}/%{name}
rm -rf %{buildroot}%{_libexecdir}/%{name}/t/author
cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
#!/bin/sh
cd %{_libexecdir}/%{name} && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)"
EOF
chmod +x %{buildroot}%{_libexecdir}/%{name}/test
%check
export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}')
make test
%files
@ -66,10 +97,14 @@ make test
%{perl_vendorlib}/*
%{_mandir}/man3/*.3*
%files tests
%{_libexecdir}/%{name}
%changelog
* Tue Dec 20 2022 Jitka Plesnikova <jplesnik@redhat.com> - 0.05-25
- Update license to SPDX format
- Use macros %%make_*
- Package tests
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.05-24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

Loading…
Cancel
Save