From 1208e92b3476d4350b0734897ed9adb30697dcfd Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 22 May 2014 11:59:11 +0200 Subject: [PATCH] tests: add check vg_attr_bit Similar function like 'check lv_attr_bit' --- test/lib/check.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/lib/check.sh b/test/lib/check.sh index 9c80d9a1a..cd29ef4f9 100644 --- a/test/lib/check.sh +++ b/test/lib/check.sh @@ -282,6 +282,21 @@ vg_field() { die "vg_field: vg=$1, field=\"$2\", actual=\"$actual\", expected=\"$3\"" } +vg_attr_bit() { + local actual=$(get vg_field "$2" vg_attr "${@:4}") + local offset=$1 + case "$offset" in + perm*) offset=0 ;; + resiz*) offset=1 ;; + export*) offset=2 ;; + partial) offset=3 ;; + alloc*) offset=4 ;; + cluster*) offset=5 ;; + esac + test "${actual:$offset:1}" = "$3" || \ + die "vg_attr_bit: vg=$2, ${offset} bit of \"$actual\" is \"${actual:$offset:1}\", but expected \"$3\"" +} + lv_field() { local actual=$(get lv_field "$1" "$2" "${@:4}") test "$actual" = "$3" || \