mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-17 06:04:23 +03:00
Re-indent test-utils.sh consistently, using tabs.
This commit is contained in:
parent
f6d7cec859
commit
4249331805
@ -12,8 +12,8 @@ test_description="foo" # silence test-lib for now
|
|||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
aux() {
|
aux() {
|
||||||
# use just "$@" for verbose operation
|
# use just "$@" for verbose operation
|
||||||
"$@" > /dev/null 2> /dev/null
|
"$@" > /dev/null 2> /dev/null
|
||||||
#"$@"
|
#"$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,37 +29,37 @@ STACKTRACE() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
echo $LOOP
|
echo $LOOP
|
||||||
echo $PREFIX
|
echo $PREFIX
|
||||||
|
|
||||||
test -n "$PREFIX" && {
|
test -n "$PREFIX" && {
|
||||||
rm -rf /dev/$PREFIX*
|
rm -rf /dev/$PREFIX*
|
||||||
while dmsetup table | grep -q ^$PREFIX; do
|
while dmsetup table | grep -q ^$PREFIX; do
|
||||||
for s in `dmsetup table | grep ^$PREFIX| cut -f1 -d:`; do
|
for s in `dmsetup table | grep ^$PREFIX| cut -f1 -d:`; do
|
||||||
dmsetup resume $s 2>/dev/null > /dev/null || true
|
dmsetup resume $s 2>/dev/null > /dev/null || true
|
||||||
dmsetup remove $s 2>/dev/null > /dev/null || true
|
dmsetup remove $s 2>/dev/null > /dev/null || true
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
test -n "$LOOP" && losetup -d $LOOP
|
test -n "$LOOP" && losetup -d $LOOP
|
||||||
test -n "$LOOPFILE" && rm -f $LOOPFILE
|
test -n "$LOOPFILE" && rm -f $LOOPFILE
|
||||||
|
|
||||||
cleanup_ # user-overridable cleanup
|
cleanup_ # user-overridable cleanup
|
||||||
testlib_cleanup_ # call test-lib cleanup routine, too
|
testlib_cleanup_ # call test-lib cleanup routine, too
|
||||||
}
|
}
|
||||||
|
|
||||||
make_ioerror() {
|
make_ioerror() {
|
||||||
echo 0 10000000 error | dmsetup create ioerror
|
echo 0 10000000 error | dmsetup create ioerror
|
||||||
dmsetup resume ioerror
|
dmsetup resume ioerror
|
||||||
ln -s /dev/mapper/ioerror /dev/ioerror
|
ln -s /dev/mapper/ioerror /dev/ioerror
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_loop() {
|
prepare_loop() {
|
||||||
size=$1
|
size=$1
|
||||||
test -n "$size" || size=32
|
test -n "$size" || size=32
|
||||||
|
|
||||||
test -n "$LOOP" && return 0
|
test -n "$LOOP" && return 0
|
||||||
trap 'aux teardown' EXIT # don't forget to clean up
|
trap 'aux teardown' EXIT # don't forget to clean up
|
||||||
trap 'set +vex; STACKTRACE; set -vex' ERR
|
trap 'set +vex; STACKTRACE; set -vex' ERR
|
||||||
#trap - ERR
|
#trap - ERR
|
||||||
@ -89,68 +89,68 @@ prepare_loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prepare_devs() {
|
prepare_devs() {
|
||||||
local n="$1"
|
local n="$1"
|
||||||
test -z "$n" && n=3
|
test -z "$n" && n=3
|
||||||
local devsize="$2"
|
local devsize="$2"
|
||||||
test -z "$devsize" && devsize=33
|
test -z "$devsize" && devsize=33
|
||||||
|
|
||||||
prepare_loop $(($n*$devsize))
|
prepare_loop $(($n*$devsize))
|
||||||
|
|
||||||
PREFIX="LVMTEST$$"
|
PREFIX="LVMTEST$$"
|
||||||
|
|
||||||
local loopsz=`blockdev --getsz $LOOP`
|
local loopsz=`blockdev --getsz $LOOP`
|
||||||
local size=$(($loopsz/$n))
|
local size=$(($loopsz/$n))
|
||||||
|
|
||||||
for i in `seq 1 $n`; do
|
for i in `seq 1 $n`; do
|
||||||
local name="${PREFIX}pv$i"
|
local name="${PREFIX}pv$i"
|
||||||
local dev="$G_dev_/mapper/$name"
|
local dev="$G_dev_/mapper/$name"
|
||||||
eval "dev$i=$dev"
|
eval "dev$i=$dev"
|
||||||
devs="$devs $dev"
|
devs="$devs $dev"
|
||||||
echo 0 $size linear $LOOP $((($i-1)*$size)) > $name.table
|
echo 0 $size linear $LOOP $((($i-1)*$size)) > $name.table
|
||||||
dmsetup create $name $name.table
|
dmsetup create $name $name.table
|
||||||
dmsetup resume $name
|
dmsetup resume $name
|
||||||
done
|
done
|
||||||
|
|
||||||
# set up some default names
|
# set up some default names
|
||||||
vg=${PREFIX}vg
|
vg=${PREFIX}vg
|
||||||
vg1=${PREFIX}vg1
|
vg1=${PREFIX}vg1
|
||||||
vg2=${PREFIX}vg2
|
vg2=${PREFIX}vg2
|
||||||
lv=LV
|
lv=LV
|
||||||
lv1=LV1
|
lv1=LV1
|
||||||
lv2=LV2
|
lv2=LV2
|
||||||
lv3=LV3
|
lv3=LV3
|
||||||
}
|
}
|
||||||
|
|
||||||
disable_dev() {
|
disable_dev() {
|
||||||
for dev in "$@"; do
|
for dev in "$@"; do
|
||||||
# first we make the device inaccessible
|
# first we make the device inaccessible
|
||||||
echo 0 10000000 error | dmsetup load $dev
|
echo 0 10000000 error | dmsetup load $dev
|
||||||
dmsetup resume $dev
|
dmsetup resume $dev
|
||||||
# now let's try to get rid of it if it's unused
|
# now let's try to get rid of it if it's unused
|
||||||
#dmsetup remove $dev
|
#dmsetup remove $dev
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
enable_dev() {
|
enable_dev() {
|
||||||
for dev in "$@"; do
|
for dev in "$@"; do
|
||||||
local name=`echo "$dev" | sed -e 's,.*/,,'`
|
local name=`echo "$dev" | sed -e 's,.*/,,'`
|
||||||
dmsetup create $name $name.table || dmsetup load $name $name.table
|
dmsetup create $name $name.table || dmsetup load $name $name.table
|
||||||
dmsetup resume $dev
|
dmsetup resume $dev
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_pvs() {
|
prepare_pvs() {
|
||||||
prepare_devs "$@"
|
prepare_devs "$@"
|
||||||
pvcreate $devs
|
pvcreate $devs
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_vg() {
|
prepare_vg() {
|
||||||
prepare_pvs "$@"
|
prepare_pvs "$@"
|
||||||
vgcreate $vg $devs
|
vgcreate $vg $devs
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_lvmconf() {
|
prepare_lvmconf() {
|
||||||
cat > $G_root_/etc/lvm.conf <<-EOF
|
cat > $G_root_/etc/lvm.conf <<-EOF
|
||||||
devices {
|
devices {
|
||||||
dir = "$G_dev_"
|
dir = "$G_dev_"
|
||||||
scan = "$G_dev_"
|
scan = "$G_dev_"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user