b11b5f
From 21c281585983fe2efc2b74d712d98ff7e6c013b1 Mon Sep 17 00:00:00 2001
b11b5f
From: Yu Watanabe <watanabe.yu+github@gmail.com>
b11b5f
Date: Tue, 14 Jun 2022 09:11:00 +0900
b11b5f
Subject: [PATCH] test: introduce inst_recursive() helper function
b11b5f
b11b5f
(cherry picked from commit da0465dc95388afc15598357452afef85035c639)
b11b5f
b11b5f
Related: #1866955
b11b5f
---
b11b5f
 test/test-functions | 14 ++++++++++++++
b11b5f
 1 file changed, 14 insertions(+)
b11b5f
b11b5f
diff --git a/test/test-functions b/test/test-functions
b11b5f
index 19363be858..9606a1b085 100644
b11b5f
--- a/test/test-functions
b11b5f
+++ b/test/test-functions
b11b5f
@@ -1224,6 +1224,20 @@ inst_any() {
b11b5f
     return 1
b11b5f
 }
b11b5f
 
b11b5f
+inst_recursive() {
b11b5f
+    local p item
b11b5f
+
b11b5f
+    for p in "$@"; do
b11b5f
+        while read -r item; do
b11b5f
+            if [[ -d "$item" ]]; then
b11b5f
+                inst_dir "$item"
b11b5f
+            elif [[ -f "$item" ]]; then
b11b5f
+                inst_simple "$item"
b11b5f
+            fi
b11b5f
+        done < <(find "$p" 2>/dev/null)
b11b5f
+    done
b11b5f
+}
b11b5f
+
b11b5f
 # dracut_install [-o ] <file> [<file> ... ]
b11b5f
 # Install <file> to the initramfs image
b11b5f
 # -o optionally install the <file> and don't fail, if it is not there