mirror of
https://github.com/systemd/systemd
synced 2024-09-06 16:56:43 +00:00
TEST-74-AUX-UTILS: Skip run0 test if pam snippet is not installed
This commit is contained in:
parent
a2190c22b8
commit
da87c35f35
|
@ -231,15 +231,17 @@ assert_eq "$KVER" "$UNIT_KVER"
|
|||
umount /proc/version
|
||||
rm -f "$TMP_KVER"
|
||||
|
||||
# Check that invoking the tool under the run0 alias name works
|
||||
run0 ls /
|
||||
assert_eq "$(run0 echo foo)" "foo"
|
||||
# Check if we set some expected environment variables
|
||||
for arg in "" "--user=root" "--user=testuser"; do
|
||||
if [[ -e /usr/lib/pam.d/systemd-run0 ]] || [[ -e /etc/pam.d/systemd-run0 ]]; then
|
||||
# Check that invoking the tool under the run0 alias name works
|
||||
run0 ls /
|
||||
assert_eq "$(run0 echo foo)" "foo"
|
||||
# Check if we set some expected environment variables
|
||||
for arg in "" "--user=root" "--user=testuser"; do
|
||||
assert_eq "$(run0 ${arg:+"$arg"} bash -c 'echo $SUDO_USER')" "$USER"
|
||||
assert_eq "$(run0 ${arg:+"$arg"} bash -c 'echo $SUDO_UID')" "$(id -u "$USER")"
|
||||
assert_eq "$(run0 ${arg:+"$arg"} bash -c 'echo $SUDO_GID')" "$(id -u "$USER")"
|
||||
done
|
||||
# Let's chain a couple of run0 calls together, for fun
|
||||
readarray -t cmdline < <(printf "%.0srun0\n" {0..31})
|
||||
assert_eq "$("${cmdline[@]}" bash -c 'echo $SUDO_USER')" "$USER"
|
||||
done
|
||||
# Let's chain a couple of run0 calls together, for fun
|
||||
readarray -t cmdline < <(printf "%.0srun0\n" {0..31})
|
||||
assert_eq "$("${cmdline[@]}" bash -c 'echo $SUDO_USER')" "$USER"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue