Package tests

This commit is contained in:
Jitka Plesnikova 2021-03-12 16:01:18 +01:00
parent 61a7823f33
commit fca0b72f49
5 changed files with 107 additions and 5 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

7
gating.yaml Normal file
View File

@ -0,0 +1,7 @@
--- !Policy
product_versions:
- fedora-*
decision_context: bodhi_update_push_stable
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}

View File

@ -1,6 +1,15 @@
# Disable leak tests
%bcond_with perl_DBD_MariaDB_enables_leak_test
# Perform optional net_ssleay tests
%if 0%{?rhel}
%bcond_with perl_DBD_MariaDB_enables_net_ssleay_test
%else
%bcond_without perl_DBD_MariaDB_enables_net_ssleay_test
%endif
Name: perl-DBD-MariaDB Name: perl-DBD-MariaDB
Version: 1.21 Version: 1.21
Release: 10%{?dist} Release: 11%{?dist}
Summary: MariaDB and MySQL driver for the Perl5 Database Interface (DBI) Summary: MariaDB and MySQL driver for the Perl5 Database Interface (DBI)
License: GPL+ or Artistic License: GPL+ or Artistic
URL: https://metacpan.org/release/DBD-MariaDB/ URL: https://metacpan.org/release/DBD-MariaDB/
@ -46,16 +55,24 @@ BuildRequires: perl(File::Path)
BuildRequires: perl(File::Temp) BuildRequires: perl(File::Temp)
BuildRequires: perl(FindBin) BuildRequires: perl(FindBin)
BuildRequires: perl(lib) BuildRequires: perl(lib)
BuildRequires: perl(Net::SSLeay)
BuildRequires: perl(Proc::ProcessTable)
BuildRequires: perl(Storable)
BuildRequires: perl(Test::Deep) BuildRequires: perl(Test::Deep)
BuildRequires: perl(Test::More) >= 0.90 BuildRequires: perl(Test::More) >= 0.90
BuildRequires: perl(Time::HiRes) BuildRequires: perl(Time::HiRes)
BuildRequires: perl(vars) BuildRequires: perl(vars)
# Optional tests
%if %{with perl_DBD_MariaDB_enables_net_ssleay_test}
BuildRequires: perl(Net::SSLeay)
%endif
%if %{with perl_DBD_MariaDB_enables_leak_test}
BuildRequires: perl(Proc::ProcessTable)
BuildRequires: perl(Storable)
%endif
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
# Filter private modules for tests
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}perl\\(lib.pl\\)
%description %description
DBD::MariaDB is the Perl5 Database Interface driver for MariaDB and MySQL DBD::MariaDB is the Perl5 Database Interface driver for MariaDB and MySQL
databases. In other words: DBD::MariaDB is an interface between the Perl databases. In other words: DBD::MariaDB is an interface between the Perl
@ -64,11 +81,59 @@ the MariaDB/MySQL relational database management system. Most functions
provided by this programming API are supported. Some rarely used functions provided by this programming API are supported. Some rarely used functions
are missing, mainly because no-one ever requested them. are missing, mainly because no-one ever requested them.
%package tests
Summary: Tests for %{name}
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
Requires: hostname
Requires: mariadb
Requires: mariadb-server
# Required to process t/testrules.yml
Requires: perl(CPAN::Meta::YAML)
# Optional tests
%if %{with perl_DBD_MariaDB_enables_net_ssleay_test}
Requires: perl(Net::SSLeay)
%endif
%if %{with perl_DBD_MariaDB_enables_leak_test}
Requires: perl(Proc::ProcessTable)
Requires: perl(Storable)
%endif
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep %prep
%setup -q -n DBD-MariaDB-%{version} %setup -q -n DBD-MariaDB-%{version}
%patch0 -p1 %patch0 -p1
cp %{SOURCE1} %{SOURCE2} t/ cp %{SOURCE1} %{SOURCE2} t/
# Help file to recognise the Perl scripts and normalize shebangs
for F in t/*.t t/*.pl; do
if head -1 "$F" | grep -q -e '^#!.*perl\b' ; then
perl -MConfig -pi -e 's|^#!.*perl\b|$Config{startperl}|' "$F"
else
perl -i -MConfig -ple 'print $Config{startperl} if $. == 1' "$F"
fi
chmod +x "$F"
done
# Remove release tests
for F in t/pod.t t/manifest.t; do
rm "$F"
perl -i -ne 'print $_ unless m{^\Q'"$F"'\E}' MANIFEST
perl -i -ne 'print $_ unless m{\Q'"$F"'\E}' t/testrules.yml
done
%if %{without perl_DBD_MariaDB_enables_leak_test}
# Remove unused tests
for F in t/60leaks.t t/rt86153-reconnect-fail-memory.t; do
rm "$F"
perl -i -ne 'print $_ unless m{^\Q'"$F"'\E}' MANIFEST
perl -i -ne 'print $_ unless m{\Q'"$F"'\E}' t/testrules.yml
done
%endif
%build %build
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" NO_PACKLIST=1 NO_PERLLOCAL=1 perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" NO_PACKLIST=1 NO_PERLLOCAL=1
%{make_build} %{make_build}
@ -76,13 +141,27 @@ perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" NO_PACKLIST=1 NO_P
%install %install
%{make_install} %{make_install}
find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a t %{buildroot}%{_libexecdir}/%{name}
cp %{SOURCE3} %{buildroot}%{_libexecdir}/%{name}
cat > %{buildroot}%{_libexecdir}/%{name}/test << EOF
#!/bin/sh
unset RELEASE_TESTING
. %{_libexecdir}/%{name}/$(basename %{SOURCE3})
cd %{_libexecdir}/%{name} && exec prove -I .
EOF
chmod +x %{buildroot}%{_libexecdir}/%{name}/test
%{_fixperms} $RPM_BUILD_ROOT/* %{_fixperms} $RPM_BUILD_ROOT/*
%check %check
# Set MariaDB and DBD::MariaDB test environment # Set MariaDB and DBD::MariaDB test environment
. %{SOURCE3} . %{SOURCE3}
make test unset RELEASE_TESTING
make test %{?with_perl_DBD_MariaDB_enables_leak_test:EXTENDED_TESTING=1}
%files %files
%license LICENSE %license LICENSE
@ -91,7 +170,13 @@ make test
%{perl_vendorarch}/DBD* %{perl_vendorarch}/DBD*
%{_mandir}/man3/* %{_mandir}/man3/*
%files tests
%{_libexecdir}/%{name}
%changelog %changelog
* Fri Mar 12 2021 Jitka Plesnikova <jplesnik@redhat.com> - 1.21-11
- Package tests
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.21-10 * Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.21-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

5
plans/sanity.fmf Normal file
View File

@ -0,0 +1,5 @@
summary: Sanity tests
discover:
how: fmf
execute:
how: tmt

4
tests/upstream-tests.fmf Normal file
View File

@ -0,0 +1,4 @@
summary: Upstream tests
component: perl-DBD-MariaDB
require: perl-DBD-MariaDB-tests
test: /usr/libexec/perl-DBD-MariaDB/test