From 70ec7736f835a834b455fb1e23c39b938b0aebe4 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Fri, 17 Sep 2021 19:28:22 +0200 Subject: [PATCH] test: tidy up the feature handling --- test/TEST-64-UDEV-STORAGE/test.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/test/TEST-64-UDEV-STORAGE/test.sh b/test/TEST-64-UDEV-STORAGE/test.sh index fe1a88f0aa5..fe386050e36 100755 --- a/test/TEST-64-UDEV-STORAGE/test.sh +++ b/test/TEST-64-UDEV-STORAGE/test.sh @@ -47,20 +47,25 @@ _host_has_feature() { test_append_files() { ( + local feature + # An associative array of requested (but optional) features and their + # respective "handlers" from test/test-functions + local -A features=( + [multipath]=install_multipath + [lvm]=install_lvm + ) + instmods "=block" "=md" "=nvme" "=scsi" install_dmevent generate_module_dependencies image_install lsblk wc - # Configure multipath - if _host_has_feature "multipath"; then - install_multipath - fi - - # Configure LVM - if _host_has_feature "lvm"; then - install_lvm - fi + # Install the optional features if the host has the respective tooling + for feature in "${!features[@]}"; do + if _host_has_feature "$feature"; then + "${features[$feature]}" + fi + done for i in {0..127}; do dd if=/dev/zero of="${TESTDIR:?}/disk$i.img" bs=1M count=1 -- 2.47.3