mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-03-12 08:58:20 +03:00
test: add test case for issue #34637
(cherry picked from commit 88d186e4829bc7ef4a4253fe2bf4857903bca830) (cherry picked from commit 7b9e412d8aba8f415f35d02da5e5fa5bd92632cc) (cherry picked from commit d0569c4405841779a89c3bc9594de99ae5ebe3f8) (cherry picked from commit 42f7d15e0a9ebf08c088e638a3e416dd8af8e90f) (cherry picked from commit 916fb2dcc8d5696e825e5d5b029b4513f06f8af0)
This commit is contained in:
parent
dc0da55a33
commit
ac307521cd
57
test/units/testsuite-17.14.sh
Executable file
57
test/units/testsuite-17.14.sh
Executable file
@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
# shellcheck disable=SC2010
|
||||
# shellcheck disable=SC2317
|
||||
set -ex
|
||||
set -o pipefail
|
||||
|
||||
# shellcheck source=test/units/assert.sh
|
||||
. "$(dirname "$0")"/assert.sh
|
||||
|
||||
# This is a test case for issue #34637.
|
||||
|
||||
at_exit() (
|
||||
set +e
|
||||
|
||||
systemctl stop test-diskseq.service || :
|
||||
rm -f /run/systemd/system/test-diskseq.service
|
||||
systemctl daemon-reload
|
||||
|
||||
[[ -d "$TMPDIR" ]] && rm -rf "$TMPDIR"
|
||||
|
||||
udevadm control --log-level=info
|
||||
)
|
||||
|
||||
trap at_exit EXIT
|
||||
|
||||
udevadm control --log-level=debug
|
||||
|
||||
TMPDIR="$(mktemp -d)"
|
||||
truncate -s 16M "$TMPDIR"/foo.raw
|
||||
mkfs.ext4 -L foo "$TMPDIR"/foo.raw
|
||||
|
||||
mkdir -p /run/systemd/system/
|
||||
cat >/run/systemd/system/test-diskseq.service <<EOF
|
||||
[Unit]
|
||||
StartLimitIntervalSec=0
|
||||
[Service]
|
||||
ExecStart=false
|
||||
Restart=on-failure
|
||||
MountImages=$TMPDIR/foo.raw:/var
|
||||
EOF
|
||||
systemctl daemon-reload
|
||||
|
||||
udevadm settle
|
||||
|
||||
# If an initrd from the host is used, stack directories for by-diskseq symlinks
|
||||
# may already exist. Save the number of the directories here.
|
||||
NUM_DISKSEQ_EXPECTED=$(ls /run/udev/links | grep -c by-diskseq || :)
|
||||
|
||||
systemctl start --no-block test-diskseq.service
|
||||
|
||||
for _ in {0..100}; do
|
||||
sleep .1
|
||||
assert_eq "$(ls /run/udev/links | grep -c by-diskseq || :)" "$NUM_DISKSEQ_EXPECTED"
|
||||
done
|
||||
|
||||
exit 0
|
Loading…
x
Reference in New Issue
Block a user