mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
Merge pull request #32303 from CodethinkLabs/push_down_disk_partitioning
test-64-udev-storage: Push disk partitioning into the testsuite itself
This commit is contained in:
commit
2153347506
@ -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"
|
||||
@ -325,19 +316,9 @@ testcase_multipath_basic_failover() {
|
||||
|
||||
local qemu_opts=("-device virtio-scsi-pci,id=scsi")
|
||||
local partdisk="${TESTDIR:?}/multipathpartitioned.img"
|
||||
local image lodev nback ndisk wwn
|
||||
local image nback ndisk wwn
|
||||
|
||||
dd if=/dev/zero of="$partdisk" bs=1M count=16
|
||||
lodev="$(losetup --show -f -P "$partdisk")"
|
||||
sfdisk "${lodev:?}" <<EOF
|
||||
label: gpt
|
||||
|
||||
name="first_partition", size=5M
|
||||
uuid="deadbeef-dead-dead-beef-000000000000", name="failover_part", size=5M
|
||||
EOF
|
||||
udevadm settle
|
||||
mkfs.ext4 -U "deadbeef-dead-dead-beef-111111111111" -L "failover_vol" "${lodev}p2"
|
||||
losetup -d "$lodev"
|
||||
|
||||
# Add 16 multipath devices, each backed by 4 paths
|
||||
for ndisk in {0..15}; do
|
||||
@ -475,18 +456,6 @@ testcase_long_sysfs_path() {
|
||||
)
|
||||
|
||||
dd if=/dev/zero of="$testdisk" bs=1M count=64
|
||||
lodev="$(losetup --show -f -P "$testdisk")"
|
||||
sfdisk "${lodev:?}" <<EOF
|
||||
label: gpt
|
||||
|
||||
name="test_swap", size=32M
|
||||
uuid="deadbeef-dead-dead-beef-000000000000", name="test_part", size=5M
|
||||
EOF
|
||||
udevadm settle
|
||||
mkswap -U "deadbeef-dead-dead-beef-111111111111" -L "swap_vol" "${lodev}p1"
|
||||
mkfs.ext4 -U "deadbeef-dead-dead-beef-222222222222" -L "data_vol" "${lodev}p2"
|
||||
losetup -d "$lodev"
|
||||
|
||||
# Create 25 additional PCI bridges, each one connected to the previous one
|
||||
# (basically a really long extension cable), and attach a virtio drive to
|
||||
# the last one. This should force udev into attempting to create a device
|
||||
|
@ -1117,6 +1117,9 @@ install_fs_tools() {
|
||||
# we use mkfs in system-repart tests
|
||||
image_install /sbin/mkfs.ext4
|
||||
image_install /sbin/mkfs.vfat
|
||||
|
||||
# we use mkswap in udev-storage tests
|
||||
image_install /sbin/mkswap
|
||||
}
|
||||
|
||||
install_modules() {
|
||||
|
@ -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() {
|
||||
@ -270,6 +281,16 @@ blacklist_exceptions {
|
||||
blacklist {
|
||||
}
|
||||
EOF
|
||||
|
||||
sfdisk /dev/sda <<EOF
|
||||
label: gpt
|
||||
|
||||
name="first_partition", size=5M
|
||||
uuid="deadbeef-dead-dead-beef-000000000000", name="failover_part", size=5M
|
||||
EOF
|
||||
udevadm settle
|
||||
mkfs.ext4 -U "deadbeef-dead-dead-beef-111111111111" -L "failover_vol" "/dev/sda2"
|
||||
|
||||
modprobe -v dm_multipath
|
||||
systemctl start multipathd.service
|
||||
systemctl status multipathd.service
|
||||
@ -950,6 +971,16 @@ testcase_long_sysfs_path() {
|
||||
stat /sys/block/vda
|
||||
readlink -f /sys/block/vda/dev
|
||||
|
||||
dev="/dev/vda"
|
||||
sfdisk "${dev:?}" <<EOF
|
||||
label: gpt
|
||||
|
||||
name="test_swap", size=32M
|
||||
uuid="deadbeef-dead-dead-beef-000000000000", name="test_part", size=5M
|
||||
EOF
|
||||
udevadm settle
|
||||
mkswap -U "deadbeef-dead-dead-beef-111111111111" -L "swap_vol" "${dev}1"
|
||||
mkfs.ext4 -U "deadbeef-dead-dead-beef-222222222222" -L "data_vol" "${dev}2"
|
||||
udevadm wait --settle --timeout=30 "${expected_symlinks[@]}"
|
||||
|
||||
# Try to mount the data partition manually (using its label)
|
||||
|
Loading…
Reference in New Issue
Block a user