test: add another stress test for devlink creation

This commit is contained in:
Yu Watanabe 2023-01-16 11:00:04 +09:00
parent 60c5bd7759
commit a2e41b817b
2 changed files with 69 additions and 2 deletions

View File

@ -347,7 +347,7 @@ testcase_simultaneous_events() {
for i in {0..9}; do
diskpath="${TESTDIR:?}/simultaneousevents${i}.img"
dd if=/dev/zero of="$diskpath" bs=1M count=32
dd if=/dev/zero of="$diskpath" bs=1M count=128
qemu_opts+=(
"-device scsi-hd,drive=drive$i,serial=deadbeeftest$i"
"-drive format=raw,cache=unsafe,file=$diskpath,if=none,id=drive$i"

View File

@ -302,7 +302,7 @@ EOF
rm -fr "$mpoint"
}
testcase_simultaneous_events() {
testcase_simultaneous_events_1() {
local disk expected i iterations key link num_part part partscript rule target timeout
local -a devices symlinks
local -A running
@ -395,6 +395,73 @@ EOF
udevadm control --reload
}
testcase_simultaneous_events_2() {
local disk expected i iterations key link num_part part partscript target timeout
local -a devices symlinks
local -A running
if [[ -v ASAN_OPTIONS || "$(systemd-detect-virt -v)" == "qemu" ]]; then
num_part=20
iterations=1
timeout=2400
else
num_part=100
iterations=3
timeout=300
fi
for disk in {0..9}; do
link="/dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_deadbeeftest${disk}"
target="$(readlink -f "$link")"
if [[ ! -b "$target" ]]; then
echo "ERROR: failed to find the test SCSI block device $link"
return 1
fi
devices+=("$target")
done
symlinks=("/dev/disk/by-partlabel/testlabel")
partscript="$(mktemp)"
cat >"$partscript" <<EOF
$(for ((part = 1; part <= num_part; part++)); do printf 'name="testlabel", size=1M\n'; done)
EOF
echo "## $iterations iterations start: $(date '+%H:%M:%S.%N')"
for ((i = 1; i <= iterations; i++)); do
for disk in {0..9}; do
udevadm lock --device="${devices[$disk]}" sfdisk -q --delete "${devices[$disk]}" &
running[$disk]=$!
done
for key in "${!running[@]}"; do
wait "${running[$key]}"
unset "running[$key]"
done
for disk in {0..9}; do
udevadm lock --device="${devices[$disk]}" sfdisk -q -X gpt "${devices[$disk]}" <"$partscript" &
running[$disk]=$!
done
for key in "${!running[@]}"; do
wait "${running[$key]}"
unset "running[$key]"
done
udevadm wait --settle --timeout="$timeout" "${devices[@]}" "${symlinks[@]}"
done
echo "## $iterations iterations end: $(date '+%H:%M:%S.%N')"
}
testcase_simultaneous_events() {
testcase_simultaneous_events_1
testcase_simultaneous_events_2
}
testcase_lvm_basic() {
local i iterations partitions part timeout
local vgroup="MyTestGroup$RANDOM"