mirror of
https://github.com/systemd/systemd
synced 2024-10-15 20:45:09 +00:00
test: coverage for #19946
This commit is contained in:
parent
d430e451c9
commit
35497c7c33
|
@ -230,6 +230,22 @@ EOF
|
|||
test_run_one "${1:?}"
|
||||
}
|
||||
|
||||
# Test case for issue https://github.com/systemd/systemd/issues/19946
|
||||
testcase_simultaneous_events() {
|
||||
local qemu_opts=("-device virtio-scsi-pci,id=scsi")
|
||||
local partdisk="${TESTDIR:?}/simultaneousevents.img"
|
||||
|
||||
dd if=/dev/zero of="$partdisk" bs=1M count=110
|
||||
qemu_opts+=(
|
||||
"-device scsi-hd,drive=drive1,serial=deadbeeftest"
|
||||
"-drive format=raw,cache=unsafe,file=$partdisk,if=none,id=drive1"
|
||||
)
|
||||
|
||||
KERNEL_APPEND="systemd.setenv=TEST_FUNCTION_NAME=${FUNCNAME[0]} ${USER_KERNEL_APPEND:-}"
|
||||
QEMU_OPTIONS="${qemu_opts[*]} ${USER_QEMU_OPTIONS:-}"
|
||||
test_run_one "${1:?}"
|
||||
}
|
||||
|
||||
# Allow overriding which tests should be run from the "outside", useful for manual
|
||||
# testing (make -C test/... TESTCASES="testcase1 testcase2")
|
||||
if [[ -v "TESTCASES" && -n "$TESTCASES" ]]; then
|
||||
|
|
|
@ -140,6 +140,43 @@ EOF
|
|||
rm -fr "$mpoint"
|
||||
}
|
||||
|
||||
testcase_simultaneous_events() {
|
||||
local blockdev part partscript
|
||||
|
||||
blockdev="$(readlink -f /dev/disk/by-id/scsi-*_deadbeeftest)"
|
||||
partscript="$(mktemp)"
|
||||
|
||||
if [[ ! -b "$blockdev" ]]; then
|
||||
echo "ERROR: failed to find the test SCSI block device"
|
||||
return 1
|
||||
fi
|
||||
|
||||
cat >"$partscript" <<EOF
|
||||
$(printf 'name="test%d", size=2M\n' {1..50})
|
||||
EOF
|
||||
|
||||
# Initial partition table
|
||||
sfdisk -q -X gpt "$blockdev" <"$partscript"
|
||||
|
||||
# Delete the partitions, immediatelly recreate them, wait for udev to settle
|
||||
# down, and then check if we have any dangling symlinks in /dev/disk/. Rinse
|
||||
# and repeat.
|
||||
#
|
||||
# On unpatched udev versions the delete-recreate cycle may trigger a race
|
||||
# leading to dead symlinks in /dev/disk/
|
||||
for i in {1..100}; do
|
||||
sfdisk -q --delete "$blockdev"
|
||||
sfdisk -q -X gpt "$blockdev" <"$partscript"
|
||||
|
||||
if ((i % 10 == 0)); then
|
||||
udevadm settle
|
||||
helper_check_device_symlinks
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f "$partscript"
|
||||
}
|
||||
|
||||
: >/failed
|
||||
|
||||
udevadm settle
|
||||
|
|
Loading…
Reference in a new issue