mridge | a64d322 | 2004-02-06 16:00:20 +0000 | [diff] [blame] | 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 | |
| 8 | cd `dirname $0` |
| 9 | export LTPROOT=${PWD} |
| 10 | echo $LTPROOT | grep testscripts > /dev/null 2>&1 |
| 11 | if [ $? -eq 0 ]; then |
| 12 | cd .. |
| 13 | export LTPROOT=${PWD} |
| 14 | fi |
| 15 | |
| 16 | export TMPBASE="/tmp" |
| 17 | |
| 18 | |
| 19 | usage() |
| 20 | { |
| 21 | cat <<-END >&2 |
| 22 | usage: ${0##*/} [ -a part1 ] [ -b part2 ] [ -c part3 ] |
| 23 | [ -d part4 ] [ -n nfsmount ] |
| 24 | defaults: |
| 25 | part1=$part1 |
| 26 | part2=$part2 |
| 27 | part3=$part3 |
| 28 | part4=$part4 |
| 29 | nfsmount=$nfsmount |
| 30 | ltproot=$TPROOT |
| 31 | tmpdir=$TMPBASE |
| 32 | |
| 33 | example: ${0##*/} -a hdc1 -b hdc2 -c hdc3 -d hdc4 -n mytesthost:/testmountdir |
| 34 | |
| 35 | fdisk needs to be run and the 4 HD partitions marked as 0x8e -- Linux LVM |
| 36 | |
| 37 | - If this is run on a 2.4 kernel system then LVM must be configured and the kernel rebuilt. In a 2.5 environment |
| 38 | you must configure Device Mapper and install LVM2 from www.systina.com for the testcase to run correctly. |
| 39 | |
| 40 | - These operations are destructive so do NOT point the tests to partitions where the data shouldn't be overwritten. |
| 41 | Once these tests are started all data in the partitions you point to will be destroyed. |
| 42 | |
| 43 | END |
| 44 | exit |
| 45 | } |
| 46 | |
| 47 | while getopts :a:b:c:d:e:n:v: arg |
| 48 | do case $arg in |
| 49 | a) part1=$OPTARG;; |
| 50 | b) part2=$OPTARG;; |
| 51 | c) part3=$OPTARG;; |
| 52 | d) part4=$OPTARG;; |
| 53 | n) nfsmount=$OPTARG;; |
| 54 | v) verb=$OPTARG;; |
| 55 | |
| 56 | \?) echo "************** Help Info: ********************" |
| 57 | usage;; |
| 58 | esac |
| 59 | done |
| 60 | |
| 61 | if [ ! -n "$part1" ]; then |
| 62 | echo "Missing 1st partition. You must pass 4 partitions for testing" |
| 63 | usage; |
| 64 | exit |
| 65 | fi |
| 66 | |
| 67 | if [ ! -n "$part2" ]; then |
| 68 | echo "Missing 2nd partition. You must pass 4 partitions for testing" |
| 69 | usage; |
| 70 | exit |
| 71 | fi |
| 72 | |
| 73 | if [ ! -n "$part3" ]; then |
| 74 | echo "Missing 3rd partition. You must pass 4 partitions for testing" |
| 75 | usage; |
| 76 | exit |
| 77 | fi |
| 78 | |
| 79 | if [ ! -n "$part4" ]; then |
| 80 | echo "Missing 4th partition. You must pass 4 partitions for testing" |
| 81 | usage; |
| 82 | exit |
| 83 | fi |
| 84 | |
| 85 | if [ ! -n "$nfsmount" ]; then |
| 86 | echo "Missing NFS partition. You must pass an NFS mount point for testing" |
| 87 | usage; |
| 88 | exit |
| 89 | fi |
| 90 | |
| 91 | export PATH="${PATH}:${LTPROOT}/testcases/bin" |
| 92 | |
| 93 | |
| 94 | mkdir /test >/dev/null 2>&1 |
| 95 | mkdir /test/growfiles >/dev/null 2>&1 |
| 96 | mkdir /test/growfiles/ext2 >/dev/null 2>&1 |
| 97 | mkdir /test/growfiles/ext3 >/dev/null 2>&1 |
| 98 | mkdir /test/growfiles/msdos >/dev/null 2>&1 |
| 99 | mkdir /test/growfiles/reiser >/dev/null 2>&1 |
| 100 | mkdir /test/growfiles/minix >/dev/null 2>&1 |
| 101 | mkdir /test/growfiles/nfs >/dev/null 2>&1 |
| 102 | mkdir /test/growfiles/jfs >/dev/null 2>&1 |
| 103 | mkdir /test/growfiles/ramdisk >/dev/null 2>&1 |
| 104 | |
| 105 | mkfs -V -t ext2 /dev/$part1 |
| 106 | mkfs -V -t msdos /dev/$part2 |
| 107 | mkreiserfs /dev/$part3 |
| 108 | mkfs -V -t minix /dev/$part4 |
| 109 | |
| 110 | |
| 111 | mount -v -t nfs $nfsmount /test/growfiles/nfs |
| 112 | mount -v /dev/$part1 /test/growfiles/ext2 |
| 113 | mount -v /dev/$part2 /test/growfiles/msdos |
| 114 | mount -v /dev/$part3 /test/growfiles/reiser |
| 115 | mount -v /dev/$part4 /test/growfiles/minix |
| 116 | mount -v /dev/ram /test/growfiles/ramdisk |
| 117 | |
| 118 | echo "************ Running tests " |
| 119 | ${LTPROOT}/../tools/rand_lines -g ${LTPROOT}/../runtest/lvm.part1 > ${TMPBASE}/lvm.part1 |
| 120 | |
| 121 | ${LTPROOT}/../pan/pan -e -S -a lvmpart1 -n lvmpart1 -l lvmlogfile -f ${TMPBASE}/lvm.part1 & |
| 122 | |
| 123 | wait $! |
| 124 | |
| 125 | |
| 126 | |
| 127 | umount -v -t nfs $nfsmount |
| 128 | umount -v /dev/$part1 |
| 129 | umount -v /dev/$part2 |
| 130 | umount -v /dev/$part3 |
| 131 | umount -v /dev/$part4 |
| 132 | umount -v /dev/ram |
| 133 | |
| 134 | mkfs -V -t ext3 /dev/$part4 |
| 135 | mkfs -V -t jfs /dev/$part1 <yesenter.txt |
| 136 | |
| 137 | mount -v -t ext3 /dev/$part4 /test/growfiles/ext3 |
| 138 | mount -v -t jfs /dev/$part1 /test/growfiles/jfs |
| 139 | |
| 140 | echo "************ Running EXT3 & JFS tests... " |
| 141 | ${LTPROOT}/../tools/rand_lines -g ${LTPROOT}/../runtest/lvm.part2 > ${TMPBASE}/lvm.part2 |
| 142 | |
| 143 | ${LTPROOT}/../pan/pan -e -S -a lvmpart2 -n lvmpart2 -l lvmlogfile -f ${TMPBASE}/lvm.part2 & |
| 144 | |
| 145 | wait $! |
| 146 | |
| 147 | umount -v /dev/$part1 |
| 148 | umount -v /dev/$part4 |
| 149 | |
| 150 | |