Add some basic dependency check tests to test-suite

This commit is contained in:
Panu Matilainen 2010-03-18 12:34:44 +02:00
parent a609aa7dbc
commit d2d7ca7d43
4 changed files with 202 additions and 0 deletions

View File

@ -20,6 +20,7 @@ TESTSUITE_AT += rpmdb.at
TESTSUITE_AT += rpmbuild.at
TESTSUITE_AT += rpmi.at
TESTSUITE_AT += rpmvercmp.at
TESTSUITE_AT += rpmdeps.at
TESTSUITE_AT += rpmconflict.at
TESTSUITE_AT += rpmconfig.at
TESTSUITE_AT += rpmmacro.at
@ -33,6 +34,7 @@ EXTRA_DIST += data/SPECS/conflicttest.spec
EXTRA_DIST += data/SPECS/configtest.spec
EXTRA_DIST += data/SPECS/flangtest.spec
EXTRA_DIST += data/SPECS/symlinktest.spec
EXTRA_DIST += data/SPECS/deptest.spec
EXTRA_DIST += data/SOURCES/hello-1.0.tar.gz
EXTRA_DIST += data/SOURCES/hello-2.0.tar.gz
EXTRA_DIST += data/RPMS/foo-1.0-1.noarch.rpm

View File

@ -0,0 +1,17 @@
Name: deptest-%{pkg}
Version: 1.0
Release: 1
Summary: Testing dependency behavior
Group: Testing
License: GPL
BuildArch: noarch
%{?reqs:Requires: %{reqs}}
%{?provs:Provides: %{provs}}
%{?cfls:Conflicts: %{cfls}}
%description
%{summary}
%files
%defattr(-,root,root,-)

182
tests/rpmdeps.at Normal file
View File

@ -0,0 +1,182 @@
# rpmdeps.at: rpm dependency tests
AT_BANNER([RPM dependencies])
# ------------------------------
#
AT_SETUP([missing dependency])
AT_KEYWORDS([install])
AT_CHECK([
RPMDB_CLEAR
rm -rf "${TOPDIR}"
run rpmbuild --quiet -bb \
--define "pkg one" \
--define "reqs deptest-two" \
${RPMDATA}/SPECS/deptest.spec
runroot rpm -U "${TOPDIR}"/RPMS/noarch/deptest-one-1.0-1.noarch.rpm
],
[1],
[],
[error: Failed dependencies:
deptest-two is needed by deptest-one-1.0-1.noarch
])
AT_CLEANUP
# ------------------------------
#
AT_SETUP([cross-depending packages])
AT_KEYWORDS([install])
AT_CHECK([
RPMDB_CLEAR
rm -rf "${TOPDIR}"
run rpmbuild --quiet -bb \
--define "pkg one" \
--define "reqs deptest-two" \
${RPMDATA}/SPECS/deptest.spec
run rpmbuild --quiet -bb \
--define "pkg two" \
--define "reqs deptest-one" \
${RPMDATA}/SPECS/deptest.spec
runroot rpm -U "${TOPDIR}"/RPMS/noarch/deptest-one-1.0-1.noarch.rpm "${TOPDIR}"/RPMS/noarch/deptest-two-1.0-1.noarch.rpm
],
[0],
[],
[])
AT_CLEANUP
# ------------------------------
#
AT_SETUP([unsatisfied versioned require])
AT_KEYWORDS([install])
AT_CHECK([
RPMDB_CLEAR
rm -rf "${TOPDIR}"
run rpmbuild --quiet -bb \
--define "pkg one" \
--define "reqs deptest-two >= 2.0" \
${RPMDATA}/SPECS/deptest.spec
run rpmbuild --quiet -bb \
--define "pkg two" \
--define "provs deptest-foo = 1.0" \
${RPMDATA}/SPECS/deptest.spec
runroot rpm -U "${TOPDIR}"/RPMS/noarch/deptest-one-1.0-1.noarch.rpm "${TOPDIR}"/RPMS/noarch/deptest-two-1.0-1.noarch.rpm
],
[2],
[],
[error: Failed dependencies:
deptest-two >= 2.0 is needed by deptest-one-1.0-1.noarch
])
AT_CLEANUP
# ------------------------------
#
AT_SETUP([satisfied versioned require])
AT_KEYWORDS([install])
AT_CHECK([
RPMDB_CLEAR
rm -rf "${TOPDIR}"
run rpmbuild --quiet -bb \
--define "pkg one" \
--define "reqs deptest-foo >= 2.0" \
${RPMDATA}/SPECS/deptest.spec
run rpmbuild --quiet -bb \
--define "pkg two" \
--define "provs deptest-foo = 2.0" \
${RPMDATA}/SPECS/deptest.spec
runroot rpm -U "${TOPDIR}"/RPMS/noarch/deptest-one-1.0-1.noarch.rpm "${TOPDIR}"/RPMS/noarch/deptest-two-1.0-1.noarch.rpm
],
[0],
[],
[])
AT_CLEANUP
# ------------------------------
#
AT_SETUP([versioned conflict in transaction])
AT_KEYWORDS([install])
AT_CHECK([
RPMDB_CLEAR
rm -rf "${TOPDIR}"
run rpmbuild --quiet -bb \
--define "pkg one" \
--define "cfls deptest-two < 2.0" \
${RPMDATA}/SPECS/deptest.spec
run rpmbuild --quiet -bb \
--define "pkg two" \
${RPMDATA}/SPECS/deptest.spec
runroot rpm -U "${TOPDIR}"/RPMS/noarch/deptest-one-1.0-1.noarch.rpm "${TOPDIR}"/RPMS/noarch/deptest-two-1.0-1.noarch.rpm
],
[2],
[],
[error: Failed dependencies:
deptest-two < 2.0 conflicts with deptest-one-1.0-1.noarch
])
AT_CLEANUP
# ------------------------------
#
AT_SETUP([versioned conflict in database])
AT_KEYWORDS([install])
AT_CHECK([
RPMDB_CLEAR
rm -rf "${TOPDIR}"
run rpmbuild --quiet -bb \
--define "pkg one" \
--define "cfls deptest-two < 2.0" \
${RPMDATA}/SPECS/deptest.spec
run rpmbuild --quiet -bb \
--define "pkg two" \
${RPMDATA}/SPECS/deptest.spec
runroot rpm -U "${TOPDIR}"/RPMS/noarch/deptest-one-1.0-1.noarch.rpm
runroot rpm -U "${TOPDIR}"/RPMS/noarch/deptest-two-1.0-1.noarch.rpm
],
[1],
[],
[error: Failed dependencies:
deptest-two < 2.0 conflicts with (installed) deptest-one-1.0-1.noarch
])
AT_CLEANUP
# ------------------------------
#
AT_SETUP([erase to break dependencies])
AT_KEYWORDS([install])
AT_CHECK([
RPMDB_CLEAR
rm -rf "${TOPDIR}"
run rpmbuild --quiet -bb \
--define "pkg one" \
--define "reqs deptest-foo >= 2.0" \
${RPMDATA}/SPECS/deptest.spec
run rpmbuild --quiet -bb \
--define "pkg two" \
--define "provs deptest-foo = 2.0" \
${RPMDATA}/SPECS/deptest.spec
runroot rpm -U "${TOPDIR}"/RPMS/noarch/deptest-one-1.0-1.noarch.rpm "${TOPDIR}"/RPMS/noarch/deptest-two-1.0-1.noarch.rpm
runroot rpm -e deptest-two
],
[1],
[],
[error: Failed dependencies:
deptest-foo >= 2.0 is needed by (installed) deptest-one-1.0-1.noarch
])
AT_CLEANUP

View File

@ -4,6 +4,7 @@ m4_include([rpmdb.at])
m4_include([rpmi.at])
m4_include([rpmbuild.at])
m4_include([rpmvercmp.at])
m4_include([rpmdeps.at])
m4_include([rpmconflict.at])
m4_include([rpmconfig.at])
m4_include([rpmmacro.at])