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: make
BuildRequires: perl-generators BuildRequires: perl-generators
BuildRequires: perl-interpreter BuildRequires: perl-interpreter
BuildRequires: perl(Config)
BuildRequires: perl(inc::Module::Install) BuildRequires: perl(inc::Module::Install)
BuildRequires: perl(Module::Install::Metadata) BuildRequires: perl(Module::Install::Metadata)
BuildRequires: perl(Module::Install::WriteAll) BuildRequires: perl(Module::Install::WriteAll)
@ -35,6 +36,11 @@ Requires: perl(SQL::Translator)
%{?perl_default_filter} %{?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 %description
This module creates a temporary SQLite database, deploys your DBIC This module creates a temporary SQLite database, deploys your DBIC
schema, and then connects to it. This lets you easily test 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 to worry about cleaning up after your tests, ordering of tests affecting
failure, etc. 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 %prep
%setup -q -n DBICx-TestDatabase-%{version} %setup -q -n DBICx-TestDatabase-%{version}
@ -50,6 +64,12 @@ rm -r inc
perl -i -ne 'print $_ unless m{^inc/}' MANIFEST perl -i -ne 'print $_ unless m{^inc/}' MANIFEST
find -type f -exec chmod -x {} + 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 %build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
%{make_build} %{make_build}
@ -58,7 +78,18 @@ perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
%{make_install} %{make_install}
%{_fixperms} %{buildroot}/* %{_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 %check
export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}')
make test make test
%files %files
@ -66,10 +97,14 @@ make test
%{perl_vendorlib}/* %{perl_vendorlib}/*
%{_mandir}/man3/*.3* %{_mandir}/man3/*.3*
%files tests
%{_libexecdir}/%{name}
%changelog %changelog
* Tue Dec 20 2022 Jitka Plesnikova <jplesnik@redhat.com> - 0.05-25 * Tue Dec 20 2022 Jitka Plesnikova <jplesnik@redhat.com> - 0.05-25
- Update license to SPDX format - Update license to SPDX format
- Use macros %%make_* - Use macros %%make_*
- Package tests
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.05-24 * Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.05-24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

Loading…
Cancel
Save