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

test: cleanup the intermediate disk images

This commit is contained in:
Frantisek Sumsal 2021-09-17 23:03:44 +02:00
parent 70ec7736f8
commit b216501a8e

View File

@ -187,11 +187,9 @@ testcase_virtio_scsi_identically_named_partitions() {
local diskpath="${TESTDIR:?}/namedpart0.img"
local lodev
# Save some time (and storage life) during local testing
if [[ ! -e "$diskpath" ]]; then
dd if=/dev/zero of="$diskpath" bs=1M count=18
lodev="$(losetup --show -f -P "$diskpath")"
sfdisk "${lodev:?}" <<EOF
dd if=/dev/zero of="$diskpath" bs=1M count=18
lodev="$(losetup --show -f -P "$diskpath")"
sfdisk "${lodev:?}" <<EOF
label: gpt
name="Hello world", size=2M
@ -203,8 +201,7 @@ name="Hello world", size=2M
name="Hello world", size=2M
name="Hello world", size=2M
EOF
losetup -d "$lodev"
fi
losetup -d "$lodev"
for i in {0..15}; do
diskpath="${TESTDIR:?}/namedpart$i.img"
@ -222,6 +219,8 @@ EOF
# Limit the number of VCPUs and set a timeout to make sure we trigger the issue
QEMU_OPTIONS="${qemu_opts[*]} ${USER_QEMU_OPTIONS:-}"
QEMU_SMP=1 QEMU_TIMEOUT=60 test_run_one "${1:?}"
rm -f "${TESTDIR:?}"/namedpart*.img
}
testcase_multipath_basic_failover() {
@ -234,19 +233,17 @@ testcase_multipath_basic_failover() {
local partdisk="${TESTDIR:?}/multipathpartitioned.img"
local image lodev nback ndisk wwn
if [[ ! -e "$partdisk" ]]; then
dd if=/dev/zero of="$partdisk" bs=1M count=16
lodev="$(losetup --show -f -P "$partdisk")"
sfdisk "${lodev:?}" <<EOF
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"
fi
udevadm settle
mkfs.ext4 -U "deadbeef-dead-dead-beef-111111111111" -L "failover_vol" "${lodev}p2"
losetup -d "$lodev"
# Add 64 multipath devices, each backed by 4 paths
for ndisk in {0..63}; do
@ -265,6 +262,8 @@ EOF
KERNEL_APPEND="systemd.setenv=TEST_FUNCTION_NAME=${FUNCNAME[0]} ${USER_KERNEL_APPEND:-}"
QEMU_OPTIONS="${qemu_opts[*]} ${USER_QEMU_OPTIONS:-}"
test_run_one "${1:?}"
rm -f "$partdisk"
}
# Test case for issue https://github.com/systemd/systemd/issues/19946
@ -281,6 +280,8 @@ testcase_simultaneous_events() {
KERNEL_APPEND="systemd.setenv=TEST_FUNCTION_NAME=${FUNCNAME[0]} ${USER_KERNEL_APPEND:-}"
QEMU_OPTIONS="${qemu_opts[*]} ${USER_QEMU_OPTIONS:-}"
test_run_one "${1:?}"
rm -f "$partdisk"
}
testcase_lvm_basic() {
@ -306,6 +307,8 @@ testcase_lvm_basic() {
KERNEL_APPEND="systemd.setenv=TEST_FUNCTION_NAME=${FUNCNAME[0]} ${USER_KERNEL_APPEND:-}"
QEMU_OPTIONS="${qemu_opts[*]} ${USER_QEMU_OPTIONS:-}"
test_run_one "${1:?}"
rm -f "${TESTDIR:?}"/lvmbasic*.img
}
# Allow overriding which tests should be run from the "outside", useful for manual