hwdb: fix screen rotation for EXO Wings 2in1 w1125 (#36283)
[systemd.io.git] / test / units / TEST-17-UDEV.diskseq.sh
blob53ee666984f6320d9161fe505a2f4a0facde32b6
1 #!/usr/bin/env bash
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3 # shellcheck disable=SC2010
4 # shellcheck disable=SC2012
5 # shellcheck disable=SC2317
6 set -ex
7 set -o pipefail
9 # shellcheck source=test/units/util.sh
10 . "$(dirname "$0")"/util.sh
12 # This is a test case for issue #34637.
14 at_exit() (
15 set +e
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
26 trap at_exit EXIT
28 udevadm control --log-level=debug
30 TMPDIR="$(mktemp -d)"
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
36 [Unit]
37 StartLimitIntervalSec=0
38 [Service]
39 ExecStart=false
40 Restart=on-failure
41 MountImages=$TMPDIR/foo.raw:/var
42 EOF
43 systemctl daemon-reload
45 udevadm settle
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
57 for _ in {0..100}; do
58 sleep .1
59 n=$(ls /run/udev/links/ | grep -c by-diskseq || :)
60 (( n <= NUM_DISKSEQ + 1 ))
61 done
63 systemctl stop test-diskseq.service || :
65 udevadm settle
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 ]]
71 exit 0