LVM2/test t-lvcreate-usage.sh t-lvextend-perce ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall at sourceware.org 2008-09-30 17:47:34
Modified files:
test : t-lvcreate-usage.sh
t-lvextend-percent-extents.sh t-mdata-strings.sh t-mirror-lvconvert.sh t-pvcreate-operation.sh
Log message:
More test conversions, all of these are by jstava.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-lvcreate-usage.sh.diff?cvsroot=lvm2&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-lvextend-percent-extents.sh.diff?cvsroot=lvm2&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-mdata-strings.sh.diff?cvsroot=lvm2&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-mirror-lvconvert.sh.diff?cvsroot=lvm2&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-pvcreate-operation.sh.diff?cvsroot=lvm2&r1=1.10&r2=1.11
test/t-lvcreate-usage.sh +40 -76
@@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (C) 2007 Red Hat, Inc. All rights reserved. +# Copyright (C) 2008 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
@@ -9,82 +9,46 @@ # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -test_description='Exercise some lvcreate diagnostics' -privileges_required_=1 +# 'Exercise some lvcreate diagnostics' -. ./test-lib.sh +. ./test-utils.sh -cleanup_() -{ - test -n "$vg" && { - vgchange -an "$vg" - lvremove -ff "$vg" - vgremove "$vg" - } > "$test_dir_/cleanup.log" - test -n "$d1" && losetup -d "$d1" - test -n "$d2" && losetup -d "$d2" - rm -f "$f1" "$f2" -} - -test_expect_success \ - 'set up temp files, loopback devices, PVs, and a VG' \ - 'f1=$(pwd)/1 && d1=$(loop_setup_ "$f1") && - f2=$(pwd)/2 && d2=$(loop_setup_ "$f2") && - pvcreate $d1 $d2 && - vg=$(this_test_)-test-vg-$$ && - vgcreate $vg $d1 $d2' - -lv=lvcreate-usage-$$ - -test_expect_success \ - "lvcreate rejects repeated invocation (run 2 times)" ' - lvcreate -n $lv -l 4 $vg && - { lvcreate -n $lv -l 4 $vg; - status=$?; echo status=$status; test $status = 5 && - lvremove -ff $vg/$lv - } -' - -test_expect_success \ - 'lvcreate rejects a negative stripe_size' \ - 'lvcreate -L 64M -n $lv -i2 --stripesize -4 $vg 2>err; - status=$?; echo status=$status; test $status = 3 && - grep "^ Negative stripesize is invalid\$" err' - -test_expect_success \ - 'lvcreate rejects a too-large stripesize' \ - 'lvcreate -L 64M -n $lv -i2 --stripesize 4294967291 $vg 2>err; test $? = 3 && - grep "^ Stripe size cannot be larger than 512.00 GB\$" err' - -test_expect_success \ - 'lvcreate w/single stripe succeeds with diagnostics to stdout' \ - 'lvcreate -L 64M -n $lv -i1 --stripesize 4 $vg >out 2>err && - grep "^ Redundant stripes argument: default is 1\$" out && - grep "^ Ignoring stripesize argument with single stripe\$" out && - lvdisplay $vg && - lvremove -ff $vg' - -test_expect_success \ - 'lvcreate w/default (64KB) stripe size succeeds with diagnostics to stdout' \ - 'lvcreate -L 64M -n $lv -i2 $vg > out && - grep "^ Using default stripesize" out && - lvdisplay $vg && - check_lv_field_ $vg/$lv stripesize "64.00K" && - lvremove -ff $vg' - -test_expect_success \ - 'lvcreate rejects an invalid number of stripes' \ - 'lvcreate -L 64M -n $lv -i129 $vg 2>err; test $? = 3 && - grep "^ Number of stripes (129) must be between 1 and 128\$" err' +aux prepare_vg 2 + +# "lvcreate rejects repeated invocation (run 2 times)" +lvcreate -n $lv -l 4 $vg +not lvcreate -n $lv -l 4 $vg +lvremove -ff $vg/$lv + +# "lvcreate rejects a negative stripe_size" +not lvcreate -L 64M -n $lv -i2 --stripesize -4 $vg 2>err; +grep "^ Negative stripesize is invalid\$" err + +# 'lvcreate rejects a too-large stripesize' +not lvcreate -L 64M -n $lv -i2 --stripesize 4294967291 $vg 2>err +grep "^ Stripe size cannot be larger than 512.00 GB\$" err + +# 'lvcreate w/single stripe succeeds with diagnostics to stdout' +lvcreate -L 64M -n $lv -i1 --stripesize 4 $vg >out 2>err +grep "^ Redundant stripes argument: default is 1\$" out +grep "^ Ignoring stripesize argument with single stripe\$" out +lvdisplay $vg +lvremove -ff $vg + +# 'lvcreate w/default (64KB) stripe size succeeds with diagnostics to stdout' +lvcreate -L 64M -n $lv -i2 $vg > out +grep "^ Using default stripesize" out +lvdisplay $vg +check_lv_field_ $vg/$lv stripesize "64.00K" +lvremove -ff $vg + +# 'lvcreate rejects an invalid number of stripes' +not lvcreate -L 64M -n $lv -i129 $vg 2>err +grep "^ Number of stripes (129) must be between 1 and 128\$" err # The case on lvdisplay output is to verify that the LV was not created. -test_expect_success \ - 'lvcreate rejects an invalid stripe size' \ - 'lvcreate -L 64M -n $lv -i2 --stripesize 3 $vg 2>err; test $? = 3 && - grep "^ Invalid stripe size 3\.00 KB\$" err && - case $(lvdisplay $vg) in "") true ;; *) false ;; esac' - -test_done -# Local Variables: -# indent-tabs-mode: nil -# End: +# 'lvcreate rejects an invalid stripe size' +not lvcreate -L 64M -n $lv -i2 --stripesize 3 $vg 2>err +grep "^ Invalid stripe size 3\.00 KB\$" err +case $(lvdisplay $vg) in "") true ;; *) false ;; esac' +
test/t-lvextend-percent-extents.sh +41 -72
128 lines not on this page · raw message
test/t-mdata-strings.sh +17 -35
60 lines not on this page · raw message
test/t-mirror-lvconvert.sh +100 -101
222 lines not on this page · raw message
test/t-pvcreate-operation.sh +10 -11
@@ -60,18 +60,17 @@ pvremove -f $dev2 pvremove -f $dev1 -test_expect_success \ - 'pvcreate (lvm2) succeeds with -ff when PV with metadatacopies=0 belongs to VG' \ - 'pvcreate --metadatacopies 0 $dev1 && - pvcreate --metadatacopies 1 $dev2 && - vgcreate $vg1 $dev1 $dev2 && - pvcreate -ff -y $dev1 && - vgreduce --removemissing $vg1 && - vgremove -ff $vg1 && - pvremove -f $dev2 && - pvremove -f $dev1' +# pvcreate (lvm2) succeeds with -ff when PV with metadatacopies=0 belongs to VG +pvcreate --metadatacopies 0 $dev1 +pvcreate --metadatacopies 1 $dev2 +vgcreate $vg1 $dev1 $dev2 +pvcreate -ff -y $dev1 +vgreduce --removemissing $vg1 +vgremove -ff $vg1 +pvremove -f $dev2 +pvremove -f $dev1 -for i in 0 1 2 3 +for i in 0 1 2 3 do # pvcreate (lvm2) succeeds writing LVM label at sector $i pvcreate --labelsector $i $dev1