diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2021-09-13 19:30:41 +0200 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2021-09-15 20:17:50 +0200 |
commit | 0203b2e4be4c3c98a23d0e66b7f9006506fa7755 (patch) | |
tree | bb2f1175c3eb8aff2e58400cbab437ccef243896 /test/TEST-64-UDEV-STORAGE | |
parent | test: check if all paths passed to helper_check_device_symlinks() are valid (diff) | |
download | systemd-0203b2e4be4c3c98a23d0e66b7f9006506fa7755.tar.xz systemd-0203b2e4be4c3c98a23d0e66b7f9006506fa7755.zip |
test: basic LVM tests
Diffstat (limited to 'test/TEST-64-UDEV-STORAGE')
-rwxr-xr-x | test/TEST-64-UDEV-STORAGE/test.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/TEST-64-UDEV-STORAGE/test.sh b/test/TEST-64-UDEV-STORAGE/test.sh index 2b9d0735e3..89de1ea692 100755 --- a/test/TEST-64-UDEV-STORAGE/test.sh +++ b/test/TEST-64-UDEV-STORAGE/test.sh @@ -1,5 +1,13 @@ #!/usr/bin/env bash # vi: ts=4 sw=4 tw=0 et: +# +# TODO: +# * iSCSI +# * LVM over iSCSI (?) +# * SW raid (mdadm) +# * LUKS -> MD (mdadm) -> LVM +# * BTRFS +# * MD BTRFS set -e TEST_DESCRIPTION="systemd-udev storage tests" @@ -30,6 +38,11 @@ test_append_files() { install_multipath fi + # Configure LVM + if command -v lvm; then + install_lvm + fi + for i in {0..127}; do dd if=/dev/zero of="${TESTDIR:?}/disk$i.img" bs=1M count=1 echo "device$i" >"${TESTDIR:?}/disk$i.img" @@ -246,6 +259,31 @@ testcase_simultaneous_events() { test_run_one "${1:?}" } +testcase_lvm_basic() { + if ! command -v lvm; then + echo "Missing lvm tools, skipping the test..." + return 77 + fi + + local qemu_opts=("-device ahci,id=ahci0") + local diskpath + + # Attach 4 SATA disks to the VM (and set their model and serial fields + # to something predictable, so we can refer to them later) + for i in {0..3}; do + diskpath="${TESTDIR:?}/lvmbasic${i}.img" + dd if=/dev/zero of="$diskpath" bs=1M count=32 + qemu_opts+=( + "-device ide-hd,bus=ahci0.$i,drive=drive$i,model=foobar,serial=deadbeeflvm$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:?}" +} + # 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 |