Fix tests subpackage test script

popd and pushd are bash-specific. Use bash in shell bang.
Prevent from evaluating the script in here-document definition.
Create a temporary directory correctly.
Also correct a typo in a comment.
This commit is contained in:
Petr Písař 2019-10-29 14:32:08 +01:00
parent fc84f8df7a
commit 14e6ac0339

View File

@ -9,7 +9,7 @@
Name: perl-LDAP Name: perl-LDAP
Version: 0.66 Version: 0.66
Release: 5%{?dist} Release: 6%{?dist}
Epoch: 1 Epoch: 1
Summary: LDAP Perl module Summary: LDAP Perl module
License: GPL+ or Artistic License: GPL+ or Artistic
@ -184,12 +184,12 @@ find %{buildroot} -type f -name .packlist -delete
mkdir -p %{buildroot}/%{_libexecdir}/%{name} mkdir -p %{buildroot}/%{_libexecdir}/%{name}
# FIXME: Generators should scan these non-executable files # FIXME: Generators should scan these non-executable files
cp -a data t test.cfg %{buildroot}/%{_libexecdir}/%{name} cp -a data t test.cfg %{buildroot}/%{_libexecdir}/%{name}
cat > %{buildroot}/%{_libexecdir}/%{name}/test <<EOF cat > %{buildroot}/%{_libexecdir}/%{name}/test <<'EOF'
#!/bin/sh #!/bin/bash
set -e set -e
# t/common.pl reads from ./data and writes into ./temp. The easiest solution # t/common.pl reads from ./data and writes into ./temp. The easiest solution
# is to copy the tests into a writable directory and execute the from there. # is to copy the tests into a writable directory and execute them from there.
DIR=$(mktemp) DIR=$(mktemp -d)
pushd "$DIR" pushd "$DIR"
cp -a %{_libexecdir}/%{name}/* ./ cp -a %{_libexecdir}/%{name}/* ./
prove -I . prove -I .
@ -222,6 +222,9 @@ make test
%{_libexecdir}/%{name} %{_libexecdir}/%{name}
%changelog %changelog
* Tue Oct 29 2019 Petr Pisar <ppisar@redhat.com> - 1:0.66-6
- Fix tests subpackage test script
* Mon Aug 26 2019 Petr Pisar <ppisar@redhat.com> - 1:0.66-5 * Mon Aug 26 2019 Petr Pisar <ppisar@redhat.com> - 1:0.66-5
- Package tests - Package tests