Skip to contentSkip to conversation

LVM2/test t-lvcreate-pvtags.sh t-lvmcache-exer ...

PATCH [email protected] 1 participant 1 message Sep 29, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall at sourceware.org 2008-09-29 16:02:50

Modified files:
test : t-lvcreate-pvtags.sh t-lvmcache-exercise.sh
t-lvresize-usage.sh t-mirror-lvconvert.sh t-mirror-vgreduce-removemissing.sh t-000-basic.sh t-pool-labels.sh t-metadata.sh t-covercmd.sh t-pvcreate-operation.sh t-vgrename-usage.sh

Log message:
Update a bunch of tests to use functionality from test-utils.sh.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-lvcreate-pvtags.sh.diff?cvsroot=lvm2&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-lvmcache-exercise.sh.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-lvresize-usage.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.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-mirror-vgreduce-removemissing.sh.diff?cvsroot=lvm2&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-000-basic.sh.diff?cvsroot=lvm2&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-pool-labels.sh.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-metadata.sh.diff?cvsroot=lvm2&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-covercmd.sh.diff?cvsroot=lvm2&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-pvcreate-operation.sh.diff?cvsroot=lvm2&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-vgrename-usage.sh.diff?cvsroot=lvm2&r1=1.2&r2=1.3

test/t-lvcreate-pvtags.sh +28 -77
@@ -1,5 +1,4 @@
-#!/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,81 +8,33 @@
 # 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="ensure that lvcreate's select-by-tag code works"
-privileges_required_=1
+. ./test-utils.sh
 
-. ./test-lib.sh
+aux prepare_pvs 3
 
-dmsetup_has_dm_devdir_support_ ||
-{
-  say "Your version of dmsetup lacks support for changing DM_DEVDIR."
-  say "Skipping this test"
-  exit 0
-}
-
-cleanup_()
-{
-  test -n "$vg" && {
-    lvremove -ff $vg
-    vgremove $vg
-  } > /dev/null
-  test -n "$pvs" && {
-    pvremove $pvs > /dev/null
-    for d in $pvs; do
-      dmsetup remove $(basename $d)
-    done
-  }
-  losetup -d $lodev
-  rm -f $lofile
-}
-
-nr_pvs=3
-pvsize=$((200 * 1024 * 2))
-
-test_expect_success \
-  'set up temp file and loopback device' \
-  'lofile=$(pwd)/lofile && lodev=$(loop_setup_ "$lofile")'
-
-offset=0
-pvs=
-for n in $(seq 1 $nr_pvs); do
-  test_expect_success \
-      "create pv$n" \
-      'echo "0 $pvsize linear $lodev $offset" > in &&
-       dmsetup create pv$n < in'
-  offset=$(($offset + $pvsize))
-done
-
-for n in $(seq 1 $nr_pvs); do
-  pvs="$pvs $G_dev_/mapper/pv$n"
-done
-
-test_expect_success \
-  "Run this: pvcreate $pvs" \
-  'pvcreate $pvs'
-
-vg=lvcreate-pvtags-vg-$$
-test_expect_success \
-  'set up a VG with tagged PVs' \
-  'vgcreate $vg $pvs &&
-   pvchange --addtag fast $pvs'
-
-test_expect_success '3 stripes with 3 PVs (selected by tag, @fast) is fine' \
-  'lvcreate -l3 -i3 $vg @fast'
-test_expect_failure 'too many stripes(4) for 3 PVs' \
-  'lvcreate -l4 -i4 $vg @fast'
-test_expect_failure '2 stripes is too many with just one PV' \
-  'lvcreate -l2 -i2 $vg $G_dev_/mapper/pv1'
-
-test_expect_success 'lvcreate mirror' \
-  'lvcreate -l1 -m1 $vg @fast'
-test_expect_success 'lvcreate mirror w/corelog' \
-  'lvcreate -l1 -m2 --corelog $vg @fast'
-test_expect_failure 'lvcreate mirror w/no free PVs' \
-  'lvcreate -l1 -m2 $vg @fast'
-test_expect_failure 'lvcreate mirror (corelog, w/no free PVs)' \
-  'lvcreate -l1 -m3 --corelog $vg @fast'
-test_expect_failure 'lvcreate mirror with a single PV arg' \
-  'lvcreate -l1 -m1 --corelog $vg $G_dev_/mapper/pv1'
+vgcreate $vg $devs
+pvchange --addtag fast $devs
 
-test_done
+# 3 stripes with 3 PVs (selected by tag, @fast) is fine
+lvcreate -l3 -i3 $vg @fast
+
+# too many stripes(4) for 3 PVs
+not lvcreate -l4 -i4 $vg @fast
+
+# 2 stripes is too many with just one PV
+not lvcreate -l2 -i2 $vg $G_dev_/mapper/pv1
+
+# lvcreate mirror
+lvcreate -l1 -m1 $vg @fast
+
+# lvcreate mirror w/corelog
+lvcreate -l1 -m2 --corelog $vg @fast
+
+# lvcreate mirror w/no free PVs
+not lvcreate -l1 -m2 $vg @fast
+
+# lvcreate mirror (corelog, w/no free PVs)
+not lvcreate -l1 -m3 --corelog $vg @fast
+
+# lvcreate mirror with a single PV arg
+not lvcreate -l1 -m1 --corelog $vg $dev1
test/t-lvmcache-exercise.sh +11 -49

69 lines not on this page · raw message

test/t-lvresize-usage.sh +7 -42

58 lines not on this page · raw message

test/t-mirror-lvconvert.sh +89 -191

412 lines not on this page · raw message

test/t-mirror-vgreduce-removemissing.sh +56 -147

324 lines not on this page · raw message

test/t-000-basic.sh +10 -25
@@ -1,4 +1,3 @@
-#!/bin/sh
 # Copyright (C) 2007 Red Hat, Inc. All rights reserved.
 #
 # This copyrighted material is made available to anyone wishing to use,
@@ -9,32 +8,18 @@
 # 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='Basics: see if tools are built, etc.'
+. ./test-utils.sh
 
-. ./test-lib.sh
-
-lvm version >/dev/null 2>&1
-if test $? != 0; then
-    echo >&2 'You do not seem to have built lvm yet.'
-    exit 1
-fi
+lvm version
 
 v=$abs_top_srcdir/tools/version.h
-test_expect_success \
-  "get version string from $v" \
-  'sed -n "/#define LVM_VERSION ./s///p" '"$v"'|sed "s/ .*//" > expected'
-
-test_expect_success \
-  'get version of a just-built binary, ensuring PATH is set properly' \
-  'lvm pvmove --version|sed -n "1s/.*: *\([0-9][^ ]*\) .*/\1/p" > actual'
-
-test_expect_success \
-  'ensure they are the same' \
-  'diff -u actual expected'
+sed -n "/#define LVM_VERSION ./s///p" "$v" | sed "s/ .*//" > expected
 
-# Need mdadm for some pvcreate tests
-test_expect_success \
-  'verify mdadm is installed and in path (needed for pvcreate tests)' \
-  'which mdadm'
+lvm pvmove --version|sed -n "1s/.*: *\([0-9][^ ]*\) .*/\1/p" > actual
 
-test_done
+# ensure they are the same
+diff -u actual expected
+
+# Need mdadm for some pvcreate tests
+# verify mdadm is installed and in path (needed for pvcreate tests) ... is it?
+which mdadm
test/t-pool-labels.sh +21 -33

66 lines not on this page · raw message

test/t-metadata.sh +24 -57

89 lines not on this page · raw message

test/t-covercmd.sh +51 -73

139 lines not on this page · raw message

test/t-pvcreate-operation.sh +64 -103

203 lines not on this page · raw message

test/t-vgrename-usage.sh +19 -47

73 lines not on this page · raw message