diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2022-04-14 12:54:16 +0200 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2022-04-14 12:54:16 +0200 |
commit | d3ce9bed6869618fc3c2cd963f0ad7babb43bbaa (patch) | |
tree | c080eaa110775a2025c93f9e1c2be57d88cb5972 /test/TEST-64-UDEV-STORAGE | |
parent | test: extend testcase_mdadm_basic() with RAID 5 and 10 (diff) | |
download | systemd-d3ce9bed6869618fc3c2cd963f0ad7babb43bbaa.tar.xz systemd-d3ce9bed6869618fc3c2cd963f0ad7babb43bbaa.zip |
test: add a test case for MD + LVM + ext4
Diffstat (limited to 'test/TEST-64-UDEV-STORAGE')
-rwxr-xr-x | test/TEST-64-UDEV-STORAGE/test.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/TEST-64-UDEV-STORAGE/test.sh b/test/TEST-64-UDEV-STORAGE/test.sh index 0e684e01a0..d2660d3951 100755 --- a/test/TEST-64-UDEV-STORAGE/test.sh +++ b/test/TEST-64-UDEV-STORAGE/test.sh @@ -474,6 +474,31 @@ testcase_mdadm_basic() { rm -f "${TESTDIR:?}"/mdadmbasic*.img } +testcase_mdadm_lvm() { + if ! _host_has_feature "mdadm" || ! _host_has_feature "lvm"; then + echo "Missing mdadm tools/modules or LVM tools, skipping the test..." + return 77 + fi + + local qemu_opts=("-device ahci,id=ahci0") + local diskpath i size + + for i in {0..4}; do + diskpath="${TESTDIR:?}/mdadmlvm${i}.img" + + dd if=/dev/zero of="$diskpath" bs=1M count=64 + qemu_opts+=( + "-device ide-hd,bus=ahci0.$i,drive=drive$i,model=foobar,serial=deadbeefmdadmlvm$i" + "-drive format=raw,cache=unsafe,file=$diskpath,if=none,id=drive$i" + ) + done + + KERNEL_APPEND="systemd.setenv=TEST_FUNCTION_NAME=${FUNCNAME[0]} ${USER_KERNEL_APPEND:-}" + QEMU_OPTIONS="${qemu_opts[*]} ${USER_QEMU_OPTIONS:-}" + test_run_one "${1:?}" || return $? + + rm -f "${TESTDIR:?}"/mdadmlvm*.img +} # Allow overriding which tests should be run from the "outside", useful for manual # testing (make -C test/... TESTCASES="testcase1 testcase2") if [[ -v "TESTCASES" && -n "$TESTCASES" ]]; then |