test: use setpriv instead of su for user switch from root
authorThomas Blume <Thomas.Blume@suse.com>
Tue, 14 Mar 2023 14:21:29 +0000 (15:21 +0100)
committerMike Yuan <me@yhndnzj.com>
Fri, 31 Mar 2023 14:26:44 +0000 (22:26 +0800)
commitc7bf1959d7580e1b7e918b75f852b3bf3fb6eb3c
treee69303cf1a769a5bd746cff0e2b49ada548d3c05
parent6f1fe575f0d293fa801e8f02374988f7bbf69dca
test: use setpriv instead of su for user switch from root

systemd-repart needs to find mkfs.ext4 for the test.
This is located in the directory /usr/sbin on openSUSE Tumbleweed.
But since the variable ALWAYS_SET_PATH in /etc/login.defs is set to yes,
su re-initializes the $PATH variable and removes /usr/sbin.
Hence, mkfs.ext4 is not found and the test fails.
Using setpriv instead of su fixes this issue and is more appropriate to
do the switch user task from root.

[zjs: move setpriv to $BASICTOOLS and force-push to retrigger CI]
test/test-functions
test/units/testsuite-20.sh
test/units/testsuite-43.sh
test/units/testsuite-58.sh