diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2022-04-07 18:03:17 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-04-13 17:12:02 +0200 |
commit | 3c9af05caeb0dcc7fc60b5b5a2d43e991425c993 (patch) | |
tree | fe9e2c6dffd495d579daaa3ee528db969f1a5259 /test/TEST-64-UDEV-STORAGE/test.sh | |
parent | udev: set ID_IGNORE_DISKSEQ for md devices (diff) | |
download | systemd-3c9af05caeb0dcc7fc60b5b5a2d43e991425c993.tar.xz systemd-3c9af05caeb0dcc7fc60b5b5a2d43e991425c993.zip |
test: add MD-related tests to TEST-64
Diffstat (limited to 'test/TEST-64-UDEV-STORAGE/test.sh')
-rwxr-xr-x | test/TEST-64-UDEV-STORAGE/test.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/TEST-64-UDEV-STORAGE/test.sh b/test/TEST-64-UDEV-STORAGE/test.sh index 04632952d0..0e684e01a0 100755 --- a/test/TEST-64-UDEV-STORAGE/test.sh +++ b/test/TEST-64-UDEV-STORAGE/test.sh @@ -42,6 +42,9 @@ _host_has_feature() {( lvm) command -v lvm || return $? ;; + mdadm) + command -v mdadm || return $? + ;; multipath) command -v multipath && command -v multipathd || return $? ;; @@ -64,6 +67,7 @@ test_append_files() {( [btrfs]=install_btrfs [iscsi]=install_iscsi [lvm]=install_lvm + [mdadm]=install_mdadm [multipath]=install_multipath ) @@ -444,6 +448,32 @@ EOF rm -f "${testdisk:?}" } +testcase_mdadm_basic() { + if ! _host_has_feature "mdadm"; then + echo "Missing mdadm tools/modules, 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:?}/mdadmbasic${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=deadbeefmdadm$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:?}"/mdadmbasic*.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 |