mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
test-64-udev-storage: partition disk inside testcase - testcase_virtio_scsi_identically_named_partitions
This commit is contained in:
parent
8d82e39046
commit
211062e3b5
@ -268,24 +268,15 @@ testcase_virtio_scsi_identically_named_partitions() {
|
||||
# and attach them to a virtio-scsi controller
|
||||
local qemu_opts=("-device virtio-scsi-pci,id=scsi0,num_queues=4")
|
||||
local diskpath="${TESTDIR:?}/namedpart0.img"
|
||||
local i lodev num_disk num_part qemu_timeout
|
||||
local i num_disk qemu_timeout
|
||||
|
||||
if get_bool "${IS_BUILT_WITH_ASAN:=}" || ! get_bool "$QEMU_KVM"; then
|
||||
num_disk=4
|
||||
num_part=4
|
||||
else
|
||||
num_disk=16
|
||||
num_part=8
|
||||
fi
|
||||
|
||||
dd if=/dev/zero of="$diskpath" bs=1M count=18
|
||||
lodev="$(losetup --show -f -P "$diskpath")"
|
||||
sfdisk "${lodev:?}" <<EOF
|
||||
label: gpt
|
||||
|
||||
$(for ((i = 1; i <= num_part; i++)); do echo 'name="Hello world", size=2M'; done)
|
||||
EOF
|
||||
losetup -d "$lodev"
|
||||
|
||||
for ((i = 0; i < num_disk; i++)); do
|
||||
diskpath="${TESTDIR:?}/namedpart$i.img"
|
||||
|
@ -239,16 +239,27 @@ testcase_nvme_subsystem() {
|
||||
}
|
||||
|
||||
testcase_virtio_scsi_identically_named_partitions() {
|
||||
local num
|
||||
local num_part num_disk i j
|
||||
local alphabet='abcdefghijklmnopqrstuvwxyz'
|
||||
|
||||
if [[ -v ASAN_OPTIONS || "$(systemd-detect-virt -v)" == "qemu" ]]; then
|
||||
num=$((4 * 4))
|
||||
num_part=4
|
||||
num_disk=4
|
||||
else
|
||||
num=$((16 * 8))
|
||||
num_part=8
|
||||
num_disk=16
|
||||
fi
|
||||
|
||||
for ((i = 0; i < num_disk; i++)); do
|
||||
sfdisk "/dev/sd${alphabet:$i:1}" <<EOF
|
||||
label: gpt
|
||||
|
||||
$(for ((j = 1; j <= num_part; j++)); do echo 'name="Hello world", size=2M'; done)
|
||||
EOF
|
||||
done
|
||||
|
||||
lsblk --noheadings -a -o NAME,PARTLABEL
|
||||
[[ "$(lsblk --noheadings -a -o NAME,PARTLABEL | grep -c "Hello world")" -eq "$num" ]]
|
||||
[[ "$(lsblk --noheadings -a -o NAME,PARTLABEL | grep -c "Hello world")" -eq "$((num_part * num_disk))" ]]
|
||||
}
|
||||
|
||||
testcase_multipath_basic_failover() {
|
||||
|
Loading…
Reference in New Issue
Block a user