From 5b4fa6f13cf860afa53c71b52e4ceca25f8f13a5 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 6 Dec 2023 13:29:36 +0900 Subject: [PATCH] test: split out host_has_{btrfs,mdadm}() from TEST-64-UDEV-STORAGE --- test/TEST-64-UDEV-STORAGE/test.sh | 4 ++-- test/test-functions | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/test/TEST-64-UDEV-STORAGE/test.sh b/test/TEST-64-UDEV-STORAGE/test.sh index d41a4f00f9a..b9e7bdf18ad 100755 --- a/test/TEST-64-UDEV-STORAGE/test.sh +++ b/test/TEST-64-UDEV-STORAGE/test.sh @@ -24,7 +24,7 @@ _host_has_feature() {( case "${1:?}" in btrfs) - modprobe -nv btrfs && command -v mkfs.btrfs && command -v btrfs || return $? + host_has_btrfs ;; iscsi) # Client/initiator (Open-iSCSI) @@ -36,7 +36,7 @@ _host_has_feature() {( command -v lvm || return $? ;; mdadm) - command -v mdadm || return $? + host_has_mdadm ;; multipath) command -v multipath && command -v multipathd || return $? diff --git a/test/test-functions b/test/test-functions index 42b00387898..544d8ea34b9 100644 --- a/test/test-functions +++ b/test/test-functions @@ -1190,6 +1190,11 @@ install_lvm() { mkdir -p "${initdir:?}/etc/lvm" } +host_has_btrfs() ( + set -e + modprobe -nv btrfs && command -v mkfs.btrfs && command -v btrfs || return $? +) + install_btrfs() { instmods btrfs # Not all utilities provided by btrfs-progs are listed here; extend the list @@ -1257,6 +1262,11 @@ install_iscsi() { fi } +host_has_mdadm() ( + set -e + command -v mdadm || return $? +) + install_mdadm() { local unit local mdadm_units=(