]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: fix a race in the systemd-mount test
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 8 Nov 2022 11:01:13 +0000 (12:01 +0100)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 8 Nov 2022 11:01:13 +0000 (12:01 +0100)
Where we might check the automount unit before systemd has a chance to
react.

test/units/testsuite-74.mount.sh

index 33322fc7722fded3f377abfa085c9a2ae624bc76..32bdb3037fb5e9d4f4b3311c90d3bf73ff23083e 100755 (executable)
@@ -99,8 +99,8 @@ systemctl status "$(systemd-escape --path "$WORK_DIR/mnt").automount"
 # Disassemble the underlying block device
 losetup -d "$LOOP"
 unset LOOP
-# The automount unit should be gone at this point
-(! systemctl status "$(systemd-escape --path "$WORK_DIR/mnt").automount")
+# The automount unit should disappear once the underlying blockdev is gone
+timeout 10s bash -c "while systemctl status '$(systemd-escape --path "$WORK_DIR/mnt").automount)'; do sleep .2; done"
 
 # Mount a disk image
 systemd-mount "$WORK_DIR/simple.img"