Package tests
This commit is contained in:
parent
2c38c01f91
commit
1cf1ec95ec
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}
|
@ -65,6 +65,29 @@ Requires: perl(IPC::System::Simple) >= 0.12
|
||||
# Remove falsely detected perl(lib)
|
||||
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(lib\\)$
|
||||
|
||||
# Filter modules bundled for tests
|
||||
%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir}
|
||||
%global __requires_exclude %{__requires_exclude}|^perl\\(autodie::test.*\\)
|
||||
%global __requires_exclude %{__requires_exclude}|^perl\\(autodie_.*\\)
|
||||
%global __requires_exclude %{__requires_exclude}|^perl\\(Caller_helper\\)
|
||||
%global __requires_exclude %{__requires_exclude}|^perl\\(Hints_.*\\)
|
||||
%global __requires_exclude %{__requires_exclude}|^perl\\(lethal\\)
|
||||
%global __requires_exclude %{__requires_exclude}|^perl\\(my::.*\\)
|
||||
%global __requires_exclude %{__requires_exclude}|^perl\\(Some::Module\\)
|
||||
|
||||
%package tests
|
||||
Summary: Tests for %{name}
|
||||
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
Requires: perl-Test-Harness
|
||||
%if %{with perl_autodie_enables_optional_test} && !%{defined perl_bootstrap}
|
||||
Requires: perl(BSD::Resource)
|
||||
Requires: perl(Import::Into) >= 1.002004
|
||||
%endif
|
||||
|
||||
%description tests
|
||||
Tests from %{name}. Execute them
|
||||
with "%{_libexecdir}/%{name}/test".
|
||||
|
||||
%description
|
||||
The "autodie" and "Fatal" pragma provides a convenient way to replace
|
||||
functions that normally return false on failure with equivalents that throw an
|
||||
@ -77,16 +100,41 @@ autodie in preference to "Fatal".
|
||||
%setup -q -n autodie-%{version}
|
||||
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}
|
||||
|
||||
%install
|
||||
%{make_install}
|
||||
%{_fixperms} $RPM_BUILD_ROOT/*
|
||||
%{_fixperms} %{buildroot}/*
|
||||
|
||||
# Install tests
|
||||
mkdir -p %{buildroot}%{_libexecdir}/%{name}
|
||||
cp -a t %{buildroot}%{_libexecdir}/%{name}
|
||||
cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
|
||||
#!/bin/bash
|
||||
set -e
|
||||
unset AUTHOR_TESTING AUTOMATED_TESTING PERL_CORE RELEASE_TESTING
|
||||
# Some tests write into temporary files/directories. The solution is to
|
||||
# copy the tests into a writable directory and execute them from there.
|
||||
DIR=$(mktemp -d)
|
||||
pushd "$DIR"
|
||||
cp -a %{_libexecdir}/%{name}/* ./
|
||||
prove -I . -j "$(getconf _NPROCESSORS_ONLN)"
|
||||
popd
|
||||
rm -rf "$DIR"
|
||||
EOF
|
||||
chmod +x %{buildroot}%{_libexecdir}/%{name}/test
|
||||
|
||||
%check
|
||||
unset AUTHOR_TESTING AUTOMATED_TESTING PERL_CORE RELEASE_TESTING
|
||||
export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}')
|
||||
make test
|
||||
|
||||
%files
|
||||
@ -95,9 +143,13 @@ make test
|
||||
%{perl_vendorlib}/*
|
||||
%{_mandir}/man3/*
|
||||
|
||||
%files tests
|
||||
%{_libexecdir}/%{name}
|
||||
|
||||
%changelog
|
||||
* Mon Jan 30 2023 Jitka Plesnikova <jplesnik@redhat.com> - 2.35-1
|
||||
- 2.35 bump
|
||||
- Package tests
|
||||
|
||||
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.34-491
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_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-autodie
|
||||
require: perl-autodie-tests
|
||||
test: /usr/libexec/perl-autodie/test
|
Loading…
Reference in New Issue
Block a user