2 # SPDX-License-Identifier: LGPL-2.1-or-later
3 # shellcheck disable=SC2010
4 # shellcheck disable=SC2012
5 # shellcheck disable=SC2317
9 # shellcheck source=test/units/util.sh
10 .
"$(dirname "$0")"/util.sh
12 # This is a test case for issue #34637.
17 systemctl stop test-diskseq.service ||
:
18 rm -f /run
/systemd
/system
/test-diskseq.service
19 systemctl daemon-reload
21 [[ -d "$TMPDIR" ]] && rm -rf "$TMPDIR"
23 udevadm control
--log-level=info
28 udevadm control
--log-level=debug
31 truncate
-s 16M
"$TMPDIR"/foo.raw
32 mkfs.ext4
-L foo
"$TMPDIR"/foo.raw
34 mkdir
-p /run
/systemd
/system
/
35 cat >/run
/systemd
/system
/test-diskseq.service
<<EOF
37 StartLimitIntervalSec=0
41 MountImages=$TMPDIR/foo.raw:/var
43 systemctl daemon-reload
47 # Check if no lock file exists, if the lock directory exists.
48 if [[ -d /run
/udev
/links.lock
/ ]]; then
49 [[ "$(ls /run/udev/links.lock/ | wc -l)" == 0 ]]
52 # Save the current number of the directories.
53 NUM_DISKSEQ
=$
(ls /run
/udev
/links
/ |
grep -c by-diskseq ||
:)
55 systemctl start
--no-block test-diskseq.service
59 n
=$
(ls /run
/udev
/links
/ |
grep -c by-diskseq ||
:)
60 (( n
<= NUM_DISKSEQ
+ 1 ))
63 systemctl stop test-diskseq.service ||
:
67 # Check if the lock directory exists, but no lock file exists in it.
68 [[ -d /run
/udev
/links.lock
/ ]]
69 [[ "$(ls /run/udev/links.lock/ | wc -l)" == 0 ]]