Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=466da710e03149187c05d…
Commit: 466da710e03149187c05dcfd598aa66c32158496
Parent: 9599645bb6a295aafd6cdf6f793fc9068c5d437f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jul 18 21:17:51 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jul 18 21:17:51 2017 +0200
tests: avoid endless loops
If there is some problem with device removal avoid generating very long
error logs...
---
test/shell/pvmove-resume-1.sh | 15 +++++++++++----
test/shell/pvmove-resume-2.sh | 16 ++++++++++++----
2 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/test/shell/pvmove-resume-1.sh b/test/shell/pvmove-resume-1.sh
index ff10199..ddebcb9 100644
--- a/test/shell/pvmove-resume-1.sh
+++ b/test/shell/pvmove-resume-1.sh
@@ -54,10 +54,17 @@ test_pvmove_resume() {
wait
- while dmsetup status "$vg-$lv1"; do dmsetup remove "$vg-$lv1" || true; done
- while dmsetup status "$vg1-$lv1"; do dmsetup remove "$vg1-$lv1" || true; done
- while dmsetup status "$vg-pvmove0"; do dmsetup remove "$vg-pvmove0" || true; done
- while dmsetup status "$vg1-pvmove0"; do dmsetup remove "$vg1-pvmove0" || true; done
+ local finished
+ for i in {1..100}; do
+ finished=1
+ for d in "$vg-$lv1" "$vg1-$lv1" "$vg-pvmove0" "$vg1-pvmove0" ; do
+ dmsetup status "$d" 2>/dev/null && {
+ dmsetup remove "$d" || finished=0
+ }
+ done
+ test "$finished" -eq 0 || break
+ done
+ test "$finished" -eq 0 && die "Can't remove device"
check lv_attr_bit type $vg/pvmove0 "p"
check lv_attr_bit type $vg1/pvmove0 "p"
diff --git a/test/shell/pvmove-resume-2.sh b/test/shell/pvmove-resume-2.sh
index 50c4233..5e9ad81 100644
--- a/test/shell/pvmove-resume-2.sh
+++ b/test/shell/pvmove-resume-2.sh
@@ -44,9 +44,17 @@ test_pvmove_resume() {
wait
- while dmsetup status "$vg-$lv1"; do dmsetup remove "$vg-$lv1" || true; done
- while dmsetup status "$vg-$lv2"; do dmsetup remove "$vg-$lv2" || true; done
- while dmsetup status "$vg-pvmove0"; do dmsetup remove "$vg-pvmove0" || true; done
+ local finished
+ for i in {1..100}; do
+ finished=1
+ for d in "$vg-$lv1" "$vg-$lv2" "$vg-pvmove0" ; do
+ dmsetup status "$d" 2>/dev/null && {
+ dmsetup remove "$d" || finished=0
+ }
+ done
+ test "$finished" -eq 0 || break
+ done
+ test "$finished" -eq 0 && die "Can't remove device"
check lv_attr_bit type $vg/pvmove0 "p"
@@ -59,7 +67,7 @@ test_pvmove_resume() {
# errors, based on the fact pvmove is killed -9
# Restart clvmd
kill "$(< LOCAL_CLVMD)"
- for i in $(seq 1 100) ; do
+ for i in {1 100} ; do
test $i -eq 100 && die "Shutdown of clvmd is too slow."
test -e "$CLVMD_PIDFILE" || break
sleep .1
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9599645bb6a295aafd6cd…
Commit: 9599645bb6a295aafd6cdf6f793fc9068c5d437f
Parent: 4fa739faf2d30beea5a8423806594f506644a540
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Jul 18 13:14:02 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jul 18 13:14:02 2017 +0200
tests: aux.sh limit device
During test do a more close selection of visible devices.
If some test leaks a device with LVMTEST prefix, next
test should not be influnced (or parallel running one).
If the test is running in non-/dev dir - it's already protected
by full path with $PREFIX in it - however it test is running
in real /dev dir - there was no such protection and test
were confused when they have seen such leaked device.
---
test/lib/aux.sh | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 20a8a1e..93345bf 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -475,7 +475,7 @@ teardown_devs() {
rm -f DEVICES LOOP
# Attempt to remove any loop devices that failed to get torn down if earlier tests aborted
- test "${LVM_TEST_PARALLEL:-0}" -eq 1 -o -z "$COMMON_PREFIX" || {
+ test "${LVM_TEST_PARALLEL:-0}" -eq 1 || test -z "$COMMON_PREFIX" || {
local stray_loops=( $(losetup -a | grep "$COMMON_PREFIX" | cut -d: -f1) )
test ${#stray_loops[@]} -eq 0 || {
teardown_devs_prefixed "$COMMON_PREFIX" 1
@@ -678,7 +678,7 @@ prepare_loop() {
# - scripts must take care not to use a DEV_SIZE that will enduce OOM-killer
prepare_scsi_debug_dev() {
local DEV_SIZE=$1
- local SCSI_DEBUG_PARAMS=( ${@:2} )
+ shift # rest of params directly passed to modprobe
local DEBUG_DEV
rm -f debug.log strace.log
@@ -694,7 +694,7 @@ prepare_scsi_debug_dev() {
# NOTE: it will _never_ make sense to pass num_tgts param;
# last param wins.. so num_tgts=1 is imposed
touch SCSI_DEBUG_DEV
- modprobe scsi_debug dev_size_mb="$DEV_SIZE" "${SCSI_DEBUG_PARAMS[@]}" num_tgts=1 || skip
+ modprobe scsi_debug dev_size_mb="$DEV_SIZE" "$@" num_tgts=1 || skip
for i in {1..20} ; do
DEBUG_DEV="/dev/$(grep -H scsi_debug /sys/block/*/device/model | cut -f4 -d /)"
@@ -1159,7 +1159,7 @@ devices/cache_dir = "$TESTDIR/etc"
devices/default_data_alignment = 1
devices/dir = "$DM_DEV_DIR"
devices/filter = "a|.*|"
-devices/global_filter = [ "a|$DM_DEV_DIR/mapper/.*pv[0-9_]*$|", "r|.*|" ]
+devices/global_filter = [ "a|$DM_DEV_DIR/mapper/${PREFIX}.*pv[0-9_]*$|", "r|.*|" ]
devices/md_component_detection = 0
devices/scan = "$DM_DEV_DIR"
devices/sysfs_scan = 1