Package tests
This commit is contained in:
parent
61a7823f33
commit
fca0b72f49
1
.fmf/version
Normal file
1
.fmf/version
Normal file
@ -0,0 +1 @@
|
||||
1
|
7
gating.yaml
Normal file
7
gating.yaml
Normal 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}
|
@ -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
|
||||
Version: 1.21
|
||||
Release: 10%{?dist}
|
||||
Release: 11%{?dist}
|
||||
Summary: MariaDB and MySQL driver for the Perl5 Database Interface (DBI)
|
||||
License: GPL+ or Artistic
|
||||
URL: https://metacpan.org/release/DBD-MariaDB/
|
||||
@ -46,16 +55,24 @@ BuildRequires: perl(File::Path)
|
||||
BuildRequires: perl(File::Temp)
|
||||
BuildRequires: perl(FindBin)
|
||||
BuildRequires: perl(lib)
|
||||
BuildRequires: perl(Net::SSLeay)
|
||||
BuildRequires: perl(Proc::ProcessTable)
|
||||
BuildRequires: perl(Storable)
|
||||
BuildRequires: perl(Test::Deep)
|
||||
BuildRequires: perl(Test::More) >= 0.90
|
||||
BuildRequires: perl(Time::HiRes)
|
||||
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))
|
||||
|
||||
# Filter private modules for tests
|
||||
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}perl\\(lib.pl\\)
|
||||
|
||||
%description
|
||||
DBD::MariaDB is the Perl5 Database Interface driver for MariaDB and MySQL
|
||||
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
|
||||
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
|
||||
%setup -q -n DBD-MariaDB-%{version}
|
||||
%patch0 -p1
|
||||
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
|
||||
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" NO_PACKLIST=1 NO_PERLLOCAL=1
|
||||
%{make_build}
|
||||
@ -76,13 +141,27 @@ perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" NO_PACKLIST=1 NO_P
|
||||
%install
|
||||
%{make_install}
|
||||
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/*
|
||||
|
||||
%check
|
||||
# Set MariaDB and DBD::MariaDB test environment
|
||||
. %{SOURCE3}
|
||||
|
||||
make test
|
||||
unset RELEASE_TESTING
|
||||
make test %{?with_perl_DBD_MariaDB_enables_leak_test:EXTENDED_TESTING=1}
|
||||
|
||||
%files
|
||||
%license LICENSE
|
||||
@ -91,7 +170,13 @@ make test
|
||||
%{perl_vendorarch}/DBD*
|
||||
%{_mandir}/man3/*
|
||||
|
||||
%files tests
|
||||
%{_libexecdir}/%{name}
|
||||
|
||||
%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
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
|
5
plans/sanity.fmf
Normal file
5
plans/sanity.fmf
Normal file
@ -0,0 +1,5 @@
|
||||
summary: Sanity tests
|
||||
discover:
|
||||
how: fmf
|
||||
execute:
|
||||
how: tmt
|
4
tests/upstream-tests.fmf
Normal file
4
tests/upstream-tests.fmf
Normal file
@ -0,0 +1,4 @@
|
||||
summary: Upstream tests
|
||||
component: perl-DBD-MariaDB
|
||||
require: perl-DBD-MariaDB-tests
|
||||
test: /usr/libexec/perl-DBD-MariaDB/test
|
Loading…
Reference in New Issue
Block a user