master - tests: add check lv_not_exists
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=177db48c11d1ac0794d805384b68de70703465b0 Commit: 177db48c11d1ac0794d805384b68de70703465b0 Parent: 4ed831e7ef4cc82c84731294f0189620ff5439c5 Author: Zdenek Kabelac <[email protected]> AuthorDate: Fri Jan 31 13:31:40 2014 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Tue Feb 11 19:00:06 2014 +0100
tests: add check lv_not_exists
--- test/lib/check.sh | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-)
test/lib/check.sh +16 -1
@@ -240,7 +240,7 @@ inactive() { die "$lv expected inactive, but lvs says it's not:" \ $(lvl $lv -o+devices) not dmsetup info $1-$2 2>/dev/null || \ - die "$lv expected inactive, lvs thinks it is but there are mappings!" + die "$lv expected inactive, lvs thinks it is but there are mappings!" } # Check for list of LVs from given VG
@@ -251,10 +251,25 @@ lv_exists() { shift lv="$lv $vg/$1" done + test -n "$lv" || lv=$vg lvl $lv &>/dev/null || \ die "$lv expected to exist but does not" } +lv_not_exists() { + local vg=$1 + if test $# -le 1 ; then + lvl $vg &>/dev/null || return + die "$vg expected to not exist but it does!" + else + while [ $# -gt 1 ]; do + shift + lvl $vg/$1 &>/dev/null || continue + die "$vg/$1 expected to not exist but it does!" + done + fi +} + pv_field() { local actual=$(get pv_field "$1" "$2" "${@:4}") test "$actual" = "$3" || \