1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tests: use select with dmsetup

Use 'dmsetup -S' to greatly simplify such loops.
This commit is contained in:
Zdenek Kabelac 2018-11-23 20:08:08 +01:00
parent 74731a5277
commit 5f87ba68d4
3 changed files with 6 additions and 39 deletions

View File

@ -23,19 +23,8 @@ aux prepare_vg 4 32
# FIXME: lvconvert leaks 'error' devices # FIXME: lvconvert leaks 'error' devices
detect_error_leak_() detect_error_leak_()
{ {
local err="" dmsetup table -S "name=~^$vg-" | not grep "error" || \
die "Device(s) with error target should not be here."
for i in $(dmsetup info -c -o name --noheadings) ; do
case "$i" in
"$vg*") (dmsetup table "$i" | grep "error ") && err="$err $i" ;;
esac
done
test -z "$err" || {
dmsetup table | grep $vg
dmsetup ls --tree
die "Device(s) $err should not be here."
}
} }
# Create linear LV # Create linear LV

View File

@ -23,19 +23,8 @@ aux prepare_vg 4 32
# FIXME: lvconvert leaks 'error' devices # FIXME: lvconvert leaks 'error' devices
detect_error_leak_() detect_error_leak_()
{ {
local err="" dmsetup table -S "name=~^$vg-" | not grep "error" || \
die "Device(s) with error target should not be here."
for i in $(dmsetup info -c -o name --noheadings) ; do
case "$i" in
"$vg*") (dmsetup table "$i" | grep "error ") && err="$err $i" ;;
esac
done
test -z "$err" || {
dmsetup table | grep $vg
dmsetup ls --tree
die "Device(s) $err should not be here."
}
} }
# Create 3-way striped raid4 (4 legs total) # Create 3-way striped raid4 (4 legs total)

View File

@ -26,19 +26,8 @@ aux prepare_vg 8
# FIXME: lvconvert leaks 'error' devices # FIXME: lvconvert leaks 'error' devices
detect_error_leak_() detect_error_leak_()
{ {
local err="" dmsetup table -S "name=~^$vg-" | not grep "error" || \
die "Device(s) with error target should not be here."
for i in $(dmsetup info -c -o name --noheadings) ; do
case "$i" in
"$vg*") (dmsetup table "$i" | grep "error ") && err="$err $i" ;;
esac
done
test -z "$err" || {
dmsetup table | grep $vg
dmsetup ls --tree
die "Device(s) $err should not be here."
}
} }
function _lvcreate function _lvcreate