]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: replace tmpfs with vfat when testing --owner= 25286/head
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 7 Nov 2022 14:55:08 +0000 (15:55 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 7 Nov 2022 14:59:37 +0000 (15:59 +0100)
test/units/testsuite-74.mount.sh

index 95d17c78baf5cfe376d671795a66088fee69f82f..33322fc7722fded3f377abfa085c9a2ae624bc76 100755 (executable)
@@ -108,9 +108,18 @@ systemd-mount --list --full
 test -e /run/media/system/simple.img/foo.bar
 systemd-umount "$WORK_DIR/simple.img"
 
-# --owner + tmpfs
+# --owner + vfat
+#
+# Create a vfat image, as ext4 doesn't support uid=/gid= fixating for all
+# files/directories
+dd if=/dev/zero of="$WORK_DIR/owner-vfat.img" bs=1M count=16
+LOOP="$(losetup --show --find "$WORK_DIR/owner-vfat.img")"
+mkfs.vfat -n owner-vfat "$LOOP"
+# Mount it and check the UID/GID
 [[ "$(stat -c "%U:%G" "$WORK_DIR/mnt")" == "root:root" ]]
-systemd-mount --owner testuser -t tmpfs tmpfs "$WORK_DIR/mnt"
+systemd-mount --owner testuser "$LOOP" "$WORK_DIR/mnt"
 systemctl status "$WORK_DIR/mnt"
 [[ "$(stat -c "%U:%G" "$WORK_DIR/mnt")" == "testuser:testuser" ]]
-systemd-umount "$WORK_DIR/mnt"
+touch "$WORK_DIR/mnt/hello"
+[[ "$(stat -c "%U:%G" "$WORK_DIR/mnt/hello")" == "testuser:testuser" ]]
+systemd-umount LABEL=owner-vfat