exit 0
fi
-_host_has_feature() {
+_host_has_feature() {(
+ set -e
+
case "${1:?}" in
multipath)
command -v multipath && command -v multipathd
# a missing feature
exit 1
esac
-}
-
-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
- )
+)}
+
+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
+ instmods "=block" "=md" "=nvme" "=scsi"
+ install_dmevent
+ generate_module_dependencies
+ image_install lsblk wc
- # 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
+ # 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
- echo "device$i" >"${TESTDIR:?}/disk$i.img"
- done
- )
-}
+ 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"
+ done
+)}
test_run_one() {
local test_id="${1:?}"
# Check if all symlinks under /dev/disk/ are valid
# shellcheck disable=SC2120
-helper_check_device_symlinks() {
- # Disable verbose logging only for this function (and reset the signal handler
- # when leaving the function)
- set +x; trap "trap - RETURN; set -x" RETURN
+helper_check_device_symlinks() {(
+ set +x
local dev link path paths target
return 1
fi
done < <(find "${paths[@]}" -type l)
-}
+)}
testcase_megasas2_basic() {
lsblk -S