mirror of
https://github.com/systemd/systemd.git
synced 2025-03-06 00:58:29 +03:00
test: wait for underlying .device unit being active before invoking systemd-mount
Fixes following failure: === May 17 04:12:04 TEST-74-AUX-UTILS.sh[2684]: + systemd-mount --owner=testuser /dev/loop0 /tmp/tmp.DVQdo2ou53/mnt (snip) May 17 04:15:04 systemd[1]: dev-loop0.device: Job dev-loop0.device/start timed out. May 17 04:15:04 systemd[1]: dev-loop0.device: Job 5812 dev-loop0.device/start finished, result=timeout May 17 04:15:04 systemd[1]: Timed out waiting for device dev-loop0.device - /dev/loop0. May 17 04:15:04 systemd[1]: tmp-tmp.DVQdo2ou53-mnt.mount: Job 5804 tmp-tmp.DVQdo2ou53-mnt.mount/start finished, result=dependency May 17 04:15:04 systemd[1]: Dependency failed for tmp-tmp.DVQdo2ou53-mnt.mount - /tmp/tmp.DVQdo2ou53/mnt. May 17 04:15:04 systemd[1]: tmp-tmp.DVQdo2ou53-mnt.mount: Job tmp-tmp.DVQdo2ou53-mnt.mount/start failed with result 'dependency'. May 17 04:15:04 systemd[1]: systemd-fsck@dev-loop0.service: Job 5805 systemd-fsck@dev-loop0.service/start finished, result=dependency May 17 04:15:04 systemd[1]: Dependency failed for systemd-fsck@dev-loop0.service - File System Check on /dev/loop0. May 17 04:15:04 systemd[1]: systemd-fsck@dev-loop0.service: Job systemd-fsck@dev-loop0.service/start failed with result 'dependency'. May 17 04:15:04 systemd[1]: dev-loop0.device: Job dev-loop0.device/start failed with result 'timeout'. (snip) May 17 04:15:04 systemd-mount[2856]: A dependency job for tmp-tmp.DVQdo2ou53-mnt.mount failed. See 'journalctl -xe' for details.
This commit is contained in:
parent
514458604b
commit
19da480d3c
@ -35,6 +35,9 @@ dd if=/dev/zero of="$WORK_DIR/simple.img" bs=1M count=16
|
||||
mkfs.ext4 -L sd-mount-test "$WORK_DIR/simple.img"
|
||||
LOOP="$(losetup --show --find "$WORK_DIR/simple.img")"
|
||||
udevadm wait --timeout 60 --settle "$LOOP"
|
||||
# Also wait for the .device unit for the loop device is active. Otherwise, the .device unit activation
|
||||
# that is triggered by the .mount unit introduced by systemd-mount below may time out.
|
||||
timeout 60 bash -c "until systemctl is-active $LOOP; do sleep 1; done"
|
||||
mkdir "$WORK_DIR/mnt"
|
||||
mount "$LOOP" "$WORK_DIR/mnt"
|
||||
touch "$WORK_DIR/mnt/foo.bar"
|
||||
@ -134,6 +137,9 @@ dd if=/dev/zero of="$WORK_DIR/owner-vfat.img" bs=1M count=16
|
||||
mkfs.vfat -n owner-vfat "$WORK_DIR/owner-vfat.img"
|
||||
LOOP="$(losetup --show --find "$WORK_DIR/owner-vfat.img")"
|
||||
udevadm wait --timeout 60 --settle "$LOOP"
|
||||
# Also wait for the .device unit for the loop device is active. Otherwise, the .device unit activation
|
||||
# that is triggered by the .mount unit introduced by systemd-mount below may time out.
|
||||
timeout 60 bash -c "until systemctl is-active $LOOP; do sleep 1; done"
|
||||
# Mount it and check the UID/GID
|
||||
[[ "$(stat -c "%U:%G" "$WORK_DIR/mnt")" == "root:root" ]]
|
||||
systemd-mount --owner=testuser "$LOOP" "$WORK_DIR/mnt"
|
||||
|
Loading…
x
Reference in New Issue
Block a user