diff options
author | Sam Leonard <sam.leonard@codethink.co.uk> | 2024-04-16 17:17:59 +0200 |
---|---|---|
committer | Sam Leonard <sam.leonard@codethink.co.uk> | 2024-04-16 17:18:55 +0200 |
commit | 211062e3b5b66450884f7f603963579f6ce27420 (patch) | |
tree | 98177cb6002852070af17fc4cce0b052a643df8b | |
parent | test-64-udev-storage: partition disk inside testcase - testcase_long_sysfs_path (diff) | |
download | systemd-211062e3b5b66450884f7f603963579f6ce27420.tar.xz systemd-211062e3b5b66450884f7f603963579f6ce27420.zip |
test-64-udev-storage: partition disk inside testcase - testcase_virtio_scsi_identically_named_partitions
Diffstat (limited to '')
-rwxr-xr-x | test/TEST-64-UDEV-STORAGE/test.sh | 11 | ||||
-rwxr-xr-x | test/units/testsuite-64.sh | 19 |
2 files changed, 16 insertions, 14 deletions
diff --git a/test/TEST-64-UDEV-STORAGE/test.sh b/test/TEST-64-UDEV-STORAGE/test.sh index 2b4927db07..a5e491c22e 100755 --- a/test/TEST-64-UDEV-STORAGE/test.sh +++ b/test/TEST-64-UDEV-STORAGE/test.sh @@ -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" diff --git a/test/units/testsuite-64.sh b/test/units/testsuite-64.sh index fa823bce0c..0e5a1d140b 100755 --- a/test/units/testsuite-64.sh +++ b/test/units/testsuite-64.sh @@ -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() { |