]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: handle arbitrary paths in helper_check_device_symlinks()
authorFrantisek Sumsal <frantisek@sumsal.cz>
Mon, 13 Sep 2021 17:14:12 +0000 (19:14 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 14 Sep 2021 17:15:13 +0000 (19:15 +0200)
test/units/testsuite-64.sh

index ab688207bf3560a4d7d65fc0d9f20443851bcd68..b721ffd07fad3b7677fd5d156a250c396647d456 100755 (executable)
@@ -5,8 +5,11 @@ set -eux
 set -o pipefail
 
 # Check if all symlinks under /dev/disk/ are valid
+# shellcheck disable=SC2120
 helper_check_device_symlinks() {
-    local dev link target
+    local dev link paths target
+
+    [[ $# -gt 0 ]] && paths=("$@") || paths=("/dev/disk")
 
     while read -r link; do
         target="$(readlink -f "$link")"
@@ -23,7 +26,7 @@ helper_check_device_symlinks() {
             echo >&2 "ERROR: symlink '$link' points to '$target' but '$dev' was expected"
             return 1
         fi
-    done < <(find /dev/disk -type l)
+    done < <(find "${paths[@]}" -type l)
 }
 
 testcase_megasas2_basic() {