Skip to contentSkip to conversation

master - tests: add lib function to test hidden LVs with lvs -a

PATCH David Teigland 1 participant 1 message Aug 21, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e53758c5f6074f920325afe0a01616f7c663f766
Commit:        e53758c5f6074f920325afe0a01616f7c663f766
Parent:        1f27c9f6a44cb893b6653641b35295e129531bf8
Author:        David Teigland <[email protected]>
AuthorDate:    Fri Aug 21 15:06:00 2015 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Fri Aug 21 15:09:38 2015 -0500

tests: add lib function to test hidden LVs with lvs -a

---
 test/lib/check.sh |    6 ++++++
 test/lib/get.sh   |    5 +++++
 2 files changed, 11 insertions(+), 0 deletions(-)
test/lib/check.sh +6 -0
index a6a9b38..9d48851 100644
@@ -308,6 +308,12 @@ lv_field() {
 		die "lv_field: lv=$1, field=\"$2\", actual=\"$actual\", expected=\"$3\""
 }
 
+lva_field() {
+	local actual=$(get lva_field "$1" "$2" "${@:4}")
+	test "$actual" = "$3" || \
+		die "lva_field: lv=$1, field=\"$2\", actual=\"$actual\", expected=\"$3\""
+}
+
 lv_attr_bit() {
 	local actual=$(get lv_field "$2" lv_attr "${@:4}")
 	local offset=$1
test/lib/get.sh +5 -0
index ef1ddc4..1b432c6 100644
@@ -42,6 +42,11 @@ lv_field() {
 	trim_ "$r"
 }
 
+lva_field() {
+	local r=$(lvs -a --config 'log{prefix=""}' --noheadings -o "$2" "${@:3}" "$1")
+	trim_ "$r"
+}
+
 lv_devices() {
 	lv_field "$1" devices -a "${@:2}" | sed 's/([^)]*)//g; s/,/\n/g'
 }