Call signals by names in cpuctl test
[ltp-debian.git] / testscripts / ltpfslvm.sh
blob16998766e3b54297a5a8e8eb5187c30eaaff1449
1 #!/bin/sh
2 # This script should be run prior to running executing the filesystem tests.
3 # valid devices need to be passed for Device Mapper to work correctly
4 # 03/14/03 mridge@us.ibm.com added instance and time command line options
5 # 05/16/03 changed script paths
6 # 05/20/03 Added instructions on setup and warnings
7 # 05/03/2004 hien1@us.ibm.com Added resize2fs and resize_reiserfs after extend and reduce LVs
8 # 05/03/2004 Moved the mount after resizing
9 # 05/03/2004 Modified /dev/ram to /dev/ram0
11 cd `dirname $0`
12 export LTPROOT=${PWD}
13 echo $LTPROOT | grep testscripts > /dev/null 2>&1
14 if [ $? -eq 0 ]; then
15 cd ..
16 export LTPROOT=${PWD}
19 export TMPBASE="/tmp"
22 usage()
24 cat <<-END >&2
25 usage: ${0##*/} [ -a part1 ] [ -b part2 ] [ -c part3 ]
26 [ -d part4 ] [ -n nfsmount ]
27 defaults:
28 part1=$part1
29 part2=$part2
30 part3=$part3
31 part4=$part4
32 nfsmount=$nfsmount
33 ltproot=$TPROOT
34 tmpdir=$TMPBASE
36 example: ${0##*/} -a hdc1 -b hdc2 -c hdc3 -d hdc4 -n mytesthost:/testmountdir
38 fdisk needs to be run and the 4 HD partitions marked as 0x8e -- Linux LVM
40 - If this is run on a 2.4 kernel system then LVM must be configured and the kernel rebuilt. In a 2.5 environment
41 you must configure Device Mapper and install LVM2 from www.systina.com for the testcase to run correctly.
43 - These operations are destructive so do NOT point the tests to partitions where the data shouldn't be overwritten.
44 Once these tests are started all data in the partitions you point to will be destroyed.
46 END
47 exit
50 while getopts :a:b:c:d:e:n:v: arg
51 do case $arg in
52 a) part1=$OPTARG;;
53 b) part2=$OPTARG;;
54 c) part3=$OPTARG;;
55 d) part4=$OPTARG;;
56 n) nfsmount=$OPTARG;;
57 v) verb=$OPTARG;;
59 \?) echo "************** Help Info: ********************"
60 usage;;
61 esac
62 done
64 if [ ! -n "$part1" ]; then
65 echo "Missing 1st partition. You must pass 4 partitions for testing"
66 usage;
67 exit
70 if [ ! -n "$part2" ]; then
71 echo "Missing 2nd partition. You must pass 4 partitions for testing"
72 usage;
73 exit
76 if [ ! -n "$part3" ]; then
77 echo "Missing 3rd partition. You must pass 4 partitions for testing"
78 usage;
79 exit
82 if [ ! -n "$part4" ]; then
83 echo "Missing 4th partition. You must pass 4 partitions for testing"
84 usage;
85 exit
88 if [ ! -n "$nfsmount" ]; then
89 echo "Missing NFS partition. You must pass an NFS mount point for testing"
90 usage;
91 exit
94 export PATH="${PATH}:${LTPROOT}/testcases/bin"
97 mkdir /test >/dev/null 2>&1
98 mkdir /test/growfiles >/dev/null 2>&1
99 mkdir /test/growfiles/ext2 >/dev/null 2>&1
100 mkdir /test/growfiles/msdos >/dev/null 2>&1
101 mkdir /test/growfiles/reiser >/dev/null 2>&1
102 mkdir /test/growfiles/minix >/dev/null 2>&1
103 mkdir /test/growfiles/nfs >/dev/null 2>&1
104 mkdir /test/growfiles/jfs >/dev/null 2>&1
105 mkdir /test/growfiles/ramdisk >/dev/null 2>&1
107 vgscan
108 vgchange -a y
110 pvcreate -v /dev/$part1 /dev/$part2 /dev/$part3 /dev/$part4
111 vgcreate -v ltp_test_vg1 /dev/$part1 /dev/$part2
112 vgcreate -v ltp_test_vg2 /dev/$part3 /dev/$part4
113 vgcfgbackup -v
114 lvcreate -v -L 100 ltp_test_vg1 -n ltp_test_lv1
115 lvcreate -v -L 100 ltp_test_vg1 -n ltp_test_lv2 -i 2
116 lvcreate -v -L 100 ltp_test_vg2 -n ltp_test_lv3
117 lvcreate -v -L 100 ltp_test_vg2 -n ltp_test_lv4
119 mkfs -V -t ext2 /dev/ltp_test_vg1/ltp_test_lv1
120 mkfs -V -t msdos /dev/ltp_test_vg1/ltp_test_lv2
121 mkreiserfs /dev/ltp_test_vg2/ltp_test_lv3 <yesenter.txt
122 mkfs -V -t minix /dev/ltp_test_vg2/ltp_test_lv4
124 ### there is no /dev/ram - has /dev/ram0 ... /dev/ram15
125 mkfs -V -t ext3 /dev/ram0
128 lvmdiskscan -v
129 lvscan -v
130 vgdisplay -v
131 lvextend -v -l +5000 /dev/ltp_test_vg1/ltp_test_lv1
132 lvreduce -v -f -l -20 /dev/ltp_test_vg1/ltp_test_lv1
134 ### Need to be resize to get LV to the correct size
135 resize2fs -f /dev/ltp_test_vg1/ltp_test_lv1
136 lvextend -v -l +5000 /dev/ltp_test_vg1/ltp_test_lv2
137 lvreduce -v -f -l -20 /dev/ltp_test_vg1/ltp_test_lv2
139 ### Need to be resize to get LV to the correct size
140 resize_reiserfs -f /dev/ltp_test_vg1/ltp_test_lv2
141 lvextend -v -l +20 /dev/ltp_test_vg2/ltp_test_lv3
142 lvreduce -v -f -l -20 /dev/ltp_test_vg2/ltp_test_lv3
143 lvextend -v -l +20 /dev/ltp_test_vg2/ltp_test_lv4
144 lvreduce -v -f -l -20 /dev/ltp_test_vg2/ltp_test_lv4
146 vgreduce -v /dev/ltp_test_vg1 /dev/$part2
147 vgextend -v /dev/ltp_test_vg1 /dev/$part2
148 vgck -v
150 ### Move mount filesystems to the last since resize can't work on a mounted filesystem.
151 mount -v -t nfs $nfsmount /test/growfiles/nfs
152 mount -v /dev/ltp_test_vg1/ltp_test_lv1 /test/growfiles/ext2
153 mount -v /dev/ltp_test_vg1/ltp_test_lv2 /test/growfiles/msdos
154 mount -v /dev/ltp_test_vg2/ltp_test_lv3 /test/growfiles/reiser
155 mount -v /dev/ltp_test_vg2/ltp_test_lv4 /test/growfiles/minix
156 mount -v /dev/ram /test/growfiles/ramdisk
158 echo "************ Running tests "
159 ${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/lvm.part1 > ${TMPBASE}/lvm.part1
161 ${LTPROOT}/pan/ltp-pan -e -S -a lvmpart1 -n lvmpart1 -l lvmlogfile -f ${TMPBASE}/lvm.part1 &
163 wait $!
167 umount -v -t nfs $nfsmount
168 umount -v /dev/ltp_test_vg1/ltp_test_lv1
169 umount -v /dev/ltp_test_vg1/ltp_test_lv2
170 umount -v /dev/ltp_test_vg2/ltp_test_lv3
171 umount -v /dev/ltp_test_vg2/ltp_test_lv4
172 umount -v /dev/ram
174 lvremove -f -v /dev/ltp_test_vg1/ltp_test_lv1
175 lvremove -f -v /dev/ltp_test_vg1/ltp_test_lv2
176 lvremove -f -v /dev/ltp_test_vg2/ltp_test_lv3
177 lvremove -f -v /dev/ltp_test_vg2/ltp_test_lv4
179 lvscan -v
180 vgchange -a n
181 vgremove -v /dev/ltp_test_vg1
182 vgremove -v /dev/ltp_test_vg2
184 mkfs -V -t ext3 /dev/$part4
185 mkfs -V -t jfs /dev/$part1 <yesenter.txt
187 mount -v -t ext3 /dev/$part4 /test/growfiles/ext3
188 mount -v -t jfs /dev/hdc1 /test/growfiles/jfs
190 echo "************ Running EXT3 & JFS tests... "
191 ${LTPROOT}/tools/rand_lines -g ${LTPROOT}/runtest/lvm.part2 > ${TMPBASE}/lvm.part2
193 ${LTPROOT}/pan/ltp-pan -e -S -a lvmpart2 -n lvmpart2 -l lvmlogfile -f ${TMPBASE}/lvm.part2 &
195 wait $!
197 umount -v /dev/$part1
198 umount -v /dev/$part4