master - tests: implement lv_attr_bit
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4d48577ab9fce971512a5c7b2faf3bfdf683f512 Commit: 4d48577ab9fce971512a5c7b2faf3bfdf683f512 Parent: 1d803ee9806bc3838a515619bec211b9233d803e Author: Zdenek Kabelac <[email protected]> AuthorDate: Thu Apr 10 22:07:45 2014 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Apr 14 13:02:28 2014 +0200
tests: implement lv_attr_bit
Add easy check function for cheking lv_attr bits
--- test/lib/check.sh | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-)
test/lib/check.sh +20 -1
@@ -285,7 +285,26 @@ vg_field() { lv_field() { local actual=$(get lv_field "$1" "$2" "${@:4}") test "$actual" = "$3" || \ - die "lv_field: lv=$lv, field=\"$2\", actual=\"$actual\", expected=\"$3\"" + die "lv_field: lv=$1, field=\"$2\", actual=\"$actual\", expected=\"$3\"" +} + +lv_attr_bit() { + local actual=$(get lv_field "$2" lv_attr "${@:4}") + local offset=$1 + case "$offset" in + type) offset=0 ;; + perm*) offset=1 ;; + alloc*) offset=2 ;; + fixed*) offset=3 ;; + state) offset=4 ;; + open) offset=5 ;; + target) offset=6 ;; + zero) offset=7 ;; + health) offset=8 ;; + skip) offset=9 ;; + esac + test "${actual:$offset:1}" = "$3" || \ + die "lv_attr_bit: lv=$2, ${offset} bit of \"$actual\" is \"${actual:$offset:1}\", but expected \"$3\"" } compare_fields() {