summaryrefslogtreecommitdiff
path: root/tests/misc/chroot-credentials
diff options
context:
space:
mode:
Diffstat (limited to 'tests/misc/chroot-credentials')
-rwxr-xr-xtests/misc/chroot-credentials13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/misc/chroot-credentials b/tests/misc/chroot-credentials
index cfa903dd5..2bce5cfd9 100755
--- a/tests/misc/chroot-credentials
+++ b/tests/misc/chroot-credentials
@@ -28,12 +28,17 @@ test $(chroot / whoami) = root || fail=1
test "$(groups)" = "$(chroot / groups)" || fail=1
# Verify that credentials are changed correctly.
-test "$(chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP / whoami)" != root \
- || fail=1
+whoami_after_chroot=$(
+ chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP / whoami
+)
+test "$whoami_after_chroot" != root || fail=1
# Verify that there are no additional groups.
-test "$(chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP --groups=$NON_ROOT_GROUP / id -G)"\
- = $NON_ROOT_GROUP || fail=1
+id_G_after_chroot=$(
+ chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP \
+ --groups=$NON_ROOT_GROUP / id -G
+)
+test "$id_G_after_chroot" = $NON_ROOT_GROUP || fail=1
# Verify that when specifying only the user name we get the current
# primary group ID.