Skip to contentSkip to conversation

LVM2/test t-vgreduce-usage.sh

PATCH [email protected] 1 participant 1 message Aug 28, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz at sourceware.org 2008-08-28 11:20:49

Modified files:
test : t-vgreduce-usage.sh

Log message:
fix vgreduce tests to detect partial command failure (Jaroslav Stava)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgreduce-usage.sh.diff?cvsroot=lvm2&r1=1.1&r2=1.2

test/t-vgreduce-usage.sh +23 -12
@@ -35,28 +35,39 @@
    lv2=$(this_test_)-test-lv2-$$          &&
    lv3=$(this_test_)-test-lv3-$$'
 
+#TODO --removemissing (+ -- mirrorsonly)
 
 for mdatype in 1 2
 do
 test_expect_success \
   "(lvm$mdatype) setup PVs" '
-  pvcreate -M$mdatype $d1 $d2 
+   pvcreate -M$mdatype $d1 $d2 
 '
 
 test_expect_success \
-  "(lvm$mdatype) vgreduce rejects removing the last pv (--all)" '
+  "(lvm$mdatype) vgreduce removes only the specified pv from vg (bz427382)" '
    vgcreate -M$mdatype $vg1 $d1 $d2 &&
-   vgreduce --all $vg1  2>err;
+   vgreduce $vg1 $d1 &&
+   check_pv_field_ $d2 vg_name $vg1 &&
    vgremove -f $vg1
 '
-   #status=$?; echo status=$status; test $status = 5 &&
+
+test_expect_success \
+  "(lvm$mdatype) vgreduce rejects removing the last pv (--all)" '
+   vgcreate -M$mdatype $vg1 $d1 $d2 &&
+   { vgreduce --all $vg1;
+     status=$?; echo status=$status; test $status != 0 &&
+     vgremove -f $vg1
+   }
+'
 
 test_expect_success \
   "(lvm$mdatype) vgreduce rejects removing the last pv" '
    vgcreate -M$mdatype $vg1 $d1 $d2 &&
-   vgreduce $vg1 $d1 $d2 2>err;
-   status=$?; echo status=$status; test $status = 5 &&
-   vgremove -f $vg1
+   { vgreduce $vg1 $d1 $d2;
+     status=$?; echo status=$status; test $status = 5 &&
+     vgremove -f $vg1
+   }
 '
 
 test_expect_success \
@@ -65,21 +76,21 @@
 '
 done
 
-## TODO --mirrorsonly ?
 for mdatype in 2
 do
 test_expect_success \
   "(lvm$mdatype) setup PVs (--metadatacopies 0)" '
-  pvcreate -M$mdatype $d1 $d2 
+  pvcreate -M$mdatype $d1 $d2 &&
   pvcreate --metadatacopies 0 -M$mdatype $d3 $d4
 '
 
 test_expect_success \
   "(lvm$mdatype) vgreduce rejects removing pv with the last mda copy" '
    vgcreate -M$mdatype $vg1 $d1 $d3 &&
-   vgreduce $vg1 $d1 2>err;
-   status=$?; echo status=$status; test $status != 0 &&
-   vgremove -f $vg1
+   { vgreduce $vg1 $d1;
+     status=$?; echo status=$status; test $status != 0 &&
+     vgremove -f $vg1
+   }
 '
 done