summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2023-03-17 10:00:43 +0100
committerGitHub <noreply@github.com>2023-03-17 10:00:43 +0100
commit6742397921a846668f0e4f6da09075ac24a0f634 (patch)
tree3aa39b035a4f25e3fcb61068855c1ab65db0b2cf /test
parent58dfcc57f25f99fe541d67ef15b6c66dfc40912b (diff)
parent91ea97356c1799d7ac6b54713eb059c220f66d29 (diff)
downloadsystemd-6742397921a846668f0e4f6da09075ac24a0f634.tar.gz
Merge pull request #26783 from yuwata/loop-ref-follow-up
udev: slightly extend comment and add more tests
Diffstat (limited to 'test')
-rwxr-xr-xtest/units/testsuite-50.sh22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/units/testsuite-50.sh b/test/units/testsuite-50.sh
index 741167a215..af7d351154 100755
--- a/test/units/testsuite-50.sh
+++ b/test/units/testsuite-50.sh
@@ -447,8 +447,28 @@ fi
# Detach by loopback device
systemd-dissect --detach "$LOOP"
+# Test long reference name.
+# Note, sizeof_field(struct loop_info64, lo_file_name) == 64,
+# and --loop-ref accepts upto 63 characters, and udev creates symlink
+# based on the name when it has upto _62_ characters.
+name="$(for (( i = 0; i < 62; i++ )); do echo -n 'x'; done)"
+LOOP="$(systemd-dissect --attach --loop-ref="$name" "${image}.raw")"
+udevadm trigger -w "$LOOP"
+
+# Check if the /dev/loop/by-ref/$name symlink really references the right device
+test "/dev/loop/by-ref/$name" -ef "$LOOP"
+
+# Detach by the /dev/loop/by-ref symlink
+systemd-dissect --detach "/dev/loop/by-ref/$name"
+
+name="$(for (( i = 0; i < 63; i++ )); do echo -n 'x'; done)"
+LOOP="$(systemd-dissect --attach --loop-ref="$name" "${image}.raw")"
+udevadm trigger -w "$LOOP"
+
+# Check if the /dev/loop/by-ref/$name symlink does not exist
+test ! -e "/dev/loop/by-ref/$name"
+
# Detach by backing inode
-systemd-dissect --attach --loop-ref=waldo "${image}.raw"
systemd-dissect --detach "${image}.raw"
(! systemd-dissect --detach "${image}.raw")