master - tests: drop unneeded echo
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4a5eea77581181ee9dd...
Commit: 4a5eea77581181ee9ddff0c4e3575bc3a73d2585
Parent: 2d96b758e4d127d144fdeb92b487cdc5f86de340
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 7 21:29:55 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: drop unneeded echo
---
test/shell/thin-resize-match.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/thin-resize-match.sh b/test/shell/thin-resize-match.sh
index b9bec9c..3bbf334 100644
--- a/test/shell/thin-resize-match.sh
+++ b/test/shell/thin-resize-match.sh
@@ -62,7 +62,7 @@ diff MD5 MD5-2
# Do not want to see Live & Inactive table entry
-echo $(dm_info attr,name) | not grep "LI-.*${PREFIX}" || {
+( dm_info attr,name | not grep "LI-.*${PREFIX}" ) || {
dmsetup table --inactive | grep ${PREFIX}
die "Found device with Inactive table"
}
6 years, 9 months
master - tests: drop unneeded cat
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2d96b758e4d127d144f...
Commit: 2d96b758e4d127d144fdeb92b487cdc5f86de340
Parent: eba96a9720add0120b029a34fe8641297cd1e904
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 6 19:42:15 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: drop unneeded cat
---
test/shell/snapshot-autoumount-dmeventd.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/shell/snapshot-autoumount-dmeventd.sh b/test/shell/snapshot-autoumount-dmeventd.sh
index 5ef3969..8e2781e 100644
--- a/test/shell/snapshot-autoumount-dmeventd.sh
+++ b/test/shell/snapshot-autoumount-dmeventd.sh
@@ -38,7 +38,7 @@ mount -o errors=remount-ro "$DM_DEV_DIR/mapper/$vg-snap" "$mntdir"
test "$(dmsetup info -c --noheadings -o open $vg-snap)" -eq 1
-cat /proc/mounts | grep "$mntdir"
+grep "$mntdir" /proc/mounts
# overfill 4M snapshot (with metadata)
not dd if=/dev/zero of="$mntdir/file$1" bs=1M count=4 conv=fdatasync
@@ -52,6 +52,6 @@ for i in {1..100}; do
test "$(dmsetup info -c --noheadings -o open $vg-snap)" -eq 0 && break
done
-cat /proc/mounts | not grep "$mntdir"
+not grep "$mntdir" /proc/mounts
vgremove -f $vg
6 years, 9 months
master - tests: fix possible misspelling
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=eba96a9720add0120b0...
Commit: eba96a9720add0120b029a34fe8641297cd1e904
Parent: d4345220cc85a803b8c029adb472fc4d9f580659
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 6 20:08:53 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: fix possible misspelling
Possible misspelling: FAILED_MIXED_STR may not be assigned, but FAIL_MIXED_STR is.
Possible misspelling: FAILED_MULTI_STR may not be assigned, but FAIL_MULTI_STR is.
Possible misspelling: FAILED_BLACK_STR may not be assigned, but FAIL_BLACK_STR is.
---
test/shell/name-mangling.sh | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/shell/name-mangling.sh b/test/shell/name-mangling.sh
index 80e7b6c..3e67587 100644
--- a/test/shell/name-mangling.sh
+++ b/test/shell/name-mangling.sh
@@ -76,13 +76,13 @@ function check_create_and_remove()
if [ "$dm_name" = "FAIL_MIXED" ]; then
r=0
- grep "$FAILED_MIXED_STR" err || r=1
+ grep "$FAIL_MIXED_STR" err || r=1
elif [ "$dm_name" = "FAIL_MULTI" ]; then
r=0
- grep "$FAILED_MULTI_STR" err || r=1
+ grep "$FAIL_MULTI_STR" err || r=1
elif [ "$dm_name" = "FAIL_BLACK" ]; then
r=0
- grep "$FAILED_BLACK_STR" err || r=1
+ grep "$FAIL_BLACK_STR" err || r=1
fi
return $r
6 years, 9 months
master - tests: avoid masking return values
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d4345220cc85a803b8c...
Commit: d4345220cc85a803b8c029adb472fc4d9f580659
Parent: 146bfb2417de3e6cd719b5aef900bf927a39a0cd
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 6 19:30:19 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: avoid masking return values
Declare and assign separately to avoid masking return values.
---
test/shell/fsadm-renamed.sh | 3 ++-
test/shell/fsadm.sh | 3 ++-
test/shell/lvresize-full.sh | 3 ++-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/test/shell/fsadm-renamed.sh b/test/shell/fsadm-renamed.sh
index ed7b743..7f3a9fd 100644
--- a/test/shell/fsadm-renamed.sh
+++ b/test/shell/fsadm-renamed.sh
@@ -28,7 +28,8 @@ mount_dir="mnt"
mount_space_dir="mnt space dir"
mount_dolar_dir="mnt \$SPACE dir"
# for recursive call
-export LVM_BINARY=$(which lvm)
+LVM_BINARY=$(which lvm)
+export LVM_BINARY
test ! -d "$mount_dir" && mkdir "$mount_dir"
test ! -d "$mount_space_dir" && mkdir "$mount_space_dir"
diff --git a/test/shell/fsadm.sh b/test/shell/fsadm.sh
index 351a179..fed7eb4 100644
--- a/test/shell/fsadm.sh
+++ b/test/shell/fsadm.sh
@@ -45,7 +45,8 @@ dev_vg_lv2="$DM_DEV_DIR/$vg_lv2"
mount_dir="mnt"
mount_space_dir="mnt space dir"
# for recursive call
-export LVM_BINARY=$(which lvm)
+LVM_BINARY=$(which lvm)
+export LVM_BINARY
test ! -d "$mount_dir" && mkdir "$mount_dir"
test ! -d "$mount_space_dir" && mkdir "$mount_space_dir"
diff --git a/test/shell/lvresize-full.sh b/test/shell/lvresize-full.sh
index b518bb7..c497781 100644
--- a/test/shell/lvresize-full.sh
+++ b/test/shell/lvresize-full.sh
@@ -21,7 +21,8 @@ SKIP_WITH_LVMPOLLD=1
FSCK=${FSCK-fsck}
MKFS=${MKFS-mkfs.ext3}
RESIZEFS=${RESIZEFS-resize2fs}
-export LVM_BINARY=$(which lvm)
+LVM_BINARY=$(which lvm)
+export LVM_BINARY
which $FSCK || skip
which $MKFS || skip
6 years, 9 months
master - tests: math drop uncessary $/${}
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=146bfb2417de3e6cd71...
Commit: 146bfb2417de3e6cd719b5aef900bf927a39a0cd
Parent: 72e82b42a9c07293fdfae7ec0a98dd9fe5a0c868
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 6 19:27:04 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: math drop uncessary $/${}
$/${} is unnecessary on arithmetic variables.
Use $((..)) instead of deprecated $[..]
---
test/shell/lvchange-raid.sh | 6 +-
test/shell/lvconvert-mirror-basic.sh | 8 +-
test/shell/lvconvert-raid.sh | 4 +-
test/shell/lvconvert-raid456.sh | 2 +-
test/shell/metadata-balance.sh | 84 +++++++++++++-------------
test/shell/mirror-vgreduce-removemissing.sh | 2 +-
test/shell/pvcreate-bootloaderarea.sh | 4 +-
test/shell/pvcreate-operation-md.sh | 2 +-
test/shell/pvcreate-usage.sh | 8 +-
test/shell/pvmove-restart.sh | 2 +-
test/shell/read-ahead.sh | 2 +-
test/shell/topology-support.sh | 2 +-
test/shell/vgextend-usage.sh | 4 +-
13 files changed, 65 insertions(+), 65 deletions(-)
diff --git a/test/shell/lvchange-raid.sh b/test/shell/lvchange-raid.sh
index 2fe011a..ce29768 100644
--- a/test/shell/lvchange-raid.sh
+++ b/test/shell/lvchange-raid.sh
@@ -152,15 +152,15 @@ run_syncaction_check() {
device=$(get lv_devices $vg/${lv}_rimage_1)
size=$(get lv_field $vg/${lv}_rimage_1 size -a --units 1k)
- size=$((${size%\.00k} / 2))
+ size=$(( ${size%\.00k} / 2 ))
tmp=$(get pv_field "$device" mda_size --units 1k)
seek=${tmp%\.00k} # Jump over MDA
tmp=$(get lv_field $vg/${lv}_rmeta_1 size -a --units 1k)
- seek=$(($seek + ${tmp%\.00k})) # Jump over RAID metadata image
+ seek=$(( seek + ${tmp%\.00k} )) # Jump over RAID metadata image
- seek=$(($seek + $size)) # Jump halfway through the RAID image
+ seek=$(( seek + size )) # Jump halfway through the RAID image
check lv_attr_bit health $vg/$lv "-"
check lv_field $vg/$lv raid_mismatch_count "0"
diff --git a/test/shell/lvconvert-mirror-basic.sh b/test/shell/lvconvert-mirror-basic.sh
index 0b73d8c..0959af8 100644
--- a/test/shell/lvconvert-mirror-basic.sh
+++ b/test/shell/lvconvert-mirror-basic.sh
@@ -44,10 +44,10 @@ log_name_to_count() {
test_lvconvert() {
local start_count=$1
- local start_count_p1=$(($start_count + 1))
+ local start_count_p1=$(( start_count + 1 ))
local start_log_type=$2
local finish_count=$3
- local finish_count_p1=$(($finish_count + 1))
+ local finish_count_p1=$(( finish_count + 1 ))
local finish_log_type=$4
local dev_array=( "$dev1" "$dev2" "$dev3" "$dev4" "$dev5" )
local start_log_count
@@ -78,7 +78,7 @@ test_lvconvert() {
if [ $start_count -gt 0 ]; then
# Are there extra devices for the log or do we overlap
- if [ $(($start_count_p1 + $start_log_count)) -gt ${#dev_array[@]} ]; then
+ if [ $(( start_count_p1 + start_log_count )) -gt ${#dev_array[@]} ]; then
alloc="--alloc anywhere"
fi
@@ -94,7 +94,7 @@ test_lvconvert() {
test $active || lvchange -an $vg/$lv1
# Are there extra devices for the log or do we overlap
- if [ $(($finish_count_p1 + $finish_log_count)) -gt ${#dev_array[@]} ]; then
+ if [ $(( finish_count_p1 + finish_log_count )) -gt ${#dev_array[@]} ]; then
alloc="--alloc anywhere"
fi
diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
index a110ac5..8b4ebf4 100644
--- a/test/shell/lvconvert-raid.sh
+++ b/test/shell/lvconvert-raid.sh
@@ -65,7 +65,7 @@ for i in 1 2 3; do
lvcreate -aey -l 2 -n $lv1 $vg
else
- lvcreate --type raid1 -m $(($i - 1)) -l 2 -n $lv1 $vg
+ lvcreate --type raid1 -m $(( i - 1 )) -l 2 -n $lv1 $vg
aux wait_for_sync $vg $lv1
fi
@@ -299,7 +299,7 @@ for i in {1..3}; do
devices=( $(get_image_pvs $vg $lv1) )
for k in $(seq "$j"); do
- index=$((($k + $o) % ($i + 1)))
+ index=$(( ( k + o ) % ( i + 1 ) ))
replace="$replace --replace ${devices[$index]}"
done
aux wait_for_sync $vg $lv1
diff --git a/test/shell/lvconvert-raid456.sh b/test/shell/lvconvert-raid456.sh
index 0e3f378..43fe503 100644
--- a/test/shell/lvconvert-raid456.sh
+++ b/test/shell/lvconvert-raid456.sh
@@ -53,7 +53,7 @@ for i in $levels; do
devices=( $(get_image_pvs $vg $lv1) )
for k in $(seq $j); do
- index=$((($k + $o) % $dev_cnt))
+ index=$(( ( k + o ) % dev_cnt ))
replace="$replace --replace ${devices[$index]}"
done
aux wait_for_sync $vg $lv1
diff --git a/test/shell/metadata-balance.sh b/test/shell/metadata-balance.sh
index 3855b88..fe94aed 100644
--- a/test/shell/metadata-balance.sh
+++ b/test/shell/metadata-balance.sh
@@ -31,7 +31,7 @@ for mdacp in 1 2; do
check pv_field "$dev2" pv_mda_count $mdacp
check pv_field "$dev2" pv_mda_used_count $mdacp
if [ $pv_in_vg = 1 ]; then
- check vg_field $vg vg_mda_count $(($mdacp * 2))
+ check vg_field $vg vg_mda_count $(( mdacp * 2 ))
check vg_field $vg vg_mda_used_count $mdacp
check vg_field $vg vg_mda_copies unmanaged
fi
@@ -39,8 +39,8 @@ for mdacp in 1 2; do
check pv_field "$dev1" pv_mda_count $mdacp
check pv_field "$dev1" pv_mda_used_count $mdacp
if [ $pv_in_vg = 1 ]; then
- check vg_field $vg vg_mda_count $(($mdacp * 2))
- check vg_field $vg vg_mda_used_count $(($mdacp * 2))
+ check vg_field $vg vg_mda_count $(( mdacp * 2 ))
+ check vg_field $vg vg_mda_used_count $(( mdacp * 2 ))
check vg_field $vg vg_mda_copies unmanaged
vgremove -f $vg
fi
@@ -75,18 +75,18 @@ for mdacp in 1 2; do
vgcreate $vg "$dev1" "$dev2" "$dev3"
check vg_field $vg vg_mda_copies unmanaged
echo ensure both --vgmetadatacopies and --metadatacopies accepted
- vgchange --metadatacopies $(($mdacp * 1)) $vg
+ vgchange --metadatacopies $(( mdacp * 1 )) $vg
echo --vgmetadatacopies is persistent on disk
echo --vgmetadatacopies affects underlying pv mda ignore
- check vg_field $vg vg_mda_copies $(($mdacp * 1))
- check vg_field $vg vg_mda_used_count $(($mdacp * 1))
- vgchange --vgmetadatacopies $(($mdacp * 2)) $vg
- check vg_field $vg vg_mda_copies $(($mdacp * 2))
- check vg_field $vg vg_mda_used_count $(($mdacp * 2))
+ check vg_field $vg vg_mda_copies $(( mdacp * 1 ))
+ check vg_field $vg vg_mda_used_count $(( mdacp * 1 ))
+ vgchange --vgmetadatacopies $(( mdacp * 2 )) $vg
+ check vg_field $vg vg_mda_copies $(( mdacp * 2 ))
+ check vg_field $vg vg_mda_used_count $(( mdacp * 2 ))
echo allow setting metadatacopies larger than number of PVs
- vgchange --vgmetadatacopies $(($mdacp * 5)) $vg
- check vg_field $vg vg_mda_copies $(($mdacp * 5))
- check vg_field $vg vg_mda_used_count $(($mdacp * 2))
+ vgchange --vgmetadatacopies $(( mdacp * 5 )) $vg
+ check vg_field $vg vg_mda_copies $(( mdacp * 5 ))
+ check vg_field $vg vg_mda_used_count $(( mdacp * 2 ))
echo setting to 0 disables automatic balancing
vgchange --vgmetadatacopies unmanaged $vg
check vg_field $vg vg_mda_copies unmanaged
@@ -99,15 +99,15 @@ for mdacp in 1 2; do
check vg_field $vg vg_mda_copies unmanaged
vgremove -f $vg
echo vgcreate succeeds with a specific number of metadata copies
- vgcreate --vgmetadatacopies $(($mdacp * 2)) $vg "$dev1" "$dev2"
- check vg_field $vg vg_mda_copies $(($mdacp * 2))
+ vgcreate --vgmetadatacopies $(( mdacp * 2 )) $vg "$dev1" "$dev2"
+ check vg_field $vg vg_mda_copies $(( mdacp * 2 ))
vgremove -f $vg
- vgcreate --vgmetadatacopies $(($mdacp * 1)) $vg "$dev1" "$dev2"
- check vg_field $vg vg_mda_copies $(($mdacp * 1))
+ vgcreate --vgmetadatacopies $(( mdacp * 1 )) $vg "$dev1" "$dev2"
+ check vg_field $vg vg_mda_copies $(( mdacp * 1 ))
vgremove -f $vg
echo vgcreate succeeds with a larger value than total metadatacopies
- vgcreate --vgmetadatacopies $(($mdacp * 5)) $vg "$dev1" "$dev2"
- check vg_field $vg vg_mda_copies $(($mdacp * 5))
+ vgcreate --vgmetadatacopies $(( mdacp * 5 )) $vg "$dev1" "$dev2"
+ check vg_field $vg vg_mda_copies $(( mdacp * 5 ))
vgremove -f $vg
echo vgcreate succeeds with --vgmetadatacopies unmanaged
vgcreate --vgmetadatacopies unmanaged $vg "$dev1" "$dev2"
@@ -120,7 +120,7 @@ for mdacp in 1 2; do
echo vgcreate succeds with small value of --metadatacopies, ignores mdas
vgcreate --vgmetadatacopies 1 $vg "$dev1" "$dev2" "$dev4" "$dev5"
check vg_field $vg vg_mda_copies 1
- check vg_field $vg vg_mda_count $(($mdacp * 4))
+ check vg_field $vg vg_mda_count $(( mdacp * 4 ))
check vg_field $vg vg_mda_used_count 1
echo Setting a larger value should trigger non-ignore of mdas
vgchange --metadatacopies 3 $vg
@@ -128,9 +128,9 @@ for mdacp in 1 2; do
check vg_field $vg vg_mda_used_count 3
echo Setting all should trigger unignore of all mdas
vgchange --vgmetadatacopies all $vg
- check vg_field $vg vg_mda_count $(($mdacp * 4))
+ check vg_field $vg vg_mda_count $(( mdacp * 4 ))
check vg_field $vg vg_mda_copies unmanaged
- check vg_field $vg vg_mda_used_count $(($mdacp * 4))
+ check vg_field $vg vg_mda_used_count $(( mdacp * 4 ))
echo --vgmetadatacopies 0 should be unmanaged for vgchange and vgcreate
vgchange --vgmetadatacopies 0 $vg
check vg_field $vg vg_mda_copies unmanaged
@@ -145,8 +145,8 @@ for mdacp in 1 2; do
pvcreate --metadatacopies $mdacp "$dev1" "$dev2" "$dev4" "$dev5"
pvcreate --metadatacopies 0 "$dev3"
echo Set a large value of vgmetadatacopies
- vgcreate --vgmetadatacopies $(($mdacp * 5)) $vg "$dev1" "$dev2" "$dev3"
- check vg_field $vg vg_mda_copies $(($mdacp * 5))
+ vgcreate --vgmetadatacopies $(( mdacp * 5 )) $vg "$dev1" "$dev2" "$dev3"
+ check vg_field $vg vg_mda_copies $(( mdacp * 5 ))
echo Ignore mdas on devices to be used for vgextend
echo Large value of vgetadatacopies should automatically un-ignore mdas
pvchange --metadataignore y "$dev4" "$dev5"
@@ -156,8 +156,8 @@ for mdacp in 1 2; do
check pv_field "$dev5" pv_mda_used_count $mdacp
vgremove -f $vg
echo Set a small value of vgmetadatacopies
- vgcreate --vgmetadatacopies $(($mdacp * 1)) $vg "$dev1" "$dev2" "$dev3"
- check vg_field $vg vg_mda_copies $(($mdacp * 1))
+ vgcreate --vgmetadatacopies $(( mdacp * 1 )) $vg "$dev1" "$dev2" "$dev3"
+ check vg_field $vg vg_mda_copies $(( mdacp * 1 ))
echo Ignore mdas on devices to be used for vgextend
echo Small value of vgetadatacopies should leave mdas as ignored
pvchange --metadataignore y "$dev4" "$dev5"
@@ -172,15 +172,15 @@ for mdacp in 1 2; do
echo vgreduce of un-ignored pv w/mda should trigger un-ignore on an mda
vgreduce $vg "$dev1" "$dev2" "$dev3"
check pv_field "$dev5" pv_mda_used_count $mdacp
- check vg_field $vg vg_mda_copies $(($mdacp * 1))
+ check vg_field $vg vg_mda_copies $(( mdacp * 1 ))
pvunignore_ "$dev1"
pvunignore_ "$dev2"
echo setting vgmetadatacopies to unmanaged should allow vgextend to add w/out balancing
vgchange --vgmetadatacopies unmanaged $vg
vgextend $vg "$dev1" "$dev2"
check vg_field $vg vg_mda_copies unmanaged
- check vg_field $vg vg_mda_count $(($mdacp * 3))
- check vg_field $vg vg_mda_used_count $((mdacp * 3))
+ check vg_field $vg vg_mda_count $(( mdacp * 3 ))
+ check vg_field $vg vg_mda_used_count $(( mdacp * 3 ))
check pv_field "$dev1" pv_mda_used_count $mdacp
check pv_field "$dev2" pv_mda_used_count $mdacp
vgremove -f $vg
@@ -190,18 +190,18 @@ echo Test special situations, vgsplit, vgmerge, etc
for mdacp in 1 2; do
pvcreate --metadatacopies $mdacp "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
vgcreate --vgmetadatacopies 2 $vg1 "$dev1" "$dev2" "$dev3"
- vgcreate --vgmetadatacopies $(($mdacp * 1)) $vg2 "$dev4" "$dev5"
+ vgcreate --vgmetadatacopies $(( mdacp * 1 )) $vg2 "$dev4" "$dev5"
echo vgsplit/vgmerge preserves value of metadata copies
check vg_field $vg1 vg_mda_copies 2
- check vg_field $vg2 vg_mda_copies $(($mdacp * 1))
+ check vg_field $vg2 vg_mda_copies $(( mdacp * 1 ))
vgsplit $vg1 $vg2 "$dev1"
- check vg_field $vg2 vg_mda_copies $(($mdacp * 1))
+ check vg_field $vg2 vg_mda_copies $(( mdacp * 1 ))
vgmerge $vg1 $vg2
check vg_field $vg1 vg_mda_copies 2
- check vg_field $vg1 vg_mda_count $(($mdacp * 5))
+ check vg_field $vg1 vg_mda_count $(( mdacp * 5 ))
echo vgsplit into new vg sets proper value of vgmetadatacopies
- vgsplit --vgmetadatacopies $(($mdacp * 2)) $vg1 $vg2 "$dev1" "$dev2"
- check vg_field $vg2 vg_mda_copies $(($mdacp * 2))
+ vgsplit --vgmetadatacopies $(( mdacp * 2 )) $vg1 $vg2 "$dev1" "$dev2"
+ check vg_field $vg2 vg_mda_copies $(( mdacp * 2 ))
echo vgchange fails if given both vgmetadatacopies and metadatacopies
not vgchange --vgmetadatacopies 5 --metadatacopies 7 $vg2
vgremove -f $vg1 $vg2
@@ -210,27 +210,27 @@ done
echo Test combination of --vgmetadatacopies and pvchange --metadataignore
for mdacp in 1 2; do
pvcreate --metadatacopies $mdacp "$dev1" "$dev2" "$dev3" "$dev4" "$dev5"
- vgcreate --vgmetadatacopies $(($mdacp * 1)) $vg1 "$dev1" "$dev2"
- check vg_field $vg1 vg_mda_copies $(($mdacp * 1))
- check vg_field $vg1 vg_mda_used_count $(($mdacp * 1))
+ vgcreate --vgmetadatacopies $(( mdacp * 1 )) $vg1 "$dev1" "$dev2"
+ check vg_field $vg1 vg_mda_copies $(( mdacp * 1 ))
+ check vg_field $vg1 vg_mda_used_count $(( mdacp * 1 ))
pvignore_ "$dev3"
echo Ensure vgextend of PVs with ignored MDAs does not add to vg_mda_used_count
vgextend $vg1 "$dev3"
- check vg_field $vg1 vg_mda_used_count $(($mdacp * 1))
+ check vg_field $vg1 vg_mda_used_count $(( mdacp * 1 ))
echo Using pvchange to unignore should update vg_mda_used_count
pvchange -f --metadataignore n "$dev3"
check pv_field "$dev3" pv_mda_used_count $mdacp
- check vg_field $vg1 vg_mda_used_count $(($mdacp * 2))
+ check vg_field $vg1 vg_mda_used_count $(( mdacp * 2 ))
echo Set unmanaged on the vg should keep ignore bits the same during vgextend
vgchange --vgmetadatacopies unmanaged $vg1
- check vg_field $vg1 vg_mda_used_count $(($mdacp * 2))
+ check vg_field $vg1 vg_mda_used_count $(( mdacp * 2 ))
pvunignore_ "$dev4"
vgextend $vg1 "$dev4"
check pv_field "$dev4" pv_mda_used_count $mdacp
- check vg_field $vg1 vg_mda_used_count $(($mdacp * 3))
+ check vg_field $vg1 vg_mda_used_count $(( mdacp * 3 ))
echo Using pvchange to ignore should update vg_mda_used_count
pvchange -f --metadataignore y "$dev4"
check pv_field "$dev4" pv_mda_used_count 0
- check vg_field $vg1 vg_mda_used_count $(($mdacp * 2))
+ check vg_field $vg1 vg_mda_used_count $(( mdacp * 2 ))
vgremove -f $vg1
done
diff --git a/test/shell/mirror-vgreduce-removemissing.sh b/test/shell/mirror-vgreduce-removemissing.sh
index ac7303f..3d9ecd5 100644
--- a/test/shell/mirror-vgreduce-removemissing.sh
+++ b/test/shell/mirror-vgreduce-removemissing.sh
@@ -83,7 +83,7 @@ rest_pvs_()
local n
local dev
- for n in $(seq 1 $(($index - 1))) $(seq $(($index + 1)) $num); do
+ for n in $(seq 1 $(( index - 1 )) ) $(seq $(( index + 1 )) $num); do
eval dev=$\dev$n
rem="$rem $dev"
done
diff --git a/test/shell/pvcreate-bootloaderarea.sh b/test/shell/pvcreate-bootloaderarea.sh
index 258c4cb..1147a3b 100644
--- a/test/shell/pvcreate-bootloaderarea.sh
+++ b/test/shell/pvcreate-bootloaderarea.sh
@@ -30,7 +30,7 @@ check pv_field "$dev1" pe_start "1048576"
#COMM 'pvcreate with booloader area size - test corner cases'
dev_size=$(pvs -o pv_size --noheadings "$dev1")
-pv_size=$[dev_size - 1048576] # device size - 1m pe_start = area for data
+pv_size=$(( dev_size - 1048576 )) # device size - 1m pe_start = area for data
# try to use the whole data area for bootloader area, remaining data area is zero then (pe_start = pv_size)
pvcreate --bootloaderareasize ${pv_size}b --dataalignment 1048576b "$dev1"
@@ -39,7 +39,7 @@ check pv_field "$dev1" ba_start 1048576
check pv_field "$dev1" ba_size $pv_size
# try to use the whole data area for bootloader area only and add one more byte - this must error out
-not pvcreate --bootloaderareasize $[pv_size + 1] --dataalignment 1048576b "$dev1" 2>err
+not pvcreate --bootloaderareasize $(( pv_size + 1 )) --dataalignment 1048576b "$dev1" 2>err
grep "Bootloader area with data-aligned start must not exceed device size" err
# restoring the PV should also restore the bootloader area correctly
diff --git a/test/shell/pvcreate-operation-md.sh b/test/shell/pvcreate-operation-md.sh
index 447b15e..d228ada 100644
--- a/test/shell/pvcreate-operation-md.sh
+++ b/test/shell/pvcreate-operation-md.sh
@@ -96,7 +96,7 @@ EOF
alignment_offset=0
# default alignment is 1M, add alignment_offset
- pv_align=$((1048576+$alignment_offset))
+ pv_align=$(( 1048576 + alignment_offset ))
check pv_field "${pvdev}p1" pe_start $pv_align --units b --nosuffix
pvremove "${pvdev}p1"
diff --git a/test/shell/pvcreate-usage.sh b/test/shell/pvcreate-usage.sh
index 97342ba..f0e6ee6 100644
--- a/test/shell/pvcreate-usage.sh
+++ b/test/shell/pvcreate-usage.sh
@@ -15,7 +15,7 @@ SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
PAGESIZE=$(getconf PAGESIZE)
# MDA_SIZE_MIN defined in lib/format_text/layout.h
-MDA_SIZE_MIN=$((8*$PAGESIZE))
+MDA_SIZE_MIN=$(( 8 * PAGESIZE ))
. lib/inittest
@@ -28,7 +28,7 @@ not pvcreate --setphysicalvolumesize -1024 "$dev1"
not pvcreate --metadatasize -1024 "$dev1"
#COMM 'pvcreate rejects metadatasize that is less than minimum size'
-not pvcreate --dataalignment $((${MDA_SIZE_MIN}/2))b --metadatasize $((${MDA_SIZE_MIN}/2))b "$dev1" 2>err
+not pvcreate --dataalignment $(( MDA_SIZE_MIN / 2 ))b --metadatasize $(( MDA_SIZE_MIN / 2 ))b "$dev1" 2>err
grep "Metadata area size too small" err
#COMM 'pvcreate accepts metadatasize that is at least the minimum size'
@@ -193,11 +193,11 @@ for ignore in y n; do
echo "vgcreate has proper vg_mda_count and vg_mda_used_count"
if [ $pv_in_vg = 1 ]; then
vgcreate $vg "$dev1" "$dev2"
- check vg_field $vg vg_mda_count "$(($mdacp * 2))"
+ check vg_field $vg vg_mda_count $(( mdacp * 2 ))
if [ $ignore = y ]; then
check vg_field $vg vg_mda_used_count "1"
else
- check vg_field $vg vg_mda_used_count "$(($mdacp * 2))"
+ check vg_field $vg vg_mda_used_count "$(( mdacp * 2 ))"
fi
check vg_field $vg vg_mda_copies "unmanaged"
vgremove $vg
diff --git a/test/shell/pvmove-restart.sh b/test/shell/pvmove-restart.sh
index 14806cb..abdcd86 100644
--- a/test/shell/pvmove-restart.sh
+++ b/test/shell/pvmove-restart.sh
@@ -55,7 +55,7 @@ j=0
for i in $lv1 pvmove0 pvmove0_mimage_0 pvmove0_mimage_1 ; do
while dmsetup status "$vg-$i"; do
dmsetup remove "$vg-$i" || {
- j=$(($j + 1))
+ j=$(( j + 1 ))
test $j -le 100 || die "Cannot take down devices."
sleep .1;
}
diff --git a/test/shell/read-ahead.sh b/test/shell/read-ahead.sh
index f21c52c..9045de8 100644
--- a/test/shell/read-ahead.sh
+++ b/test/shell/read-ahead.sh
@@ -25,7 +25,7 @@ aux prepare_vg 5
#COMM "test various read ahead settings (bz450922)"
lvcreate -l 100%FREE -i5 -I512 -n $lv $vg
ra=$(get lv_field $vg/$lv lv_kernel_read_ahead --units s --nosuffix)
-test $(( ( $ra / 5 ) * 5 )) -le $ra
+test $(( ( ra / 5 ) * 5 )) -le $ra
not lvchange -r auto $vg/$lv 2>&1 | grep auto
check lv_field $vg/$lv lv_read_ahead auto
lvchange -r 640 $vg/$lv
diff --git a/test/shell/topology-support.sh b/test/shell/topology-support.sh
index 1cb0f49..ffa3fe6 100644
--- a/test/shell/topology-support.sh
+++ b/test/shell/topology-support.sh
@@ -45,7 +45,7 @@ test_snapshot_mount() {
NUM_DEVS=1
PER_DEV_SIZE=34
-DEV_SIZE=$(($NUM_DEVS*$PER_DEV_SIZE))
+DEV_SIZE=$(( NUM_DEVS * PER_DEV_SIZE ))
# ---------------------------------------------
# Create "desktop-class" 4K drive
diff --git a/test/shell/vgextend-usage.sh b/test/shell/vgextend-usage.sh
index a3bfa2a..178df4d 100644
--- a/test/shell/vgextend-usage.sh
+++ b/test/shell/vgextend-usage.sh
@@ -127,11 +127,11 @@ for ignore in y n; do
check pv_field "$dev2" pv_mda_used_count $mdacp
fi
echo vg has proper vg_mda_count and vg_mda_used_count
- check vg_field $vg vg_mda_count $(($mdacp * 2 + 1))
+ check vg_field $vg vg_mda_count $(( mdacp * 2 + 1 ))
if [ $ignore = y ]; then
check vg_field $vg vg_mda_used_count 1
else
- check vg_field $vg vg_mda_used_count $(($mdacp * 2 + 1))
+ check vg_field $vg vg_mda_used_count $(( mdacp * 2 + 1 ))
fi
check vg_field $vg vg_mda_copies unmanaged
vgremove $vg
6 years, 9 months
master - tests: aux.sh tweaks
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=72e82b42a9c07293fdf...
Commit: 72e82b42a9c07293fdfae7ec0a98dd9fe5a0c868
Parent: 73cb5b486a906779b408b27567d8717617acb3f6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 10 13:01:33 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: aux.sh tweaks
Some improvements.
---
test/lib/aux.sh | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 6059b6a..aa5f0a0 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -513,7 +513,7 @@ kill_tagged_processes() {
echo "$pid" >> PIDS
done
- test -f PIDS || return 0
+ test -s PIDS || return 0
# wait if process exited and eventually -KILL
wait=0
@@ -527,6 +527,7 @@ kill_tagged_processes() {
}
teardown() {
+ local TEST_LEAKED_DEVICES
echo -n "## teardown..."
unset LVM_LOG_FILE_EPOCH
@@ -597,7 +598,9 @@ teardown() {
echo "ok"
- test "${LVM_TEST_PARALLEL:-0}" -eq 1 -o -n "$RUNNING_DMEVENTD" || not pgrep dmeventd #&>/dev/null
+ if test "${LVM_TEST_PARALLEL:-0}" = 1 || test -n "$RUNNING_DMEVENTD"; then
+ not pgrep dmeventd #&>/dev/null
+ fi
}
prepare_loop() {
@@ -872,7 +875,7 @@ common_dev_() {
read_ms=${3:-0}
write_ms=${4:-0}
offsets=( ${@:5} )
- if test "$read_ms" -eq 0 -a "$write_ms" -eq 0 ; then
+ if test "$read_ms" -eq 0 && test "$write_ms" -eq 0 ; then
offsets=( )
else
test -z "${offsets[@]}" && offsets=( "0:" )
@@ -928,8 +931,8 @@ common_dev_() {
delay_dev() {
if test ! -f HAVE_DM_DELAY ; then
target_at_least dm-delay 1 1 0 || return 0
+ touch HAVE_DM_DELAY
fi
- touch HAVE_DM_DELAY
common_dev_ delay "$@"
}
@@ -1187,10 +1190,9 @@ EOF
}
}
+ # append all parameters (avoid adding empty \n)
local v
- for v in "$@"; do
- echo "$v"
- done >> "$config_values"
+ test $# -gt 0 && printf "%s\n" "$@" >> "$config_values"
declare -A CONF 2>/dev/null || {
# Associative arrays is not available
@@ -1259,6 +1261,7 @@ profileconf() {
prepare_profiles() {
local pdir="$LVM_SYSTEM_DIR/profile"
+ local profile_name
mkdir -p "$pdir"
for profile_name in "$@"; do
test -L "lib/$profile_name.profile" || skip
6 years, 9 months
master - tests: aus.sh avoid duplicating arg list
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=73cb5b486a906779b40...
Commit: 73cb5b486a906779b408b27567d8717617acb3f6
Parent: f612fdd1ddb7b9c3fa837157b3415c6ab5bcfc3b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 10 12:46:02 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: aus.sh avoid duplicating arg list
---
test/lib/aux.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index a7692cb..6059b6a 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -225,7 +225,7 @@ prepare_lvmetad() {
# by setting LVM_TEST_LVMETAD_DEBUG_OPTS before calling inittest.
echo -n "## preparing lvmetad..."
$run_valgrind lvmetad -f "$@" -s "$TESTDIR/lvmetad.socket" \
- "${LVM_TEST_LVMETAD_DEBUG_OPTS--l all}" "$@" &
+ "${LVM_TEST_LVMETAD_DEBUG_OPTS--l all}" &
echo $! > LOCAL_LVMETAD
for i in {1..100} ; do
test "$i" -eq 100 && die "Startup of lvmetad is too slow."
6 years, 9 months
master - tests: aux.sh common pattern for starting daemons
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f612fdd1ddb7b9c3fa8...
Commit: f612fdd1ddb7b9c3fa837157b3415c6ab5bcfc3b
Parent: 4fc0166ca90efe902805f7abb951edeb0f7a91b2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 10 12:43:49 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: aux.sh common pattern for starting daemons
---
test/lib/aux.sh | 87 +++++++++++++++++++++++++++++--------------------------
1 files changed, 46 insertions(+), 41 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 747255b..a7692cb 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -21,6 +21,14 @@ expect_failure() {
echo "TEST EXPECT FAILURE"
}
+check_daemon_in_builddir() {
+ # skip if we don't have our own deamon...
+ if test -z "${installed_testsuite+varset}"; then
+ (which "$1" 2>/dev/null | grep -q "$abs_builddir") || skip "$1 is not in executed path."
+ fi
+ rm -f debug.log strace.log
+}
+
create_corosync_conf() {
COROSYNC_CONF="/etc/corosync/corosync.conf"
COROSYNC_NODE=$(hostname)
@@ -147,89 +155,84 @@ prepare_lvmlockd() {
}
prepare_clvmd() {
- rm -f debug.log strace.log
test "${LVM_TEST_LOCKING:-0}" -ne 3 && return # not needed
if pgrep clvmd ; then
- echo "Cannot use fake cluster locking with real clvmd ($(pgrep clvmd)) running."
- skip
+ skip "Cannot use fake cluster locking with real clvmd ($(pgrep clvmd)) running."
fi
- # skip if we don't have our own clvmd...
- if test -z "${installed_testsuite+varset}"; then
- (which clvmd 2>/dev/null | grep -q "$abs_builddir") || skip
- fi
+ check_daemon_in_builddir clvmd
test -e "$DM_DEV_DIR/control" || dmsetup table >/dev/null # create control node
# skip if singlenode is not compiled in
- (clvmd --help 2>&1 | grep "Available cluster managers" | grep -q "singlenode") || skip
+ (clvmd --help 2>&1 | grep "Available cluster managers" | grep -q "singlenode") || \
+ skip "Compiled clvmd does not support singlenode for testing."
# lvmconf "activation/monitoring = 1"
- local run_valgrind=
+ local run_valgrind=""
test "${LVM_VALGRIND_CLVMD:-0}" -eq 0 || run_valgrind="run_valgrind"
rm -f "$CLVMD_PIDFILE"
echo "<======== Starting CLVMD ========>"
+ echo -n "## preparing clvmd..."
# lvs is executed from clvmd - use our version
LVM_LOG_FILE_EPOCH=CLVMD LVM_LOG_FILE_MAX_LINES=1000000 LVM_BINARY=$(which lvm) $run_valgrind clvmd -Isinglenode -d 1 -f &
echo $! > LOCAL_CLVMD
for i in {1..100} ; do
- test $i -eq 100 && die "Startup of clvmd is too slow."
- test -e "$CLVMD_PIDFILE" -a -e "${CLVMD_PIDFILE%/*}/lvm/clvmd.sock" && break
- sleep .2
+ test "$i" -eq 100 && die "Startup of clvmd is too slow."
+ test -e "$CLVMD_PIDFILE" && test -e "${CLVMD_PIDFILE%/*}/lvm/clvmd.sock" && break
+ echo -n .
+ sleep .1
done
+ echo ok
}
prepare_dmeventd() {
- rm -f debug.log strace.log
if pgrep dmeventd ; then
- echo "Cannot test dmeventd with real dmeventd ($(pgrep dmeventd)) running."
- skip
+ skip "Cannot test dmeventd with real dmeventd ($(pgrep dmeventd)) running."
fi
- # skip if we don't have our own dmeventd...
- if test -z "${installed_testsuite+varset}"; then
- (which dmeventd 2>/dev/null | grep -q "$abs_builddir") || skip
- fi
+ check_daemon_in_builddir dmeventd
lvmconf "activation/monitoring = 1"
- local run_valgrind=
+ local run_valgrind
test "${LVM_VALGRIND_DMEVENTD:-0}" -eq 0 || run_valgrind="run_valgrind"
+ echo -n "## preparing dmeventd..."
# LVM_LOG_FILE_EPOCH=DMEVENTD $run_valgrind dmeventd -fddddl "$@" 2>&1 &
LVM_LOG_FILE_EPOCH=DMEVENTD $run_valgrind dmeventd -fddddl "$@" >debug.log_DMEVENTD_out 2>&1 &
echo $! > LOCAL_DMEVENTD
# FIXME wait for pipe in /var/run instead
for i in {1..100} ; do
- test $i -eq 100 && die "Startup of dmeventd is too slow."
+ test "$i" -eq 100 && die "Startup of dmeventd is too slow."
test -e "${DMEVENTD_PIDFILE}" && break
- sleep .2
+ echo -n .
+ sleep .1
done
echo ok
}
prepare_lvmetad() {
- rm -f debug.log strace.log
- # skip if we don't have our own lvmetad...
- if test -z "${installed_testsuite+varset}"; then
- (which lvmetad 2>/dev/null | grep -q "$abs_builddir") || skip
- fi
+ check_daemon_in_builddir lvmetad
- local run_valgrind=
+ local run_valgrind
test "${LVM_VALGRIND_LVMETAD:-0}" -eq 0 || run_valgrind="run_valgrind"
kill_sleep_kill_ LOCAL_LVMETAD "${LVM_VALGRIND_LVMETAD:-0}"
- # Avoid reconfiguring, if already set to use_lvmetad
- (grep use_lvmetad CONFIG_VALUES 2>/dev/null | tail -n 1 | grep -q 1) || \
- aux lvmconf "global/use_lvmetad = 1" "devices/md_component_detection = 0"
+ lvmconf "global/use_lvmetad = 1" "devices/md_component_detection = 0"
# Default debug is "-l all" and could be override
# by setting LVM_TEST_LVMETAD_DEBUG_OPTS before calling inittest.
- echo "preparing lvmetad..."
+ echo -n "## preparing lvmetad..."
$run_valgrind lvmetad -f "$@" -s "$TESTDIR/lvmetad.socket" \
"${LVM_TEST_LVMETAD_DEBUG_OPTS--l all}" "$@" &
echo $! > LOCAL_LVMETAD
- while ! test -e "$TESTDIR/lvmetad.socket"; do echo -n .; sleep .1; done # wait for the socket
+ for i in {1..100} ; do
+ test "$i" -eq 100 && die "Startup of lvmetad is too slow."
+ test -e "$TESTDIR/lvmetad.socket" && break
+ echo -n .
+ sleep .1;
+ done
echo ok
}
@@ -239,7 +242,7 @@ lvmetad_talk() {
use=socat
elif echo | not nc -U "$TESTDIR/lvmetad.socket" ; then
echo "WARNING: Neither socat nor nc -U seems to be available." 1>&2
- echo "# failed to contact lvmetad"
+ echo "## failed to contact lvmetad."
return 1
fi
@@ -263,21 +266,23 @@ notify_lvmetad() {
}
prepare_lvmpolld() {
- rm -f debug.log
- # skip if we don't have our own lvmpolld...
- (which lvmpolld 2>/dev/null | grep "$abs_builddir") || skip
-
+ check_daemon_in_builddir lvmetad
lvmconf "global/use_lvmpolld = 1"
- local run_valgrind=
+ local run_valgrind
test "${LVM_VALGRIND_LVMPOLLD:-0}" -eq 0 || run_valgrind="run_valgrind"
kill_sleep_kill_ LOCAL_LVMPOLLD "${LVM_VALGRIND_LVMPOLLD:-0}"
- echo "preparing lvmpolld..."
+ echo -n "## preparing lvmpolld..."
$run_valgrind lvmpolld -f "$@" -s "$TESTDIR/lvmpolld.socket" -B "$TESTDIR/lib/lvm" -l all &
echo $! > LOCAL_LVMPOLLD
- while ! test -e "$TESTDIR/lvmpolld.socket"; do echo -n .; sleep .1; done # wait for the socket
+ for i in {1..100} ; do
+ test "$i" -eq 100 && die "Startup of lvmpolld is too slow."
+ test -e "$TESTDIR/lvmpolld.socket" && break
+ echo -n .;
+ sleep .1;
+ done # wait for the socket
echo ok
}
6 years, 9 months
master - tests: aux.sh move corosyn
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4fc0166ca90efe90280...
Commit: 4fc0166ca90efe902805f7abb951edeb0f7a91b2
Parent: 408e3b84f6b5d04fca1533cc7aab80d19e561d1c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jul 10 12:42:20 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: aux.sh move corosyn
---
test/lib/aux.sh | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 2e0cc10..747255b 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
-# Copyright (C) 2011-2015 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2011-2017 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
@@ -21,9 +21,10 @@ expect_failure() {
echo "TEST EXPECT FAILURE"
}
-COROSYNC_CONF="/etc/corosync/corosync.conf"
-COROSYNC_NODE=$(hostname)
create_corosync_conf() {
+ COROSYNC_CONF="/etc/corosync/corosync.conf"
+ COROSYNC_NODE=$(hostname)
+
if test -a "$COROSYNC_CONF"; then
if ! grep "created by lvm test suite" "$COROSYNC_CONF"; then
rm "$COROSYNC_CONF"
6 years, 9 months
master - tests: cleanup msg
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=408e3b84f6b5d04fca1...
Commit: 408e3b84f6b5d04fca1533cc7aab80d19e561d1c
Parent: 73bbd5528c2ccc9c5bdc4851e1c0b0ade19705ec
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jul 6 11:04:07 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: cleanup msg
---
test/lib/aux.sh | 38 +++++++++++++++++++-------------------
1 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index d3e1af9..2e0cc10 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -52,12 +52,12 @@ create_dlm_conf() {
prepare_dlm() {
if pgrep dlm_controld ; then
- echo "Cannot run while existing dlm_controld process exists"
+ echo "Cannot run while existing dlm_controld process exists."
exit 1
fi
if pgrep corosync; then
- echo "Cannot run while existing corosync process exists"
+ echo "Cannot run while existing corosync process exists."
exit 1
fi
@@ -67,14 +67,14 @@ prepare_dlm() {
systemctl start corosync
sleep 1
if ! pgrep corosync; then
- echo "Failed to start corosync"
+ echo "Failed to start corosync."
exit 1
fi
systemctl start dlm
sleep 1
if ! pgrep dlm_controld; then
- echo "Failed to start dlm"
+ echo "Failed to start dlm."
exit 1
fi
}
@@ -286,7 +286,7 @@ lvmpolld_talk() {
use=socat
elif echo | not nc -U "$TESTDIR/lvmpolld.socket" ; then
echo "WARNING: Neither socat nor nc -U seems to be available." 1>&2
- echo "# failed to contact lvmpolld"
+ echo "## failed to contact lvmpolld."
return 1
fi
@@ -302,15 +302,15 @@ lvmpolld_dump() {
}
prepare_lvmdbusd() {
- local daemon=
+ local daemon
rm -f debug.log_LVMDBUSD_out
kill_sleep_kill_ LOCAL_LVMDBUSD 0
# FIXME: This is not correct! Daemon is auto started.
- echo "checking lvmdbusd is NOT running..."
+ echo -n "## checking lvmdbusd is NOT running..."
if pgrep -f -l lvmdbusd | grep python3 ; then
- skip "Cannot run while existing lvmdbusd process exists"
+ skip "Cannot run lvmdbusd while existing lvmdbusd process exists"
fi
echo ok
@@ -323,7 +323,7 @@ prepare_lvmdbusd() {
else
daemon=$(which lvmdbusd || :)
fi
- [[ -n "$daemon" && -x "$daemon" ]] || skip "The daemon is missing"
+ test -x "$daemon" || skip "The lvmdbusd daemon is missing"
which python3 >/dev/null || skip "Missing python3"
python3 -c "import pyudev, dbus, gi.repository" || skip "Missing python modules"
@@ -334,14 +334,14 @@ prepare_lvmdbusd() {
install -m 644 "$abs_top_builddir/scripts/com.redhat.lvmdbus1.conf" /etc/dbus-1/system.d/
fi
- echo "preparing lvmdbusd..."
+ echo "## preparing lvmdbusd..."
lvmconf "global/notify_dbus = 1"
"$daemon" --debug > debug.log_LVMDBUSD_out 2>&1 &
local pid=$!
sleep 1
- echo "checking lvmdbusd IS running..."
+ echo -n "## checking lvmdbusd IS running..."
if ! pgrep -f -l lvmdbusd | grep python3; then
echo "Failed to start lvmdbusd daemon"
return 1
@@ -397,7 +397,7 @@ teardown_devs_prefixed() {
local mounts=( $(grep "$prefix" /proc/mounts | cut -d' ' -f1) )
if test ${#mounts[@]} -gt 0; then
- test "$stray" -eq 0 || echo "Removing stray mounted devices containing $prefix:" "${mounts[@]}"
+ test "$stray" -eq 0 || echo "## removing stray mounted devices containing $prefix:" "${mounts[@]}"
if umount -fl "${mounts[@]}"; then
udev_wait
fi
@@ -424,7 +424,7 @@ teardown_devs_prefixed() {
local num_remaining_devs=999
while num_devs=$(dm_table | grep -c "$prefix") && \
test "$num_devs" -lt "$num_remaining_devs" -a "$num_devs" -ne 0; do
- test "$stray" -eq 0 || echo "Removing $num_devs stray mapped devices with names beginning with $prefix: "
+ test "$stray" -eq 0 || echo "## removing $num_devs stray mapped devices with names beginning with $prefix: "
# HACK: sort also by minors - so we try to close 'possibly later' created device first
for dm in $(dm_info name --sort open,-minor | grep "$prefix") ; do
dmsetup remove -f "$dm" || true
@@ -460,7 +460,7 @@ teardown_devs() {
local stray_loops=( $(losetup -a | grep "$COMMON_PREFIX" | cut -d: -f1) )
test ${#stray_loops[@]} -eq 0 || {
teardown_devs_prefixed "$COMMON_PREFIX" 1
- echo "Removing stray loop devices containing $COMMON_PREFIX:" "${stray_loops[@]}"
+ echo "## removing stray loop devices containing $COMMON_PREFIX:" "${stray_loops[@]}"
for i in "${stray_loops[@]}" ; do test ! -b "$i" || losetup -d "$i" || true ; done
# Leave test when udev processed all removed devices
udev_wait
@@ -501,7 +501,7 @@ kill_tagged_processes() {
rm -f PIDS
print_procs_by_tag_ "$@" | while read -r pid wait; do
if test -n "$pid" ; then
- echo "Killing tagged process: $pid ${wait:0:120}..."
+ echo "## killing tagged process: $pid ${wait:0:120}..."
kill -TERM "$pid" 2>/dev/null || true
fi
echo "$pid" >> PIDS
@@ -535,7 +535,7 @@ teardown() {
if test -n "$LVM_TEST_LVMLOCKD_TEST" ; then
echo ""
- echo "stopping lvmlockd in teardown"
+ echo "## stopping lvmlockd in teardown"
killall lvmlockd
sleep 1
killall lvmlockd || true
@@ -549,7 +549,7 @@ teardown() {
# Avoid activation of dmeventd if there is no pid
cfg=$(test -s LOCAL_DMEVENTD || echo "--config activation{monitoring=0}")
if dm_info suspended,name | grep -q "^Suspended:.*$prefix" ; then
- echo "Skipping vgremove, suspended devices detected."
+ echo "## skipping vgremove, suspended devices detected."
else
vgremove -ff "$cfg" \
"$vg" "$vg1" "$vg2" "$vg3" "$vg4" &>/dev/null || rm -f debug.log strace.log
@@ -579,7 +579,7 @@ teardown() {
fi
test -z "$TEST_LEAKED_DEVICES" || {
- echo "Unexpected devices left dm table:"
+ echo "## unexpected devices left dm table:"
echo "$TEST_LEAKED_DEVICES"
return 1
}
@@ -1234,7 +1234,7 @@ lvmconf() {
test "$val" = "$i" || { needed=1; break; }
done
test "$needed" -eq 0 && {
- echo "## LVMCONF: values are already there, skipping."
+ echo "## Skipping reconfiguring for: (" "$@" ")"
return 0 # not needed
}
}
6 years, 9 months