Massive hacking on tests.

This commit is contained in:
Ralf Corsépius 2007-08-30 15:33:15 +02:00
parent 1e27f6ec10
commit 333fc3b70e
6 changed files with 55 additions and 65 deletions

View File

@ -1,12 +1,15 @@
AT_TESTED([rpm rpmbuild rpmquery])
m4_define([RPM_INIT_DB],[
DBPATH=`rpm --rcfile=${RPMRC} --eval '%_dbpath'`
rm -rf "${abs_builddir}"/testing"${DBPATH}"/*
m4_define([RPMDB_INIT],[[
rpm \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
--root="${abs_builddir}"/testing \
--initdb
])
]])
m4_define([RPMDB_CLEAR],[[
rm -rf "${abs_builddir}"/testing`rpm --rcfile="${RPMRC}" --eval '%_dbpath'`/*
]])
AT_INIT

View File

@ -19,6 +19,7 @@
# ------------------------------
# Check if rpmbuild -ba *.spec works
AT_SETUP([rpmbuild -ba *.spec])
AT_XFAIL_IF([test $RPM_XFAIL -gt 0])
AT_CHECK([
TOPDIR="${abs_builddir}"/testing/build
@ -32,7 +33,7 @@ AS_MKDIR_P(${TOPDIR}/SRPMS)
cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz ${TOPDIR}/SOURCES
rpmbuild \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
--define "_topdir ${TOPDIR}" \
-ba "${abs_srcdir}"/data/SPECS/hello.spec
],
@ -45,6 +46,7 @@ AT_CLEANUP
# Check if rpmbuild -ba *.spec
# honours a relative topdir with --root
AT_SETUP([rpmbuild --root=... -ba *.spec])
AT_XFAIL_IF([test $RPM_XFAIL -gt 0])
AT_CHECK([
TOPDIR="${abs_builddir}"/testing/build
@ -58,7 +60,7 @@ AS_MKDIR_P(${TOPDIR}/SRPMS)
cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz ${TOPDIR}/SOURCES
rpmbuild \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
--define "_topdir build" \
--root="${abs_builddir}"/testing \
-ba "${abs_srcdir}"/data/SPECS/hello.spec
@ -71,6 +73,7 @@ AT_CLEANUP
# ------------------------------
# Check if rpmbuild --rebuild *.src.rpm works
AT_SETUP([rpmbuild --rebuild])
AT_XFAIL_IF([test $RPM_XFAIL -gt 0])
AT_CHECK([
TOPDIR="${abs_builddir}"/testing/build
@ -82,7 +85,7 @@ AS_MKDIR_P(${TOPDIR}/RPMS)
AS_MKDIR_P(${TOPDIR}/SRPMS)
rpmbuild \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
--define "_topdir ${TOPDIR}" \
--rebuild "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
],
@ -95,6 +98,7 @@ AT_CLEANUP
# Check if rpmbuild --rebuild *.src.rpm
# honours a relative topdir with --root
AT_SETUP([rpmbuild --root=... --rebuild])
AT_XFAIL_IF([test $RPM_XFAIL -gt 0])
AT_CHECK([
TOPDIR="${abs_builddir}"/testing/build
@ -106,7 +110,7 @@ AS_MKDIR_P(${TOPDIR}/RPMS)
AS_MKDIR_P(${TOPDIR}/SRPMS)
rpmbuild \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
--define "_topdir build" \
--root="${abs_builddir}"/testing \
--rebuild "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm

View File

@ -21,7 +21,8 @@
# Attempt to initialize a rpmdb
AT_SETUP([rpm --initdb])
AT_CHECK([
RPM_INIT_DB
RPMDB_CLEAR
RPMDB_INIT
],
[0],
[ignore],
@ -32,43 +33,32 @@ AT_CLEANUP
# Run rpm -qa on an empty rpmdb
AT_SETUP([rpm -qa])
AT_CHECK([
RPM_INIT_DB
RPMDB_CLEAR
RPMDB_INIT
rpm \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
--root="${abs_builddir}"/testing \
-qa
],
[0],
[ignore],
[ignore])
[0])
AT_CLEANUP
# ------------------------------
# install a package into a local rpmdb without --relocate and --nodeps
# * Must fail due to missing deps
# * Use --ignorearch because we don't know the arch
AT_SETUP([rpm -i *.i386.rpm])
AT_CHECK([
RPM_INIT_DB
],
[0],[ignore],[ignore])
# install a noarch package into a local rpmdb without --relocate and --nodeps
# * Should always succeed
AT_SETUP([rpm -i *.noarch.rpm])
AT_CHECK([
RPMDB_CLEAR
RPMDB_INIT
rpm -i \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
--root="${abs_builddir}"/testing \
--ignorearch \
"${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
"${abs_srcdir}"/data/RPMS/foo-1.0-1.noarch.rpm
],
[1],
[ignore],
[error: Failed dependencies:
/bin/sh is needed by hello-1.0-1.i386
libc.so.6 is needed by hello-1.0-1.i386
libc.so.6(GLIBC_2.0) is needed by hello-1.0-1.i386
rtld(GNU_HASH) is needed by hello-1.0-1.i386
])
[0])
AT_CLEANUP
@ -79,20 +69,16 @@ AT_CLEANUP
# * Use --ignorearch because we don't know the arch
AT_SETUP([rpm -i --relocate=.. *.i386.rpm])
AT_CHECK([
RPM_INIT_DB
],
[0],[ignore],[ignore])
RPMDB_CLEAR
RPMDB_INIT
AT_CHECK([
rpm -i \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
--root="${abs_builddir}"/testing \
--nodeps --ignorearch --relocate=/usr="${abs_builddir}"/testing/check \
"${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
],
[0],
[ignore],
[ignore])
[0])
AT_CLEANUP
@ -103,13 +89,11 @@ AT_CLEANUP
# * Use --ignorearch because we don't know the arch
AT_SETUP([rpm -i --relocate=.. *.ppc64.rpm])
AT_CHECK([
RPM_INIT_DB
],
[0],[ignore],[ignore])
RPMDB_CLEAR
RPMDB_INIT
AT_CHECK([
rpm -i \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
--root="${abs_builddir}"/testing \
--nodeps --ignorearch --relocate=/usr="${abs_builddir}"/testing/check \
"${abs_srcdir}"/data/RPMS/hello-1.0-1.ppc64.rpm

View File

@ -50,7 +50,7 @@ AT_CLEANUP
# ------------------------------
AT_SETUP([rpm --showrc])
AT_CHECK([rpm --rcfile=${RPMRC} --showrc],[0],
AT_CHECK([rpm --rcfile="${RPMRC}" --showrc],[0],
[ignore])
AT_CLEANUP
@ -59,6 +59,7 @@ AT_CLEANUP
# Check rpm --querytags
# * Some versions of rpm append extraneous whitespaces
AT_SETUP([rpm --querytags])
AT_XFAIL_IF([test $RPM_XFAIL -gt 0])
AT_CHECK([rpm --querytags],[0],
[ARCH
ARCHIVESIZE

View File

@ -26,7 +26,7 @@ rm -rf ${TOPDIR}
AS_MKDIR_P([${TOPDIR}])
rpmi \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
--define "_topdir ${TOPDIR}" \
-U "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
],
@ -45,7 +45,7 @@ rm -rf ${TOPDIR}
AS_MKDIR_P([${TOPDIR}])
rpmi \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
--define "_topdir ${TOPDIR}" \
-i "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
],

View File

@ -20,7 +20,7 @@
AT_SETUP([rpmquery --qf -p *.i386.rpm])
AT_CHECK([
rpmquery \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
--qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" \
-p "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
],
@ -34,7 +34,7 @@ AT_CLEANUP
AT_SETUP([rpmquery --qf -p *.src.rpm])
AT_CHECK([
rpmquery \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
--qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" \
-p "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
],
@ -48,7 +48,7 @@ AT_CLEANUP
AT_SETUP([rpmquery -ql -p *.src.rpm])
AT_CHECK([
rpmquery \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
-ql \
-p "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
],
@ -63,7 +63,7 @@ AT_CLEANUP
AT_SETUP([rpmquery -ql -p *.i386.rpm])
AT_CHECK([
rpmquery \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
-ql \
-p "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
],
@ -80,9 +80,10 @@ AT_CLEANUP
# Try to check "scripts"
# * Gets rpmpopt-$(VERSION) involved
AT_SETUP([rpm -q --scripts -p *.i386.rpm])
AT_XFAIL_IF([test $RPM_XFAIL -gt 0])
AT_CHECK([
rpm \
--rcfile=${RPMRC} \
--rcfile="${RPMRC}" \
-q --scripts \
-p "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
],
@ -101,23 +102,20 @@ AT_CLEANUP
# * Shall only work with relocation
# * Use --ignorearch because we don't know the arch
AT_SETUP([rpm -qil hello])
AT_CHECK([
RPM_INIT_DB
],
[0],[ignore],[ignore])
AT_CHECK([
rpm --rcfile=${RPMRC} \
RPMDB_CLEAR
RPMDB_INIT
rpm --rcfile="${RPMRC}" \
--root="${abs_builddir}"/testing \
--nodeps --ignorearch --relocate=/usr="${abs_builddir}"/testing/check \
-i "${abs_srcdir}"/data/RPMS/hello-1.0-1.ppc64.rpm
],
[0],
[ignore],
[ignore])
[0])
AT_CHECK([
rpm --rcfile=${RPMRC} \
rpm --rcfile="${RPMRC}" \
--root="${abs_builddir}"/testing \
-q hello
],
@ -133,7 +131,7 @@ ${abs_builddir}/testing/check/share/doc/hello-1.0/FAQ
_ATEOF
AT_CHECK([
rpm --rcfile=${RPMRC} \
rpm --rcfile="${RPMRC}" \
--root="${abs_builddir}"/testing \
-ql hello
],