]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-46-HOMED: check for support on /dev/shm and /tmp separately
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 29 Mar 2025 08:24:34 +0000 (09:24 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 1 Apr 2025 12:16:40 +0000 (14:16 +0200)
The test fails in CI. My guess was this is because the enablement of quota on
/tmp and /dev/shm is independent. The former fs is mounted by systemd in the
host, while the latter is mounted in the initrd, so we can end up with quota
support on one but not the other, which is the situation I had on my laptop.
This wasn't actually the source of the problems in CI, but it's a reasonable
change to make anyway.

While at it, test both mountpoints separately.

test/units/TEST-46-HOMED.sh

index 3bd6ebda480b33fac9a322ec13757627917ac7df..d1a6ea2fc592cb7a3f39ebfa89dceb76421122ad 100755 (executable)
@@ -665,24 +665,22 @@ getent passwd aliastest@myrealm
 getent passwd aliastest2@myrealm
 getent passwd aliastest3@myrealm
 
-if findmnt -n -o options /tmp | grep -q usrquota ; then
-
-    NEWPASSWORD=quux homectl create tmpfsquota --storage=subvolume --dev-shm-limit=50K -P
-
-    run0 --property=SetCredential=pam.authtok.systemd-run0:quux -u tmpfsquota dd if=/dev/zero of=/dev/shm/quotatestfile1 bs=1024 count=30
-    (! run0 --property=SetCredential=pam.authtok.systemd-run0:quux -u tmpfsquota dd if=/dev/zero of=/dev/shm/quotatestfile2 bs=1024 count=30)
-    run0 --property=SetCredential=pam.authtok.systemd-run0:quux -u tmpfsquota rm /dev/shm/quotatestfile1 /dev/shm/quotatestfile2
-    run0 --property=SetCredential=pam.authtok.systemd-run0:quux -u tmpfsquota dd if=/dev/zero of=/dev/shm/quotatestfile1 bs=1024 count=30
-    run0 --property=SetCredential=pam.authtok.systemd-run0:quux -u tmpfsquota rm /dev/shm/quotatestfile1
-
-    systemctl stop user@"$(id -u tmpfsquota)".service
+NEWPASSWORD=quux homectl create tmpfsquota --storage=subvolume --dev-shm-limit=50K --tmp-limit=50K -P
+for p in /dev/shm /tmp; do
+    if findmnt -n -o options "$p" | grep -q usrquota; then
+        run0 --property=SetCredential=pam.authtok.systemd-run0:quux -u tmpfsquota dd if=/dev/zero of="$p/quotatestfile1" bs=1024 count=30
+        (! run0 --property=SetCredential=pam.authtok.systemd-run0:quux -u tmpfsquota dd if=/dev/zero of="$p/quotatestfile2" bs=1024 count=30)
+        run0 --property=SetCredential=pam.authtok.systemd-run0:quux -u tmpfsquota rm "$p/quotatestfile1" "$p/quotatestfile2"
+        run0 --property=SetCredential=pam.authtok.systemd-run0:quux -u tmpfsquota dd if=/dev/zero of="$p/quotatestfile1" bs=1024 count=30
+        run0 --property=SetCredential=pam.authtok.systemd-run0:quux -u tmpfsquota rm "$p/quotatestfile1"
+    fi
+done
 
-    wait_for_state tmpfsquota inactive
-    homectl remove tmpfsquota
-fi
+systemctl stop user@"$(id -u tmpfsquota)".service
+wait_for_state tmpfsquota inactive
+homectl remove tmpfsquota
 
 NEWPASSWORD=quux homectl create subareatest --storage=subvolume -P
-
 run0 --property=SetCredential=pam.authtok.systemd-run0:quux -u subareatest mkdir Areas
 run0 --property=SetCredential=pam.authtok.systemd-run0:quux -u subareatest cp -av /etc/skel Areas/furb
 run0 --property=SetCredential=pam.authtok.systemd-run0:quux -u subareatest cp -av /etc/skel Areas/molb