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]) AT_TESTED([rpm rpmbuild rpmquery])
m4_define([RPM_INIT_DB],[ m4_define([RPMDB_INIT],[[
DBPATH=`rpm --rcfile=${RPMRC} --eval '%_dbpath'`
rm -rf "${abs_builddir}"/testing"${DBPATH}"/*
rpm \ rpm \
--rcfile=${RPMRC} \ --rcfile="${RPMRC}" \
--root="${abs_builddir}"/testing \ --root="${abs_builddir}"/testing \
--initdb --initdb
]) ]])
m4_define([RPMDB_CLEAR],[[
rm -rf "${abs_builddir}"/testing`rpm --rcfile="${RPMRC}" --eval '%_dbpath'`/*
]])
AT_INIT AT_INIT

View File

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

View File

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

View File

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

View File

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