diff --git a/tests/README.md b/tests/README.md index 0ca94d1298..25e8e4c35f 100644 --- a/tests/README.md +++ b/tests/README.md @@ -156,7 +156,7 @@ as well as the existing tests. Below are the specifics of RPM's test-suite: * Use `RPMTEST_USER` to create a regular UNIX user in a mutable snapshot * The username is stored in the `$RPMUSER` environment variable * To run a binary as `$RPMUSER` inside the snapshot, use `runroot_user` - (this calls `sudo(8)` underneath) + (this calls `runuser(1)` underneath) * You can create a custom user (or users) by supplying a list of usernames to the macro, e.g. `RPMTEST_USER([user1, user2])`. Then, use `runroot_user -n ` to run a binary as a specific user diff --git a/tests/atlocal.in b/tests/atlocal.in index b939bfd25c..4caf35fc0c 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -139,7 +139,7 @@ runroot_user() shift 2 ;; esac - runroot --new-session sudo -iu $RPMUSER "$@" + runroot --new-session /sbin/runuser -u $RPMUSER -- "$@" } snapshot prune rpmtests.dir/*/tree diff --git a/tests/rpmdb.at b/tests/rpmdb.at index d39a6fd474..bd35442723 100644 --- a/tests/rpmdb.at +++ b/tests/rpmdb.at @@ -99,9 +99,7 @@ runroot rpm -U /data/RPMS/hlinktest-1.0-1.noarch.rpm []) RPMTEST_CHECK([ -# Need to pass the dbpath explicitly since we're not going through run/runroot -dbpath=$(rpm --eval "%_dbpath") -runroot /sbin/runuser -u nobody -- rpmdb --dbpath ${dbpath} --exportdb > hdr.list +runroot_user -n nobody rpmdb --exportdb > hdr.list ], [0], [], diff --git a/tests/rpmi.at b/tests/rpmi.at index 3e3bd8ae31..f7f323e8b2 100644 --- a/tests/rpmi.at +++ b/tests/rpmi.at @@ -1175,9 +1175,11 @@ RPMTEST_USER runroot rpmbuild --quiet -bb /data/SPECS/rootfs.spec +USERDIR=/tmp/mydir + RPMTEST_CHECK([ runroot_user \ - rpm -U --prefix \$PWD/root --dbpath \$PWD/rpmdb \ + rpm -U --prefix ${USERDIR}/root --dbpath ${USERDIR}/rpmdb \ /build/RPMS/noarch/rootfs-1.0-1.noarch.rpm ], [0], @@ -1185,8 +1187,8 @@ runroot_user \ []) RPMTEST_CHECK([ -runroot_user rpm -e --dbpath \$PWD/rpmdb rootfs -runroot_user test ! -d \$PWD/root +runroot_user rpm -e --dbpath ${USERDIR}/rpmdb rootfs +runroot_user test ! -d ${USERDIR}/root ], [0], [],