diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-11-21 17:48:27 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-11-21 17:59:49 +0200 |
commit | 08c81de2ee753778763810add5221e9162d925cb (patch) | |
tree | 7ca0a325522523fe8d3356809c28c480c075c45c /tests | |
parent | db6c332c49885163de3b83e200e0b40dcac05dc3 (diff) | |
download | rpm-08c81de2ee753778763810add5221e9162d925cb.tar.gz rpm-08c81de2ee753778763810add5221e9162d925cb.tar.bz2 rpm-08c81de2ee753778763810add5221e9162d925cb.zip |
Hackery to get rpm install tests to "work" with fakechroot
- fakechroot throws it's own curveballs into the already mixed up thing,
copy things to the test dir and set chroot base to that to avoid
confusion with cwd and such
- klunky and ugly but at least the tests pass now when running non-root
Diffstat (limited to 'tests')
-rw-r--r-- | tests/atlocal.in | 21 | ||||
-rw-r--r-- | tests/rpmdb.at | 31 | ||||
-rw-r--r-- | tests/rpmquery.at | 15 |
3 files changed, 43 insertions, 24 deletions
diff --git a/tests/atlocal.in b/tests/atlocal.in index 484a6210e..4e4e30e47 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -3,12 +3,15 @@ export LD_LIBRARY_PATH PATH="${abs_builddir}/testing@rpmbindir@:${abs_builddir}/testing@usrbindir@:$PATH" export PATH +RPMTEST="${abs_builddir}/testing" +RPMDATA="${abs_srcdir}/data/" + # Popt looks into $HOME -HOME="${abs_builddir}/testing" +HOME="${RPMTEST}" export HOME -RPMRC="${abs_builddir}/testing@RPMCONFIGDIR@/rpmrc" -TOPDIR="${abs_builddir}/testing/build" +RPMRC="${RPMTEST}@RPMCONFIGDIR@/rpmrc" +TOPDIR="${RPMTEST}/build" RPM_XFAIL=${RPM_XFAIL-1} @@ -16,5 +19,15 @@ function run() { cmd="$1" shift - "${cmd}" --rcfile="${RPMRC}" --define "_topdir ${TOPDIR}" $* + "${cmd}" --rcfile="${RPMRC}" --define "_topdir ${TOPDIR}" $@ +} + +function runroot() +{ + cmd="$1" + shift + (cd ${RPMTEST} && \ + mkdir -p etc && touch etc/mtab && + FAKECHROOT_BASE="${RPMTEST}" fakechroot "${cmd}" --rcfile="${RPMRC}" --define "_topdir ${TOPDIR}" $@ + ) } diff --git a/tests/rpmdb.at b/tests/rpmdb.at index d95d017c1..9da741b9e 100644 --- a/tests/rpmdb.at +++ b/tests/rpmdb.at @@ -35,8 +35,7 @@ AT_SETUP([rpm -qa]) AT_CHECK([ RPMDB_CLEAR RPMDB_INIT -run rpm \ - --root="${abs_builddir}"/testing \ +runroot rpm \ -qa ], [0]) @@ -52,9 +51,11 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT -run rpm -i \ - --root="${abs_builddir}"/testing \ - "${abs_srcdir}"/data/RPMS/foo-1.0-1.noarch.rpm +tpkg="foo-1.0-1.noarch.rpm" +cp "${RPMDATA}/RPMS/${tpkg}" "${RPMTEST}" + +runroot rpm -i \ + "${tpkg}" ], [0]) @@ -70,10 +71,12 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT -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 +tpkg="hello-1.0-1.i386.rpm" +cp "${RPMDATA}/RPMS/${tpkg}" "${RPMTEST}" + +runroot rpm -i \ + --noscripts --nodeps --ignorearch --relocate=/usr="${abs_builddir}"/testing/check \ + "${tpkg}" ], [0]) @@ -89,10 +92,12 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT -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 +tpkg="hello-1.0-1.ppc64.rpm" +cp "${RPMDATA}/RPMS/${tpkg}" "${RPMTEST}" + +runroot rpm -i \ + --noscripts --nodeps --ignorearch --relocate=/usr="${abs_builddir}"/testing/check \ + "${tpkg}" ], [0], [ignore], diff --git a/tests/rpmquery.at b/tests/rpmquery.at index 9fbddea5e..f450f1c7d 100644 --- a/tests/rpmquery.at +++ b/tests/rpmquery.at @@ -101,15 +101,17 @@ AT_CHECK([ RPMDB_CLEAR RPMDB_INIT -run rpm \ - --nodeps --ignorearch --relocate=/usr="${abs_builddir}"/testing/check \ - -i "${abs_srcdir}"/data/RPMS/hello-1.0-1.ppc64.rpm +tpkg="hello-1.0-1.ppc64.rpm" +cp "${RPMDATA}/RPMS/$tpkg" "${RPMTEST}" + +runroot rpm \ + --noscripts --nodeps --ignorearch --relocate=/usr="${abs_builddir}"/testing/check \ + -i "${tpkg}" ], [0]) AT_CHECK([ -run rpm \ - --root="${abs_builddir}"/testing \ +runroot rpm \ -q hello ], [0], @@ -124,8 +126,7 @@ ${abs_builddir}/testing/check/share/doc/hello-1.0/FAQ _ATEOF AT_CHECK([ -rpm \ - --root="${abs_builddir}"/testing \ +runroot rpm \ -ql hello ], [0], |