summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-11-21 17:39:39 +0200
committerPanu Matilainen <pmatilai@redhat.com>2008-11-21 17:59:41 +0200
commitdb6c332c49885163de3b83e200e0b40dcac05dc3 (patch)
treefd7a7cf24065a0b5429006423720e7528d0bda13
parentddf59da4183f578cf1b7238892776bd64340282f (diff)
downloadrpm-db6c332c49885163de3b83e200e0b40dcac05dc3.tar.gz
rpm-db6c332c49885163de3b83e200e0b40dcac05dc3.tar.bz2
rpm-db6c332c49885163de3b83e200e0b40dcac05dc3.zip
Add + use wrapper function for calling rpm commands in tests
- avoids having to define --rcfile etc over and over again
-rw-r--r--tests/atlocal.in7
-rw-r--r--tests/local.at5
-rw-r--r--tests/rpmbuild.at16
-rw-r--r--tests/rpmdb.at12
-rw-r--r--tests/rpmgeneral.at12
-rw-r--r--tests/rpmi.at8
-rw-r--r--tests/rpmquery.at34
7 files changed, 39 insertions, 55 deletions
diff --git a/tests/atlocal.in b/tests/atlocal.in
index 7c5034c96..484a6210e 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -11,3 +11,10 @@ RPMRC="${abs_builddir}/testing@RPMCONFIGDIR@/rpmrc"
TOPDIR="${abs_builddir}/testing/build"
RPM_XFAIL=${RPM_XFAIL-1}
+
+function run()
+{
+ cmd="$1"
+ shift
+ "${cmd}" --rcfile="${RPMRC}" --define "_topdir ${TOPDIR}" $*
+}
diff --git a/tests/local.at b/tests/local.at
index 24d73200f..5808596e4 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -1,14 +1,13 @@
AT_TESTED([rpm rpmbuild rpmquery])
m4_define([RPMDB_INIT],[[
-rpm \
- --rcfile="${RPMRC}" \
+run rpm \
--root="${abs_builddir}"/testing \
--initdb
]])
m4_define([RPMDB_CLEAR],[[
-rm -rf "${abs_builddir}"/testing`rpm --rcfile="${RPMRC}" --eval '%_dbpath'`/*
+rm -rf "${abs_builddir}"/testing`run rpm --eval '%_dbpath'`/*
]])
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index 85623a5de..4a672b2b0 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -25,9 +25,7 @@ AS_MKDIR_P(${TOPDIR}/SOURCES)
cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz ${TOPDIR}/SOURCES
-rpmbuild \
- --rcfile="${RPMRC}" \
- --define "_topdir ${TOPDIR}" \
+run rpmbuild \
-ba "${abs_srcdir}"/data/SPECS/hello.spec
],
[0],
@@ -46,9 +44,7 @@ AS_MKDIR_P(${TOPDIR}/SOURCES)
cp "${abs_srcdir}"/data/SOURCES/hello-1.0.tar.gz ${TOPDIR}/SOURCES
-rpmbuild \
- --rcfile="${RPMRC}" \
- --define "_topdir build" \
+run rpmbuild \
--root="${abs_builddir}"/testing \
-ba "${abs_srcdir}"/data/SPECS/hello.spec
],
@@ -63,9 +59,7 @@ AT_SETUP([rpmbuild --rebuild])
AT_CHECK([
rm -rf ${TOPDIR}
-rpmbuild \
- --rcfile="${RPMRC}" \
- --define "_topdir ${TOPDIR}" \
+run rpmbuild \
--rebuild "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
],
[0],
@@ -81,9 +75,7 @@ AT_XFAIL_IF([test $RPM_XFAIL -gt 0])
AT_CHECK([
rm -rf ${TOPDIR}
-rpmbuild \
- --rcfile="${RPMRC}" \
- --define "_topdir build" \
+run rpmbuild \
--root="${abs_builddir}"/testing \
--rebuild "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
],
diff --git a/tests/rpmdb.at b/tests/rpmdb.at
index d75ca61d3..d95d017c1 100644
--- a/tests/rpmdb.at
+++ b/tests/rpmdb.at
@@ -35,8 +35,7 @@ AT_SETUP([rpm -qa])
AT_CHECK([
RPMDB_CLEAR
RPMDB_INIT
-rpm \
- --rcfile="${RPMRC}" \
+run rpm \
--root="${abs_builddir}"/testing \
-qa
],
@@ -53,8 +52,7 @@ AT_CHECK([
RPMDB_CLEAR
RPMDB_INIT
-rpm -i \
- --rcfile="${RPMRC}" \
+run rpm -i \
--root="${abs_builddir}"/testing \
"${abs_srcdir}"/data/RPMS/foo-1.0-1.noarch.rpm
],
@@ -72,8 +70,7 @@ AT_CHECK([
RPMDB_CLEAR
RPMDB_INIT
-rpm -i \
- --rcfile="${RPMRC}" \
+run rpm -i \
--root="${abs_builddir}"/testing \
--nodeps --ignorearch --relocate=/usr="${abs_builddir}"/testing/check \
"${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
@@ -92,8 +89,7 @@ AT_CHECK([
RPMDB_CLEAR
RPMDB_INIT
-rpm -i \
- --rcfile="${RPMRC}" \
+run rpm -i \
--root="${abs_builddir}"/testing \
--nodeps --ignorearch --relocate=/usr="${abs_builddir}"/testing/check \
"${abs_srcdir}"/data/RPMS/hello-1.0-1.ppc64.rpm
diff --git a/tests/rpmgeneral.at b/tests/rpmgeneral.at
index 0f9333e28..fbe267ea3 100644
--- a/tests/rpmgeneral.at
+++ b/tests/rpmgeneral.at
@@ -18,7 +18,7 @@
# ------------------------------
AT_SETUP([rpm --version])
-AT_CHECK([rpm --version],[0],
+AT_CHECK([run rpm --version],[0],
[RPM version AT_PACKAGE_VERSION
])
AT_CLEANUP
@@ -26,7 +26,7 @@ AT_CLEANUP
# ------------------------------
AT_SETUP([rpmbuild --version])
-AT_CHECK([rpmbuild --version],[0],
+AT_CHECK([run rpmbuild --version],[0],
[RPM version AT_PACKAGE_VERSION
])
AT_CLEANUP
@@ -34,7 +34,7 @@ AT_CLEANUP
# ------------------------------
AT_SETUP([rpm --version])
-AT_CHECK([rpm --version],[0],
+AT_CHECK([run rpm --version],[0],
[RPM version AT_PACKAGE_VERSION
])
AT_CLEANUP
@@ -42,7 +42,7 @@ AT_CLEANUP
# ------------------------------
AT_SETUP([rpm --version])
-AT_CHECK([rpm --version],[0],
+AT_CHECK([run rpm --version],[0],
[RPM version AT_PACKAGE_VERSION
])
AT_CLEANUP
@@ -50,7 +50,7 @@ AT_CLEANUP
# ------------------------------
AT_SETUP([rpm --showrc])
-AT_CHECK([rpm --rcfile="${RPMRC}" --showrc],[0],
+AT_CHECK([run rpm --showrc],[0],
[ignore])
AT_CLEANUP
@@ -59,7 +59,7 @@ AT_CLEANUP
# Check rpm --querytags
# * Some versions of rpm append extraneous whitespaces
AT_SETUP([rpm --querytags])
-AT_CHECK([rpm --querytags],[0],
+AT_CHECK([run rpm --querytags],[0],
[ARCH
ARCHIVESIZE
BASENAMES
diff --git a/tests/rpmi.at b/tests/rpmi.at
index 643e8e017..f2bfe616f 100644
--- a/tests/rpmi.at
+++ b/tests/rpmi.at
@@ -22,9 +22,7 @@ AT_SETUP([rpm -U *.src.rpm])
AT_CHECK([
rm -rf ${TOPDIR}
-rpm \
- --rcfile="${RPMRC}" \
- --define "_topdir ${TOPDIR}" \
+run rpm \
-U "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
],
[0],
@@ -38,9 +36,7 @@ AT_SETUP([rpm -i *.src.rpm])
AT_CHECK([
rm -rf ${TOPDIR}
-rpm \
- --rcfile="${RPMRC}" \
- --define "_topdir ${TOPDIR}" \
+run rpm \
-i "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
],
[0],
diff --git a/tests/rpmquery.at b/tests/rpmquery.at
index 1eed81919..9fbddea5e 100644
--- a/tests/rpmquery.at
+++ b/tests/rpmquery.at
@@ -17,11 +17,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# ------------------------------
-AT_SETUP([rpmquery --qf -p *.i386.rpm])
+AT_SETUP([rpm --qf -p *.i386.rpm])
AT_CHECK([
-rpmquery \
- --rcfile="${RPMRC}" \
- --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" \
+run rpm \
+ -q --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" \
-p "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
],
[0],
@@ -31,11 +30,10 @@ rpmquery \
AT_CLEANUP
# ------------------------------
-AT_SETUP([rpmquery --qf -p *.src.rpm])
+AT_SETUP([rpm --qf -p *.src.rpm])
AT_CHECK([
-rpmquery \
- --rcfile="${RPMRC}" \
- --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" \
+run rpm \
+ -q --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" \
-p "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
],
[0],
@@ -45,10 +43,9 @@ rpmquery \
AT_CLEANUP
# ------------------------------
-AT_SETUP([rpmquery -ql -p *.src.rpm])
+AT_SETUP([rpm -ql -p *.src.rpm])
AT_CHECK([
-rpmquery \
- --rcfile="${RPMRC}" \
+run rpm \
-ql \
-p "${abs_srcdir}"/data/SRPMS/hello-1.0-1.src.rpm
],
@@ -60,10 +57,9 @@ hello.spec
AT_CLEANUP
# ------------------------------
-AT_SETUP([rpmquery -ql -p *.i386.rpm])
+AT_SETUP([rpm -ql -p *.i386.rpm])
AT_CHECK([
-rpmquery \
- --rcfile="${RPMRC}" \
+rpm \
-ql \
-p "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
],
@@ -81,8 +77,7 @@ AT_CLEANUP
# * Gets rpmpopt-$(VERSION) involved
AT_SETUP([rpm -q --scripts -p *.i386.rpm])
AT_CHECK([
-rpm \
- --rcfile="${RPMRC}" \
+run rpm \
-q --scripts \
-p "${abs_srcdir}"/data/RPMS/hello-1.0-1.i386.rpm
],
@@ -106,15 +101,14 @@ AT_CHECK([
RPMDB_CLEAR
RPMDB_INIT
-rpm --rcfile="${RPMRC}" \
- --root="${abs_builddir}"/testing \
+run rpm \
--nodeps --ignorearch --relocate=/usr="${abs_builddir}"/testing/check \
-i "${abs_srcdir}"/data/RPMS/hello-1.0-1.ppc64.rpm
],
[0])
AT_CHECK([
-rpm --rcfile="${RPMRC}" \
+run rpm \
--root="${abs_builddir}"/testing \
-q hello
],
@@ -130,7 +124,7 @@ ${abs_builddir}/testing/check/share/doc/hello-1.0/FAQ
_ATEOF
AT_CHECK([
-rpm --rcfile="${RPMRC}" \
+rpm \
--root="${abs_builddir}"/testing \
-ql hello
],