]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: optionally wait a bit when checking the mount unit
authorFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 3 Aug 2022 10:35:49 +0000 (12:35 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 3 Aug 2022 15:39:19 +0000 (15:39 +0000)
On fast systems we might race against systemd and check the mount unit
after mounting it way too early before systemd had a chance to react to
the change.

```
[    4.677701] H systemd[1]: Event source 0x210b3b0 (mount-monitor-dispatch) entered rate limit state.
...
[    4.863731] H testsuite-64.sh[812]: + mount /logsysfsRxx
[    4.865918] H kernel: EXT4-fs (vda2): mounted filesystem with ordered data mode. Opts: (null)
[    4.866213] H testsuite-64.sh[812]: + systemctl status /logsysfsRxx
[    4.877502] H testsuite-64.sh[919]: ○ logsysfsRxx.mount - /logsysfsRxx
[    4.877502] H testsuite-64.sh[919]:      Loaded: loaded (/etc/fstab; generated)
[    4.877502] H testsuite-64.sh[919]:      Active: inactive (dead)
[    4.877502] H testsuite-64.sh[919]:       Where: /logsysfsRxx
[    4.877502] H testsuite-64.sh[919]:        What: /dev/disk/by-uuid/deadbeef-dead-dead-beef-222222222222
[    4.877502] H testsuite-64.sh[919]:        Docs: man:fstab(5)
[    4.877502] H testsuite-64.sh[919]:              man:systemd-fstab-generator(8)
[    4.877502] H testsuite-64.sh[919]: Aug 03 10:10:10 H systemd[1]: logsysfsRxx.mount: Processing implicit device dependencies
[    4.877502] H testsuite-64.sh[919]: Aug 03 10:10:10 H systemd[1]: logsysfsRxx.mount: Added Requires dependency on /dev/disk/by-uuid/deadbeef-dead-dead-beef-222222222222
[    4.877502] H testsuite-64.sh[919]: Aug 03 10:10:10 H systemd[1]: logsysfsRxx.mount: Added StopPropagatedFrom dependency on /dev/disk/by-uuid/deadbeef-dead-dead-beef-222222222222
[    4.895683] H sh[920]: + systemctl poweroff --no-block
[    4.906533] H systemd[1]: Found unit logsysfsRxx.mount at /run/systemd/generator/logsysfsRxx.mount (regular file)
[    4.906594] H systemd[1]: Preset files don't specify rule for logsysfsRxx.mount. Enabling.
[    4.906990] H systemd[1]: testsuite-64.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
[    4.907057] H systemd[1]: testsuite-64.service: Failed with result 'exit-code'.
[    4.907287] H systemd[1]: Failed to start testsuite-64.service.
[    4.955293] H systemd[1]: Starting end.service...
[    4.955736] H systemd-logind[809]: The system will power off now!
[    4.955868] H systemd-logind[809]: System is powering down.
[    4.975781] H systemd[1]: Event source 0x210b3b0 (mount-monitor-dispatch) left rate limit state.
[    4.975821] H systemd[1]: logsysfsRxx.mount: Processing implicit device dependencies
[    4.975857] H systemd[1]: logsysfsRxx.mount: Added Requires dependency on /dev/vda2
[    4.975893] H systemd[1]: logsysfsRxx.mount: Added StopPropagatedFrom dependency on /dev/vda2
[    4.975928] H systemd[1]: Unit blockdev@dev-vda2.target has alias blockdev@.target.
[    4.975967] H systemd[1]: logsysfsRxx.mount: Added After dependency on /dev/vda2
[    4.976081] H systemd[1]: logsysfsRxx.mount: Changed dead -> mounted
```

test/units/testsuite-64.sh

index 3d0995b2f2ded7039db1ac574db50f8911e09ea3..05a012b2b128ab9942816cf3fb08901514616511 100755 (executable)
@@ -531,7 +531,7 @@ testcase_long_sysfs_path() {
     echo "UUID=deadbeef-dead-dead-beef-222222222222 $mpoint ext4 defaults 0 0" >>/etc/fstab
     systemctl daemon-reload
     mount "$mpoint"
-    systemctl status "$mpoint"
+    timeout 30 bash -c "while ! systemctl -q is-active '$mpoint'; do sleep .2; done"
     test -e "$mpoint/test"
     umount "$mpoint"