richardphibel / rpms / systemd

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