1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

test-64: run one more subtest on non-KVM environment with relaxed condition

This commit is contained in:
Yu Watanabe 2022-08-28 11:58:52 +09:00 committed by Frantisek Sumsal
parent c0a18932dc
commit 0bfe2aa378
2 changed files with 27 additions and 16 deletions

View File

@ -207,10 +207,6 @@ testcase_nvme_basic() {
# Test for issue https://github.com/systemd/systemd/issues/20212 # Test for issue https://github.com/systemd/systemd/issues/20212
testcase_virtio_scsi_identically_named_partitions() { testcase_virtio_scsi_identically_named_partitions() {
if ! get_bool "$QEMU_KVM"; then
echo "This test requires KVM, skipping..."
return 77
fi
if ! "${QEMU_BIN:?}" -device help | grep 'name "virtio-scsi-pci"'; then if ! "${QEMU_BIN:?}" -device help | grep 'name "virtio-scsi-pci"'; then
echo "virtio-scsi-pci device driver is not available, skipping test..." echo "virtio-scsi-pci device driver is not available, skipping test..."
@ -221,25 +217,26 @@ testcase_virtio_scsi_identically_named_partitions() {
# and attach them to a virtio-scsi controller # and attach them to a virtio-scsi controller
local qemu_opts=("-device virtio-scsi-pci,id=scsi0,num_queues=4") local qemu_opts=("-device virtio-scsi-pci,id=scsi0,num_queues=4")
local diskpath="${TESTDIR:?}/namedpart0.img" local diskpath="${TESTDIR:?}/namedpart0.img"
local i lodev qemu_timeout local i lodev num_disk num_part 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 dd if=/dev/zero of="$diskpath" bs=1M count=18
lodev="$(losetup --show -f -P "$diskpath")" lodev="$(losetup --show -f -P "$diskpath")"
sfdisk "${lodev:?}" <<EOF sfdisk "${lodev:?}" <<EOF
label: gpt label: gpt
name="Hello world", size=2M $(for ((i = 1; i <= num_part; i++)); do echo 'name="Hello world", size=2M'; done)
name="Hello world", size=2M
name="Hello world", size=2M
name="Hello world", size=2M
name="Hello world", size=2M
name="Hello world", size=2M
name="Hello world", size=2M
name="Hello world", size=2M
EOF EOF
losetup -d "$lodev" losetup -d "$lodev"
for i in {0..15}; do for ((i = 0; i < num_disk; i++)); do
diskpath="${TESTDIR:?}/namedpart$i.img" diskpath="${TESTDIR:?}/namedpart$i.img"
if [[ $i -gt 0 ]]; then if [[ $i -gt 0 ]]; then
cp -uv "${TESTDIR:?}/namedpart0.img" "$diskpath" cp -uv "${TESTDIR:?}/namedpart0.img" "$diskpath"
@ -253,7 +250,13 @@ EOF
# Bump the timeout when collecting test coverage, since the test is a bit # Bump the timeout when collecting test coverage, since the test is a bit
# slower in that case # slower in that case
is_built_with_coverage && qemu_timeout=120 || qemu_timeout=60 if get_bool "${IS_BUILT_WITH_ASAN:=}" || ! get_bool "$QEMU_KVM"; then
qemu_timeout=240
elif is_built_with_coverage; then
qemu_timeout=120
else
qemu_timeout=60
fi
KERNEL_APPEND="systemd.setenv=TEST_FUNCTION_NAME=${FUNCNAME[0]} ${USER_KERNEL_APPEND:-}" KERNEL_APPEND="systemd.setenv=TEST_FUNCTION_NAME=${FUNCNAME[0]} ${USER_KERNEL_APPEND:-}"
# Limit the number of VCPUs and set a timeout to make sure we trigger the issue # Limit the number of VCPUs and set a timeout to make sure we trigger the issue

View File

@ -52,8 +52,16 @@ testcase_nvme_basic() {
} }
testcase_virtio_scsi_identically_named_partitions() { testcase_virtio_scsi_identically_named_partitions() {
local num
if [[ -n "${ASAN_OPTIONS:-}" ]] || [[ "$(systemd-detect-virt -v)" == "qemu" ]]; then
num=$((4 * 4))
else
num=$((16 * 8))
fi
lsblk --noheadings -a -o NAME,PARTLABEL lsblk --noheadings -a -o NAME,PARTLABEL
[[ "$(lsblk --noheadings -a -o NAME,PARTLABEL | grep -c "Hello world")" -eq $((16 * 8)) ]] [[ "$(lsblk --noheadings -a -o NAME,PARTLABEL | grep -c "Hello world")" -eq "$num" ]]
} }
testcase_multipath_basic_failover() { testcase_multipath_basic_failover() {