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