Skip to content

Commit 47e33ef

Browse files
yuwatabluca
authored andcommitted
test: wait for loop/backing_file attribute being removed
Hopefully fixes issue like systemd/systemd#32680 (comment) systemd/systemd#32680 (comment) (cherry picked from commit e504f5a) (cherry picked from commit 53a26a6) (cherry picked from commit d080d3d)
1 parent e50d939 commit 47e33ef

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/units/testsuite-74.mount.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,12 @@ test -e /run/media/system/simple.img/foo.bar
126126
# systemd-mount --list and systemd-umount require the loopback block device is initialized by udevd.
127127
udevadm settle --timeout 30
128128
assert_in "/dev/loop.* ext4 +sd-mount-test" "$(systemd-mount --list --full)"
129+
LOOP_AUTO=$(systemd-mount --list --full --no-legend | awk '$6 == "sd-mount-test" { print $1 }')
130+
LOOP_AUTO_DEVPATH=$(udevadm info --query property --property DEVPATH --value "$LOOP_AUTO")
129131
systemd-umount "$WORK_DIR/simple.img"
132+
# Wait for 'change' uevent for the device with DISK_MEDIA_CHANGE=1.
133+
# After the event, the backing_file attribute should be removed.
134+
timeout 60 bash -c "while [[ -e /sys/$LOOP_AUTO_DEVPATH/loop/backing_file ]]; do sleep 1; done"
130135

131136
# --owner + vfat
132137
#

0 commit comments

Comments
 (0)