master - tests: use well defined test
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1c9789b0ccabf95aae8...
Commit: 1c9789b0ccabf95aae84d48d41322d8609ad8d51
Parent: 9c0a92ee8dc4eca67f53b72f190e7c038ae984d4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 7 21:31:38 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: use well defined test
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
Apparently && and || "short-circuit" while -a and -o do not.
---
test/lib/aux.sh | 6 +++---
test/lib/utils.sh | 4 ++--
test/shell/lvchange-raid.sh | 2 +-
test/shell/name-mangling.sh | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index aa5f0a0..fda826f 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1442,13 +1442,13 @@ have_thin() {
declare -a CONF
# disable thin_check if not present in system
- if test -n "$LVM_TEST_THIN_CHECK_CMD" -a ! -x "$LVM_TEST_THIN_CHECK_CMD" ; then
+ if test -n "$LVM_TEST_THIN_CHECK_CMD" && test ! -x "$LVM_TEST_THIN_CHECK_CMD"; then
CONF[0]="global/thin_check_executable = \"\""
fi
- if test -n "$LVM_TEST_THIN_DUMP_CMD" -a ! -x "$LVM_TEST_THIN_DUMP_CMD" ; then
+ if test -n "$LVM_TEST_THIN_DUMP_CMD" && test ! -x "$LVM_TEST_THIN_DUMP_CMD"; then
CONF[1]="global/thin_dump_executable = \"\""
fi
- if test -n "$LVM_TEST_THIN_REPAIR_CMD" -a ! -x "$LVM_TEST_THIN_REPAIR_CMD" ; then
+ if test -n "$LVM_TEST_THIN_REPAIR_CMD" && test ! -x "$LVM_TEST_THIN_REPAIR_CMD"; then
CONF[2]="global/thin_repair_executable = \"\""
fi
if test ${#CONF[@]} -ne 0 ; then
diff --git a/test/lib/utils.sh b/test/lib/utils.sh
index 4e43e64..8545703 100644
--- a/test/lib/utils.sh
+++ b/test/lib/utils.sh
@@ -147,7 +147,7 @@ STACKTRACE() {
test -f SKIP_THIS_TEST && exit 200
- test -z "$LVM_TEST_NODEBUG" -a -f TESTNAME && {
+ test -z "$LVM_TEST_NODEBUG" && test -f TESTNAME && {
local name
local idx
for i in debug.log* ; do
@@ -200,7 +200,7 @@ init_udev_transaction() {
}
finish_udev_transaction() {
- if test "$DM_UDEV_SYNCHRONISATION" = 1 -a -n "$DM_UDEV_COOKIE"; then
+ if test "$DM_UDEV_SYNCHRONISATION" = 1 && test -n "$DM_UDEV_COOKIE" ; then
dmsetup udevreleasecookie
unset DM_UDEV_COOKIE
fi
diff --git a/test/shell/lvchange-raid.sh b/test/shell/lvchange-raid.sh
index ce29768..8c22481 100644
--- a/test/shell/lvchange-raid.sh
+++ b/test/shell/lvchange-raid.sh
@@ -332,7 +332,7 @@ TEST_TYPES="- snapshot"
# thinpool works EX in cluster
# but they don't work together in a cluster yet
# (nor does thinpool+mirror work in a cluster yet)
-test ! -e LOCAL_CLVMD -a aux have_thin 1 8 0 && TEST_TYPE="$TEST_TYPES thinpool_data thinpool_meta"
+test ! -e LOCAL_CLVMD && aux have_thin 1 8 0 && TEST_TYPE="$TEST_TYPES thinpool_data thinpool_meta"
# Implicit test for 'raid1' only
if test "${TEST_RAID:-raid1}" = raid1 ; then
diff --git a/test/shell/name-mangling.sh b/test/shell/name-mangling.sh
index 3b699a2..66c0aeb 100644
--- a/test/shell/name-mangling.sh
+++ b/test/shell/name-mangling.sh
@@ -173,7 +173,7 @@ function check_mangle_cmd()
fi
fi
- if [ $r = 0 -a $rename_expected = 1 ]; then
+ if [ "$r" = 0 ] && [ "$rename_expected" = 1 ]; then
# successfuly renamed to expected name
remove_dm_dev none "$expected"
elif [ $r = 1 ]; then
6 years, 10 months
master - tests: cleaner written eval
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9c0a92ee8dc4eca67f5...
Commit: 9c0a92ee8dc4eca67f53b72f190e7c038ae984d4
Parent: ec05890026ac9f66797fdd44dad4c8ce02b857b6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 7 21:24:57 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: cleaner written eval
Although code work this coding style is better.
This \c will be a regular 'c' in this context.
---
test/shell/fsadm.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/fsadm.sh b/test/shell/fsadm.sh
index fed7eb4..35c3443 100644
--- a/test/shell/fsadm.sh
+++ b/test/shell/fsadm.sh
@@ -80,7 +80,7 @@ fscheck_reiserfs()
check_missing()
{
local t
- eval t=$\check_$1
+ eval "t=\$check_$1"
test -z "$t" && return 0
test "$t" = skip && return 1
echo "WARNING: fsadm test skipped $1 tests, $t tool is missing."
6 years, 10 months
master - tests: mixes string and array
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ec05890026ac9f66797...
Commit: ec05890026ac9f66797fdd44dad4c8ce02b857b6
Parent: 4e2fd6f6abcb97fe9f8ec2b5843469e2b497df25
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 7 21:24:17 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: mixes string and array
Argument mixes string and array. Use * or separate argument
---
test/shell/select-report.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/select-report.sh b/test/shell/select-report.sh
index 314e207..b879bf5 100644
--- a/test/shell/select-report.sh
+++ b/test/shell/select-report.sh
@@ -63,7 +63,7 @@ sel() {
# the number of lines on output must match
test "$items_found" -eq $# || {
- echo " >>> NUMBER OF ITEMS EXPECTED: $# ($@)"
+ echo " >>> NUMBER OF ITEMS EXPECTED: $#" "$@"
echo " >>> NUMBER OF ITEMS FOUND: $items_found ($(< $OUT_LOG_FILE))"
return 1
}
6 years, 10 months
master - tests: fix caller of mirror_images_on
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4e2fd6f6abcb97fe9f8...
Commit: 4e2fd6f6abcb97fe9f8ec2b5843469e2b497df25
Parent: bc10d0373ad7c2e9997896c72e0740bd71bc8e46
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 7 21:18:56 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: fix caller of mirror_images_on
Missed vg name.
---
test/shell/lvconvert-mirror.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/shell/lvconvert-mirror.sh b/test/shell/lvconvert-mirror.sh
index d9dfdfb..449f605 100644
--- a/test/shell/lvconvert-mirror.sh
+++ b/test/shell/lvconvert-mirror.sh
@@ -95,7 +95,7 @@ lvconvert -m2 $vg/$lv1 "$dev1" "$dev2" "$dev4" "$dev3:0" # If the above "should"
aux wait_for_sync $vg $lv1
lvconvert -m-1 $vg/$lv1 "$dev1"
-check mirror_images_on $lv1 "$dev2" "$dev4"
+check mirror_images_on $vg $lv1 "$dev2" "$dev4"
lvconvert -m-1 $vg/$lv1 "$dev2"
check linear $vg $lv1
check lv_on $vg $lv1 "$dev4"
@@ -253,7 +253,7 @@ lvremove -ff $vg
# lvconvert from linear (on multiple PVs) to mirror
lvcreate -aey -l 8 -n $lv1 $vg "$dev1:0-3" "$dev2:0-3"
-lvconvert --type mirror -vvvv -m1 $vg/$lv1
+lvconvert --type mirror -m1 $vg/$lv1
should check mirror $vg $lv1
check mirror_legs $vg $lv1 2
6 years, 10 months
master - tests: fix working with devs in array
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bc10d0373ad7c2e9997...
Commit: bc10d0373ad7c2e9997896c72e0740bd71bc8e46
Parent: fdbb680531b08e03dba2dc3d2f22381bf55abbb0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Jul 8 18:23:47 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: fix working with devs in array
Also fixes one instance of invalid 'mirror_image_on' test
and places there correct indexed set of PVs.
---
test/shell/mirror-vgreduce-removemissing.sh | 82 +++++++++++++++-----------
1 files changed, 47 insertions(+), 35 deletions(-)
diff --git a/test/shell/mirror-vgreduce-removemissing.sh b/test/shell/mirror-vgreduce-removemissing.sh
index 7f0c190..2707059 100644
--- a/test/shell/mirror-vgreduce-removemissing.sh
+++ b/test/shell/mirror-vgreduce-removemissing.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (C) 2008-2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2008-2017 Red Hat, Inc. All rights reserved.
# Copyright (C) 2007 NEC Corporation
#
# This copyrighted material is made available to anyone wishing to use,
@@ -20,18 +20,20 @@ export LVM_TEST_LVMETAD_DEBUG_OPTS=${LVM_TEST_LVMETAD_DEBUG_OPTS-}
. lib/inittest
+list_pvs=()
+
lv_is_on_ ()
{
local lv=$vg/$1
shift
- local pvs=$@
+ local list_pvs=( "$@" )
- echo "Check if $lv is exactly on PVs $pvs"
+ echo "Check if $lv is exactly on PVs" "${list_pvs[@]}"
rm -f out1 out2
- echo $pvs | sed 's/ /\n/g' | sort | uniq > out1
+ printf "%s\n" "${list_pvs[@]}" | sort | uniq > out1
lvs -a -o+devices $lv
- get lv_devices $lv | sed 's/ /\n/g' | sort | uniq > out2 || true
+ get lv_devices "$lv" | sort | uniq > out2
diff --ignore-blank-lines out1 out2
}
@@ -40,24 +42,25 @@ mimages_are_on_ ()
{
local lv=$1
shift
- local pvs=$@
- local mimages
+ local list_pvs=( "$@" )
+ local mimages=()
local i
- echo "Check if mirror images of $lv are on PVs $pvs"
- rm -f out1 out2
- echo $pvs | sed 's/ /\n/g' | sort | uniq > out1
- lvs --noheadings -a -o lv_name $vg | tee lvs_log
- mimages=$(grep "${lv}_mimage_" lvs_log | \
- sed 's/\[//g; s/\]//g' || true)
+ echo "Check if mirror images of $lv are on PVs" "${list_pvs[@]}"
+ printf "%s\n" "${list_pvs[@]}" | sort | uniq > out1
- for i in $mimages; do
+ get lv_field_lv_ "$vg" lv_name -a | grep "${lv}_mimage_" | tr -d [] | tee lvs_log
+ readarray -t mimages < lvs_log
+
+ for i in "${mimages[@]}"; do
echo "Checking $vg/$i"
- lvs -a -o+devices $vg/$i
- lvs -a -odevices --noheadings $vg/$i | tee lvs_log
- sed 's/([^)]*)//g; s/ //g; s/,/ /g' lvs_log | sort | uniq >> out2 || true
+ lvs -a -o+devices "$vg/$i"
done
+ for i in "${mimages[@]}"; do
+ get lv_devices "$vg/$i"
+ done | sort | uniq > out2
+
diff --ignore-blank-lines out1 out2
}
@@ -79,16 +82,16 @@ rest_pvs_()
{
local index=$1
local num=$2
- local rem=
+ local rem=()
local n
local dev
for n in $(seq 1 $(( index - 1 )) ) $(seq $(( index + 1 )) $num); do
- eval dev=$\dev$n
- rem="$rem $dev"
+ eval "dev=\$dev$n"
+ rem+=( "$dev" )
done
- echo "$rem"
+ printf "%s\n" "${rem[@]}"
}
# ---------------------------------------------------------------------
@@ -156,9 +159,10 @@ test_3way_mirror_fail_1_()
lvcreate -an -Zn -l2 --type mirror -m2 --nosync -n $lv1 $vg "$dev1" "$dev2" "$dev3" "$dev4":$BLOCKS
mimages_are_on_ $lv1 "$dev1" "$dev2" "$dev3"
mirrorlog_is_on_ $lv1 "$dev4"
- eval aux disable_dev \$dev$index
+ eval aux disable_dev "\$dev$index"
vgreduce --removemissing --force $vg
- mimages_are_on_ $lv1 $(rest_pvs_ $index 3)
+ readarray -t list_pvs <<< "$(rest_pvs_ "$index" 3)"
+ mimages_are_on_ "$lv1" "${list_pvs[@]}"
mirrorlog_is_on_ $lv1 "$dev4"
}
@@ -166,7 +170,7 @@ for n in $(seq 1 3); do
#COMM fail mirror image $(($n - 1)) of 3-way mirrored LV"
prepare_lvs_
test_3way_mirror_fail_1_ $n
- eval recover_vg_ \$dev$n
+ eval recover_vg_ "\$dev$n"
done
# ---------------------------------------------------------------------
@@ -181,18 +185,20 @@ test_3way_mirror_fail_2_()
lvcreate -an -Zn -l2 --type mirror -m2 --nosync -n $lv1 $vg "$dev1" "$dev2" "$dev3" "$dev4":$BLOCKS
mimages_are_on_ $lv1 "$dev1" "$dev2" "$dev3"
mirrorlog_is_on_ $lv1 "$dev4"
- rest_pvs_ $index 3
- aux disable_dev $(rest_pvs_ $index 3)
+
+ readarray -t list_pvs <<< "$(rest_pvs_ "$index" 3)"
+ aux disable_dev "${list_pvs[@]}"
vgreduce --force --removemissing $vg
lv_is_linear_ $lv1
- eval lv_is_on_ $lv1 \$dev$n
+ eval lv_is_on_ $lv1 "\$dev$n"
}
for n in $(seq 1 3); do
#COMM fail mirror images other than mirror image $(($n - 1)) of 3-way mirrored LV
prepare_lvs_
test_3way_mirror_fail_2_ $n
- recover_vg_ $(rest_pvs_ $n 3)
+ readarray -t list_pvs <<< "$(rest_pvs_ "$n" 3)"
+ recover_vg_ "${list_pvs[@]}"
done
# ---------------------------------------------------------------------
@@ -212,7 +218,8 @@ test_3way_mirror_plus_1_fail_1_()
lvs -a -o +devices
vgreduce --removemissing --force $vg
lvs -a -o+devices # $vg
- check mirror_images_on $vg $lv1 "$dev5" # $(rest_pvs_ $index 4)
+ readarray -t list_pvs <<< "$(rest_pvs_ "$index" 4)"
+ check mirror_images_on $vg $lv1 "${list_pvs[@]}"
check mirror_log_on $vg $lv1 "$dev5"
}
@@ -238,7 +245,8 @@ test_3way_mirror_plus_1_fail_3_()
check mirror_images_on $vg $lv1 "$dev1" "$dev2" "$dev3" "$dev4"
check mirror_log_on $vg $lv1 "$dev5"
lvs -a -o+devices $vg
- aux disable_dev $(rest_pvs_ $index 4)
+ readarray -t list_pvs <<< "$(rest_pvs_ "$index" 4)"
+ aux disable_dev "${list_pvs[@]}"
vgreduce --removemissing --force $vg
lvs -a -o+devices $vg
eval dev=\$dev$n
@@ -250,7 +258,8 @@ for n in $(seq 1 4); do
#COMM "fail mirror images other than mirror image $(($n - 1)) of 4-way (1 converting) mirrored LV"
prepare_lvs_
test_3way_mirror_plus_1_fail_3_ $n
- recover_vg_ $(rest_pvs_ $n 4)
+ readarray -t list_pvs <<< "$(rest_pvs_ "$n" 4)"
+ recover_vg_ "${list_pvs[@]}"
done
# ---------------------------------------------------------------------
@@ -268,7 +277,8 @@ test_2way_mirror_plus_2_fail_1_()
mirrorlog_is_on_ $lv1 "$dev5"
eval aux disable_dev \$dev$n
vgreduce --removemissing --force $vg
- mimages_are_on_ $lv1 $(rest_pvs_ $index 4)
+ readarray -t list_pvs <<< "$(rest_pvs_ "$index" 4)"
+ mimages_are_on_ "$lv1" "${list_pvs[@]}"
mirrorlog_is_on_ $lv1 "$dev5"
}
@@ -276,7 +286,7 @@ for n in $(seq 1 4); do
#COMM "fail mirror image $(($n - 1)) of 4-way (2 converting) mirrored LV"
prepare_lvs_
test_2way_mirror_plus_2_fail_1_ $n
- eval recover_vg_ \$dev$n
+ eval recover_vg_ "\$dev$n"
done
# ---------------------------------------------------------------------
@@ -293,7 +303,8 @@ test_2way_mirror_plus_2_fail_3_()
lvconvert -m+2 $vg/$lv1 "$dev3" "$dev4"
mimages_are_on_ $lv1 "$dev1" "$dev2" "$dev3" "$dev4"
mirrorlog_is_on_ $lv1 "$dev5"
- aux disable_dev $(rest_pvs_ $index 4)
+ readarray -t list_pvs <<< "$(rest_pvs_ "$index" 4)"
+ aux disable_dev "${list_pvs[@]}"
vgreduce --removemissing --force $vg
lvs -a -o+devices $vg
eval dev=\$dev$n
@@ -305,7 +316,8 @@ for n in $(seq 1 4); do
#COMM "fail mirror images other than mirror image $(($n - 1)) of 4-way (2 converting) mirrored LV"
prepare_lvs_
test_2way_mirror_plus_2_fail_3_ $n
- recover_vg_ $(rest_pvs_ $n 4)
+ readarray -t list_pvs <<< "$(rest_pvs_ "$n" 4)"
+ recover_vg_ "${list_pvs[@]}"
done
# ---------------------------------------------------------------------
6 years, 10 months
master - tests: check mirror_images_on fixed
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fdbb680531b08e03dba...
Commit: fdbb680531b08e03dba2dc3d2f22381bf55abbb0
Parent: 91d6a62fc594152964ea25c44691c02ae23cdb9a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 7 21:17:03 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: check mirror_images_on fixed
Fix mirror_images_on() to actually report something useful (thought
it might be tuned later).
So for now the function got through all '_mimages_' and compares
where the order of them is matching given list of devices.
---
test/lib/check.sh | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/test/lib/check.sh b/test/lib/check.sh
index 603f334..76015b8 100644
--- a/test/lib/check.sh
+++ b/test/lib/check.sh
@@ -90,12 +90,18 @@ lv_tree_on() {
lv_on_diff_ devs[@] "$@"
}
+# Test if all mimage_X LV legs are sitting on given ordered list of PVs
+# When LV is composed of imagetmp, such leg is decomposed so only
+# real _mimage LVs are always checked
mirror_images_on() {
local vg=$1
local lv=$2
shift 2
- for i in $(lvdevices "$lv"); do
- lv_on "$vg" "$lv" "$1"
+ local mimages=()
+ readarray -t mimages <<< "$(get lv_field_lv_ "$vg" lv_name -a | grep "${lv}_mimage_" )"
+
+ for i in "${mimages[@]}"; do
+ lv_on "$vg" "$i" "$1"
shift
done
}
6 years, 10 months
master - tests: correcting usage of $@
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=91d6a62fc594152964e...
Commit: 91d6a62fc594152964ea25c44691c02ae23cdb9a
Parent: f161c6ee9fad4d2ddefb97d4837d29360e5bc280
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 7 13:45:04 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: correcting usage of $@
Use "$@" (with quotes) to prevent whitespace problems.
---
test/shell/lvcreate-thin.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvcreate-thin.sh b/test/shell/lvcreate-thin.sh
index 375d4c0..27cce22 100644
--- a/test/shell/lvcreate-thin.sh
+++ b/test/shell/lvcreate-thin.sh
@@ -25,7 +25,7 @@ check_lv_field_modules_()
mod=$1
shift
- for d in $*; do
+ for d in "$@"; do
check lv_field $vg/$d modules $mod
done
}
6 years, 10 months
master - tests: assign as string
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f161c6ee9fad4d2ddef...
Commit: f161c6ee9fad4d2ddefb97d4837d29360e5bc280
Parent: 2e47ab9b8c4526d1663da4aa3122b013237aaf9f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 7 12:12:24 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: assign as string
Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.
---
test/shell/vgsplit-operation.sh | 2 +-
test/shell/vgsplit-raid.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/shell/vgsplit-operation.sh b/test/shell/vgsplit-operation.sh
index 5dff173..2ec140b 100644
--- a/test/shell/vgsplit-operation.sh
+++ b/test/shell/vgsplit-operation.sh
@@ -21,7 +21,7 @@ export LVM_TEST_LVMETAD_DEBUG_OPTS=${LVM_TEST_LVMETAD_DEBUG_OPTS-}
. lib/inittest
COMM() {
- LAST_TEST="$@"
+ LAST_TEST="$*"
}
create_vg_() {
diff --git a/test/shell/vgsplit-raid.sh b/test/shell/vgsplit-raid.sh
index dc2ef5a..08e2a8e 100644
--- a/test/shell/vgsplit-raid.sh
+++ b/test/shell/vgsplit-raid.sh
@@ -17,7 +17,7 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
COMM() {
- LAST_TEST="$@"
+ LAST_TEST="$*"
}
create_vg_() {
6 years, 10 months
master - tests: secure rm call
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2e47ab9b8c4526d1663...
Commit: 2e47ab9b8c4526d1663da4aa3122b013237aaf9f
Parent: 4ed3f1bee3fca0b27ace8bfe593aa6aee15a3a19
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 7 11:50:33 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: secure rm call
Use "${var:?}" to ensure this never expands to / .
(Should never happen as 'dir' was supposed to exist from preceding
test.)
---
test/shell/profiles-thin.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/profiles-thin.sh b/test/shell/profiles-thin.sh
index 81ac90b..9c9fadf 100644
--- a/test/shell/profiles-thin.sh
+++ b/test/shell/profiles-thin.sh
@@ -62,7 +62,7 @@ vgremove -ff $vg
if test -d "$DM_DEV_DIR/$vg" ; then
should not echo "Udev has left \"$DM_DEV_DIR/$vg\"!"
- rm -rf "$DM_DEV_DIR/$vg"
+ rm -rf "${DM_DEV_DIR:?/dev}/$vg"
fi
# The profile must be also applied if using the profile
6 years, 10 months
master - tests: improve loop
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4ed3f1bee3fca0b27ac...
Commit: 4ed3f1bee3fca0b27ace8bfe593aa6aee15a3a19
Parent: e68d986cd5374edc5b6884fc1c3dcc197c954b46
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jul 7 10:10:36 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Jul 10 14:23:53 2017 +0200
tests: improve loop
---
test/shell/lvconvert-raid-takeover.sh | 24 +++++++++++-------------
1 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/test/shell/lvconvert-raid-takeover.sh b/test/shell/lvconvert-raid-takeover.sh
index c9b45e9..2fb0e5a 100644
--- a/test/shell/lvconvert-raid-takeover.sh
+++ b/test/shell/lvconvert-raid-takeover.sh
@@ -28,19 +28,17 @@ detect_error_leak_()
{
local err
- dmsetup info -c -o name --noheadings | tee out
- if grep $vg out ; then
- for i in $(grep $vg out) ; do
- if dmsetup table $i | grep "error "; then
- err="$err $i"
- fi
- done
- test -z "$err" || {
- dmsetup table | grep $vg
- dmsetup ls --tree
- die "Device(s) $err should not be here."
- }
- fi
+ 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
6 years, 10 months