1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-09-19 01:45:00 +03:00

test: tidy up the feature handling

This commit is contained in:
Frantisek Sumsal
2021-09-17 19:28:22 +02:00
parent babe935563
commit 70ec7736f8

View File

@@ -47,20 +47,25 @@ _host_has_feature() {
test_append_files() { 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" instmods "=block" "=md" "=nvme" "=scsi"
install_dmevent install_dmevent
generate_module_dependencies generate_module_dependencies
image_install lsblk wc image_install lsblk wc
# Configure multipath # Install the optional features if the host has the respective tooling
if _host_has_feature "multipath"; then for feature in "${!features[@]}"; do
install_multipath if _host_has_feature "$feature"; then
fi "${features[$feature]}"
fi
# Configure LVM done
if _host_has_feature "lvm"; then
install_lvm
fi
for i in {0..127}; do for i in {0..127}; do
dd if=/dev/zero of="${TESTDIR:?}/disk$i.img" bs=1M count=1 dd if=/dev/zero of="${TESTDIR:?}/disk$i.img" bs=1M count=1