Skip to content

Commit e50d939

Browse files
yuwatabluca
authored andcommitted
test: wait for unit generated from /proc/self/mountinfo to be unloaded
Fixes systemd/systemd#32680 (comment). === May 21 02:45:08 TEST-74-AUX-UTILS.sh[2475]: + mountpoint /tmp/tmp.eaRV7lSbX2/mnt May 21 02:45:08 TEST-74-AUX-UTILS.sh[2476]: /tmp/tmp.eaRV7lSbX2/mnt is not a mountpoint May 21 02:45:08 TEST-74-AUX-UTILS.sh[2449]: + systemd-mount /dev/loop0 /tmp/tmp.eaRV7lSbX2/mnt May 21 02:45:08 systemd-mount[2477]: Failed to start transient mount unit: Unit tmp-tmp.eaRV7lSbX2-mnt.mount was already loaded or has a fragment file. === (cherry picked from commit 4a8ca3c) (cherry picked from commit 1a6a2d8) (cherry picked from commit 861affe)
1 parent 94081ff commit e50d939

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

test/units/testsuite-74.mount.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ mount "$LOOP" "$WORK_DIR/mnt"
3939
touch "$WORK_DIR/mnt/foo.bar"
4040
umount "$LOOP"
4141
(! mountpoint "$WORK_DIR/mnt")
42+
# Wait for the mount unit to be unloaded. Otherwise, creation of the transient unit below may fail.
43+
MOUNT_UNIT=$(systemd-escape --path --suffix=mount "$WORK_DIR/mnt")
44+
timeout 60 bash -c "while [[ -n \$(systemctl list-units --all --no-legend $MOUNT_UNIT) ]]; do sleep 1; done"
4245

4346
# Mount with both source and destination set
4447
systemd-mount "$LOOP" "$WORK_DIR/mnt"

0 commit comments

Comments
 (0)