]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: split out host_has_{btrfs,mdadm}() from TEST-64-UDEV-STORAGE
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 6 Dec 2023 04:29:36 +0000 (13:29 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 13 Dec 2023 05:19:28 +0000 (14:19 +0900)
test/TEST-64-UDEV-STORAGE/test.sh
test/test-functions

index d41a4f00f9addab055589d16fb1c53498d4521cf..b9e7bdf18ad14376d3c40ff11cedbc0114b38bf3 100755 (executable)
@@ -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 $?
index 42b003878986ef0a02fa5ac8243d83f786b6b1e5..544d8ea34b992504b516895491d51d652a201aeb 100644 (file)
@@ -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=(