]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: check if x-systemd.automount is ignored for rootfs
authorFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 8 Apr 2023 18:49:14 +0000 (20:49 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Fri, 14 Apr 2023 08:45:20 +0000 (10:45 +0200)
test/units/testsuite-81.fstab-generator.sh

index b57a2c7d67b26c44ac2b124dbd5488f052528978..20b9d0f19ad043cd753e3abe80d2cbc0a50a6810 100755 (executable)
@@ -63,7 +63,7 @@ FSTAB_GENERAL=(
 
 FSTAB_GENERAL_ROOT=(
     # rootfs with bunch of options we should ignore and fsck enabled
-    "/dev/test1     /                                   ext4        noauto,nofail,automount,x-systemd.wanted-by=foo,x-systemd.required-by=bar 0 1"
+    "/dev/test1     /                                   ext4        noauto,nofail,x-systemd.automount,x-systemd.wanted-by=foo,x-systemd.required-by=bar 0 1"
     "${FSTAB_GENERAL[@]}"
 )
 
@@ -249,8 +249,14 @@ check_fstab_mount_units() {
             elif [[ "$opt" == x-systemd.automount ]]; then
                 # The $unit should have an accompanying automount unit
                 supp="$(systemd-escape --suffix=automount --path "$where")"
-                test -e "$out_dir/$supp"
-                link_eq "$out_dir/local-fs.target.requires/$supp" "../$supp"
+                if [[ "$where" == / ]]; then
+                    # This option is ignored for rootfs mounts
+                    test ! -e "$out_dir/$supp"
+                    (! link_eq "$out_dir/local-fs.target.requires/$supp" "../$supp")
+                else
+                    test -e "$out_dir/$supp"
+                    link_eq "$out_dir/local-fs.target.requires/$supp" "../$supp"
+                fi
             elif [[ "$opt" =~ ^x-systemd.idle-timeout= ]]; then
                 # The timeout applies to the automount unit, not the original
                 # mount one