Add test case for scriptlet behavior
- The test-root has a shell but rpm doesn't know about it, add a
fakeshell metapackage that provides it. Should come in handy for
other cases as well, up to now we've been limited to lua scripts only.
- Test that all the "normal" scripts get executed, in expected order
and with expected arguments, on install, upgrade and erase.
- This would've saved the rather embarrassing breakage with commit
274dbf557d
at least, but better
late than never as they say... It also serves to highlight and
document the arguably broken arguments to %pre- and %posttrans
scripts (ie always 0)
This commit is contained in:
parent
2f20f6e6b2
commit
c411382194
|
@ -27,6 +27,7 @@ TESTSUITE_AT += rpmconfig.at
|
|||
TESTSUITE_AT += rpmmacro.at
|
||||
TESTSUITE_AT += rpmpython.at
|
||||
TESTSUITE_AT += rpmdepmatch.at
|
||||
TESTSUITE_AT += rpmscript.at
|
||||
EXTRA_DIST += $(TESTSUITE_AT)
|
||||
|
||||
## testsuite data
|
||||
|
@ -42,6 +43,8 @@ EXTRA_DIST += data/SPECS/hlinktest.spec
|
|||
EXTRA_DIST += data/SPECS/symlinktest.spec
|
||||
EXTRA_DIST += data/SPECS/deptest.spec
|
||||
EXTRA_DIST += data/SPECS/verifyscript.spec
|
||||
EXTRA_DIST += data/SPECS/fakeshell.spec
|
||||
EXTRA_DIST += data/SPECS/scripts.spec
|
||||
EXTRA_DIST += data/SOURCES/hello-1.0-modernize.patch
|
||||
EXTRA_DIST += data/SOURCES/hello-1.0.tar.gz
|
||||
EXTRA_DIST += data/SOURCES/hello-2.0.tar.gz
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
Name: fakeshell
|
||||
Version: 1.0
|
||||
Release: 1
|
||||
Summary: Fake provides for shell
|
||||
License: GPL
|
||||
BuildArch: noarch
|
||||
Provides: /bin/sh
|
||||
|
||||
%description
|
||||
%{summary}
|
||||
|
||||
%files
|
|
@ -0,0 +1,31 @@
|
|||
Name: scripts
|
||||
Version: 1.0
|
||||
Release: %{rel}
|
||||
Summary: Testing script behavior
|
||||
Group: Testing
|
||||
License: GPL
|
||||
BuildArch: noarch
|
||||
|
||||
%description
|
||||
%{summary}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
|
||||
%pretrans
|
||||
echo %{name}-%{version}-%{release} PRETRANS $*
|
||||
|
||||
%pre
|
||||
echo %{name}-%{version}-%{release} PRE $*
|
||||
|
||||
%post
|
||||
echo %{name}-%{version}-%{release} POST $*
|
||||
|
||||
%preun
|
||||
echo %{name}-%{version}-%{release} PREUN $*
|
||||
|
||||
%postun
|
||||
echo %{name}-%{version}-%{release} POSTUN $*
|
||||
|
||||
%posttrans
|
||||
echo %{name}-%{version}-%{release} POSTTRANS $*
|
|
@ -0,0 +1,39 @@
|
|||
# rpmscript.at: rpm scriptlet tests
|
||||
|
||||
AT_BANNER([RPM scriptlets])
|
||||
|
||||
# ------------------------------
|
||||
#
|
||||
AT_SETUP([basic scripts and arguments])
|
||||
AT_KEYWORDS([verify])
|
||||
AT_CHECK([
|
||||
RPMDB_CLEAR
|
||||
RPMDB_INIT
|
||||
rm -rf "${TOPDIR}"
|
||||
|
||||
runroot rpmbuild --quiet -bb /data/SPECS/fakeshell.spec
|
||||
runroot rpmbuild --quiet -bb --define "rel 1" /data/SPECS/scripts.spec
|
||||
runroot rpmbuild --quiet -bb --define "rel 2" /data/SPECS/scripts.spec
|
||||
|
||||
runroot rpm -U "${TOPDIR}"/RPMS/noarch/fakeshell-1.0-1.noarch.rpm
|
||||
runroot rpm -U "${TOPDIR}"/RPMS/noarch/scripts-1.0-1.noarch.rpm
|
||||
runroot rpm -U "${TOPDIR}"/RPMS/noarch/scripts-1.0-2.noarch.rpm
|
||||
runroot rpm -e scripts
|
||||
],
|
||||
[0],
|
||||
[scripts-1.0-1 PRETRANS 0
|
||||
scripts-1.0-1 PRE 1
|
||||
scripts-1.0-1 POST 1
|
||||
scripts-1.0-1 POSTTRANS 0
|
||||
scripts-1.0-2 PRETRANS 0
|
||||
scripts-1.0-2 PRE 2
|
||||
scripts-1.0-2 POST 2
|
||||
scripts-1.0-1 PREUN 1
|
||||
scripts-1.0-1 POSTUN 1
|
||||
scripts-1.0-2 POSTTRANS 0
|
||||
scripts-1.0-2 PREUN 0
|
||||
scripts-1.0-2 POSTUN 0
|
||||
],
|
||||
[])
|
||||
AT_CLEANUP
|
||||
|
|
@ -4,6 +4,7 @@ m4_include([rpmverify.at])
|
|||
m4_include([rpmdb.at])
|
||||
m4_include([rpmi.at])
|
||||
m4_include([rpmbuild.at])
|
||||
m4_include([rpmscript.at])
|
||||
m4_include([rpmvercmp.at])
|
||||
m4_include([rpmdeps.at])
|
||||
m4_include([rpmconflict.at])
|
||||
|
|
Loading…
Reference in New Issue