Skip to contentSkip to conversation

master - tests: avoid using readarray

PATCH Zdenek Kabelac 1 participant 1 message Jul 10, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e9a544b94281a500bf58930c63d15aedcde961ed
Commit:        e9a544b94281a500bf58930c63d15aedcde961ed
Parent:        d71b738c171bfd93eabdca3c388a637a1aa55a6c
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Mon Jul 10 17:40:31 2017 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Mon Jul 10 17:40:31 2017 +0200

tests: avoid using readarray

Real bashman can live without readarray.

Support older tested machines with bash <4.0....

---
 test/lib/check.sh                           |    6 ++-
 test/shell/mirror-vgreduce-removemissing.sh |   63 +++++++++++++++++++++------
 2 files changed, 54 insertions(+), 15 deletions(-)
test/lib/check.sh +5 -1
index 76015b8..a61eb81 100644
@@ -98,7 +98,11 @@ mirror_images_on() {
 	local lv=$2
 	shift 2
 	local mimages=()
-	readarray -t mimages <<< "$(get lv_field_lv_ "$vg" lv_name -a | grep "${lv}_mimage_" )"
+	local line
+
+	while IFS= read -r line ; do
+		mimages+=( "$line" )
+	done < <( get lv_field_lv_ "$vg" lv_name -a | grep "${lv}_mimage_" )
 
 	for i in  "${mimages[@]}"; do
 		lv_on "$vg" "$i" "$1"
test/shell/mirror-vgreduce-removemissing.sh +49 -14

124 lines not on this page · raw message