File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # SPDX-License-Identifier: LGPL-2.1-or-later
3+ # shellcheck disable=SC2010
4+ # shellcheck disable=SC2317
5+ set -ex
6+ set -o pipefail
7+
8+ # shellcheck source=test/units/assert.sh
9+ . " $( dirname " $0 " ) " /assert.sh
10+
11+ # This is a test case for issue #34637.
12+
13+ at_exit () (
14+ set +e
15+
16+ systemctl stop test-diskseq.service || :
17+ rm -f /run/systemd/system/test-diskseq.service
18+ systemctl daemon-reload
19+
20+ [[ -d " $TMPDIR " ]] && rm -rf " $TMPDIR "
21+
22+ udevadm control --log-level=info
23+ )
24+
25+ trap at_exit EXIT
26+
27+ udevadm control --log-level=debug
28+
29+ TMPDIR=" $( mktemp -d) "
30+ truncate -s 16M " $TMPDIR " /foo.raw
31+ mkfs.ext4 -L foo " $TMPDIR " /foo.raw
32+
33+ mkdir -p /run/systemd/system/
34+ cat > /run/systemd/system/test-diskseq.service << EOF
35+ [Unit]
36+ StartLimitIntervalSec=0
37+ [Service]
38+ ExecStart=false
39+ Restart=on-failure
40+ MountImages=$TMPDIR /foo.raw:/var
41+ EOF
42+ systemctl daemon-reload
43+
44+ udevadm settle
45+
46+ # If an initrd from the host is used, stack directories for by-diskseq symlinks
47+ # may already exist. Save the number of the directories here.
48+ NUM_DISKSEQ_EXPECTED=$( ls /run/udev/links | grep -c by-diskseq || :)
49+
50+ systemctl start --no-block test-diskseq.service
51+
52+ for _ in {0..100}; do
53+ sleep .1
54+ assert_eq " $( ls /run/udev/links | grep -c by-diskseq || :) " " $NUM_DISKSEQ_EXPECTED "
55+ done
56+
57+ exit 0
You can’t perform that action at this time.
0 commit comments