mridge | 6aef544 | 2004-04-16 22:07:28 +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 |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 4 | # 03/14/03 mridge@us.ibm.com added instance and time command line options |
mridge | 6aef544 | 2004-04-16 22:07:28 +0000 | [diff] [blame] | 5 | |
| 6 | cd `dirname $0` |
| 7 | export LTPROOT=${PWD} |
| 8 | echo $LTPROOT | grep testscripts > /dev/null 2>&1 |
| 9 | if [ $? -eq 0 ]; then |
| 10 | cd .. |
| 11 | export LTPROOT=${PWD} |
| 12 | fi |
| 13 | |
| 14 | export TMPBASE="/tmp" |
| 15 | |
| 16 | |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 17 | usage() |
mridge | 6aef544 | 2004-04-16 22:07:28 +0000 | [diff] [blame] | 18 | { |
| 19 | cat <<-END >&2 |
| 20 | usage: ${0##*/} [ -a part1 ] [ -b part2 ] |
| 21 | |
| 22 | Note: In order to run this test, you must turn on "device mapper" |
| 23 | component in kernel (it is under device drivers item when you |
| 24 | run make menuconfig); and you must install userspace supporting |
| 25 | files (libdevmapper and dmsetup). They are in the device-mapper |
| 26 | package. You can download it from http://www.sistina.com. Follow |
| 27 | the README/INSTALL file within the package to install it. |
| 28 | |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 29 | |
mridge | 6aef544 | 2004-04-16 22:07:28 +0000 | [diff] [blame] | 30 | defaults: |
| 31 | part1=$part1 |
| 32 | part2=$part2 |
| 33 | ltproot=$LTPROOT |
| 34 | tmpdir=$TMPBASE |
| 35 | |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 36 | example: ${0##*/} -a hdc1 -b hdc2 |
mridge | 6aef544 | 2004-04-16 22:07:28 +0000 | [diff] [blame] | 37 | |
| 38 | |
| 39 | END |
| 40 | exit |
| 41 | } |
| 42 | |
| 43 | while getopts :a:b: arg |
| 44 | do case $arg in |
| 45 | a) part1=$OPTARG;; |
| 46 | b) part2=$OPTARG;; |
Chris Dearman | 37550cf | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 47 | |
mridge | 6aef544 | 2004-04-16 22:07:28 +0000 | [diff] [blame] | 48 | \?) echo "************** Help Info: ********************" |
| 49 | usage;; |
| 50 | esac |
| 51 | done |
| 52 | |
| 53 | if [ ! -n "$part1" ]; then |
| 54 | echo "Missing 1st partition. You must pass 2 partitions for testing" |
| 55 | usage; |
| 56 | exit |
| 57 | fi |
| 58 | |
| 59 | if [ ! -n "$part2" ]; then |
| 60 | echo "Missing 2nd partition. You must pass 2 partitions for testing" |
| 61 | usage; |
| 62 | exit |
| 63 | fi |
| 64 | |
| 65 | echo "Starting Device Mapper Tests..." |
| 66 | |
| 67 | echo "0 10240 linear " $part1 "0" > ltp-dev-mapper-table1 |
| 68 | echo "0 100000 linear " $part1 "0" > ltp-dev-mapper-table2 |
| 69 | echo "0 100000 linear " $part2 "0" > ltp-dev-mapper-table3 |
| 70 | echo "0 200000 striped 2 16 " $part1 "0" $part2 "0" > ltp-dev-mapper-table4 |
| 71 | |
| 72 | echo "Creating Devices..." |
| 73 | |
| 74 | dmsetup create dm-test-1 ltp-dev-mapper-table1 |
| 75 | dmsetup create dm-test-2 ltp-dev-mapper-table2 |
| 76 | dmsetup create dm-test-3 ltp-dev-mapper-table3 |
| 77 | dmsetup create dm-test-4 ltp-dev-mapper-table4 |
| 78 | |
| 79 | echo "Device Info..." |
| 80 | |
| 81 | dmsetup info dm-test-1 |
| 82 | dmsetup info dm-test-2 |
| 83 | dmsetup info dm-test-3 |
| 84 | dmsetup info dm-test-4 |
| 85 | |
| 86 | echo "Device Dependancies..." |
| 87 | |
| 88 | dmsetup deps dm-test-1 |
| 89 | dmsetup deps dm-test-2 |
| 90 | dmsetup deps dm-test-3 |
| 91 | dmsetup deps dm-test-4 |
| 92 | |
| 93 | echo "Device Status..." |
| 94 | |
| 95 | dmsetup status dm-test-1 |
| 96 | dmsetup status dm-test-2 |
| 97 | dmsetup status dm-test-3 |
| 98 | dmsetup status dm-test-4 |
| 99 | |
| 100 | echo "Device Tables..." |
| 101 | |
| 102 | dmsetup table dm-test-1 |
| 103 | dmsetup table dm-test-2 |
| 104 | dmsetup table dm-test-3 |
| 105 | dmsetup table dm-test-4 |
| 106 | |
| 107 | echo "Device Mapper Version..." |
| 108 | |
| 109 | dmsetup version |
| 110 | |
| 111 | echo "Device Waiting..." |
| 112 | |
| 113 | #dmsetup wait dm-test-1 |
| 114 | #dmsetup wait dm-test-2 |
| 115 | #dmsetup wait dm-test-3 |
| 116 | #dmsetup wait dm-test-4 |
| 117 | |
| 118 | echo "Device Mapper Removing Devices..." |
| 119 | |
| 120 | dmsetup remove dm-test-1 |
| 121 | dmsetup remove dm-test-2 |
| 122 | dmsetup remove dm-test-3 |
| 123 | dmsetup remove dm-test-4 |
| 124 | |
| 125 | echo "Device Mapper Re-Creating Devices..." |
| 126 | |
| 127 | dmsetup create dm-test-1 ltp-dev-mapper-table1 |
| 128 | dmsetup create dm-test-2 ltp-dev-mapper-table2 |
| 129 | dmsetup create dm-test-3 ltp-dev-mapper-table3 |
| 130 | dmsetup create dm-test-4 ltp-dev-mapper-table4 |
| 131 | |
| 132 | echo "Re-Naming Devices..." |
| 133 | |
| 134 | dmsetup rename dm-test-1 dm-test-1-new |
| 135 | dmsetup rename dm-test-2 dm-test-2-new |
| 136 | dmsetup rename dm-test-3 dm-test-3-new |
| 137 | dmsetup rename dm-test-4 dm-test-4-new |
| 138 | |
| 139 | echo "Suspend Devices..." |
| 140 | |
| 141 | dmsetup suspend dm-test-1-new |
| 142 | dmsetup suspend dm-test-2-new |
| 143 | dmsetup suspend dm-test-3-new |
| 144 | dmsetup suspend dm-test-4-new |
| 145 | |
| 146 | echo "0 102400 linear " $part1 "0" > ltp-dev-mapper-table1 |
| 147 | echo "0 200000 linear " $part1 "0" > ltp-dev-mapper-table2 |
| 148 | echo "0 200000 linear " $part2 "0" > ltp-dev-mapper-table3 |
| 149 | echo "0 400000 striped 2 16 " $part1 "0" $part2 "0" > ltp-dev-mapper-table4 |
| 150 | |
| 151 | echo "Re-loading Devices..." |
| 152 | |
| 153 | dmsetup reload dm-test-1-new ltp-dev-mapper-table1 |
| 154 | dmsetup reload dm-test-2-new ltp-dev-mapper-table2 |
| 155 | dmsetup reload dm-test-3-new ltp-dev-mapper-table3 |
| 156 | dmsetup reload dm-test-4-new ltp-dev-mapper-table4 |
| 157 | |
| 158 | echo "Resuming Devices..." |
| 159 | |
| 160 | dmsetup resume dm-test-1-new |
| 161 | dmsetup resume dm-test-2-new |
| 162 | dmsetup resume dm-test-3-new |
| 163 | dmsetup resume dm-test-4-new |
| 164 | |
| 165 | echo "Device Info..." |
| 166 | |
| 167 | dmsetup info dm-test-1-new |
| 168 | dmsetup info dm-test-2-new |
| 169 | dmsetup info dm-test-3-new |
| 170 | dmsetup info dm-test-4-new |
| 171 | |
| 172 | echo "Device Dependancies..." |
| 173 | |
| 174 | dmsetup deps dm-test-1-new |
| 175 | dmsetup deps dm-test-2-new |
| 176 | dmsetup deps dm-test-3-new |
| 177 | dmsetup deps dm-test-4-new |
| 178 | |
| 179 | echo "Device Status..." |
| 180 | |
| 181 | dmsetup status dm-test-1-new |
| 182 | dmsetup status dm-test-2-new |
| 183 | dmsetup status dm-test-3-new |
| 184 | dmsetup status dm-test-4-new |
| 185 | |
| 186 | echo "Device Tables..." |
| 187 | |
| 188 | dmsetup table dm-test-1-new |
| 189 | dmsetup table dm-test-2-new |
| 190 | dmsetup table dm-test-3-new |
| 191 | dmsetup table dm-test-4-new |
| 192 | |
| 193 | echo "Device Mapper Remove-all..." |
| 194 | |
| 195 | dmsetup remove_all |
| 196 | |
| 197 | echo "Device Mapper Checking Status - Shouldn't be anything to check" |
| 198 | |
| 199 | dmsetup status dm-test-1-new |
| 200 | dmsetup status dm-test-2-new |
| 201 | dmsetup status dm-test-3-new |
| 202 | dmsetup status dm-test-4-new |
| 203 | |
| 204 | |