• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
6cd `dirname $0`
7export LTPROOT=${PWD}
8echo $LTPROOT | grep testscripts > /dev/null 2>&1
9if [ $? -eq 0 ]; then
10 cd ..
11 export LTPROOT=${PWD}
12fi
13
14export TMPBASE="/tmp"
15
16
17usage()
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
29
30	defaults:
31	part1=$part1
32	part2=$part2
33	ltproot=$LTPROOT
34	tmpdir=$TMPBASE
35
36	example: ${0##*/} -a hdc1 -b hdc2
37
38
39	END
40exit
41}
42
43while getopts :a:b: arg
44do      case $arg in
45		a)	part1=$OPTARG;;
46                b)      part2=$OPTARG;;
47
48                \?)     echo "************** Help Info: ********************"
49                        usage;;
50        esac
51done
52
53if [ ! -n "$part1"  ]; then
54  echo "Missing 1st partition. You must pass 2 partitions for testing"
55  usage;
56  exit
57fi
58
59if [ ! -n "$part2" ]; then
60  echo "Missing 2nd partition. You must pass 2 partitions for testing"
61  usage;
62  exit
63fi
64
65echo "Starting Device Mapper Tests..."
66
67echo "0 10240 linear " $part1 "0" > ltp-dev-mapper-table1
68echo "0 100000 linear " $part1 "0" > ltp-dev-mapper-table2
69echo "0 100000 linear " $part2 "0" > ltp-dev-mapper-table3
70echo "0 200000 striped 2 16 " $part1 "0" $part2 "0" > ltp-dev-mapper-table4
71
72echo "Creating Devices..."
73
74dmsetup create dm-test-1 ltp-dev-mapper-table1
75dmsetup create dm-test-2 ltp-dev-mapper-table2
76dmsetup create dm-test-3 ltp-dev-mapper-table3
77dmsetup create dm-test-4 ltp-dev-mapper-table4
78
79echo "Device Info..."
80
81dmsetup info dm-test-1
82dmsetup info dm-test-2
83dmsetup info dm-test-3
84dmsetup info dm-test-4
85
86echo "Device Dependancies..."
87
88dmsetup deps dm-test-1
89dmsetup deps dm-test-2
90dmsetup deps dm-test-3
91dmsetup deps dm-test-4
92
93echo "Device Status..."
94
95dmsetup status dm-test-1
96dmsetup status dm-test-2
97dmsetup status dm-test-3
98dmsetup status dm-test-4
99
100echo "Device Tables..."
101
102dmsetup table dm-test-1
103dmsetup table dm-test-2
104dmsetup table dm-test-3
105dmsetup table dm-test-4
106
107echo "Device Mapper Version..."
108
109dmsetup version
110
111echo "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
118echo "Device Mapper Removing Devices..."
119
120dmsetup remove dm-test-1
121dmsetup remove dm-test-2
122dmsetup remove dm-test-3
123dmsetup remove dm-test-4
124
125echo "Device Mapper Re-Creating Devices..."
126
127dmsetup create dm-test-1 ltp-dev-mapper-table1
128dmsetup create dm-test-2 ltp-dev-mapper-table2
129dmsetup create dm-test-3 ltp-dev-mapper-table3
130dmsetup create dm-test-4 ltp-dev-mapper-table4
131
132echo "Re-Naming Devices..."
133
134dmsetup rename dm-test-1 dm-test-1-new
135dmsetup rename dm-test-2 dm-test-2-new
136dmsetup rename dm-test-3 dm-test-3-new
137dmsetup rename dm-test-4 dm-test-4-new
138
139echo "Suspend Devices..."
140
141dmsetup suspend dm-test-1-new
142dmsetup suspend dm-test-2-new
143dmsetup suspend dm-test-3-new
144dmsetup suspend dm-test-4-new
145
146echo "0 102400 linear " $part1 "0" > ltp-dev-mapper-table1
147echo "0 200000 linear " $part1 "0" > ltp-dev-mapper-table2
148echo "0 200000 linear " $part2 "0" > ltp-dev-mapper-table3
149echo "0 400000 striped 2 16 " $part1 "0" $part2 "0" > ltp-dev-mapper-table4
150
151echo "Re-loading Devices..."
152
153dmsetup reload dm-test-1-new ltp-dev-mapper-table1
154dmsetup reload dm-test-2-new ltp-dev-mapper-table2
155dmsetup reload dm-test-3-new ltp-dev-mapper-table3
156dmsetup reload dm-test-4-new ltp-dev-mapper-table4
157
158echo "Resuming Devices..."
159
160dmsetup resume dm-test-1-new
161dmsetup resume dm-test-2-new
162dmsetup resume dm-test-3-new
163dmsetup resume dm-test-4-new
164
165echo "Device Info..."
166
167dmsetup info dm-test-1-new
168dmsetup info dm-test-2-new
169dmsetup info dm-test-3-new
170dmsetup info dm-test-4-new
171
172echo "Device Dependancies..."
173
174dmsetup deps dm-test-1-new
175dmsetup deps dm-test-2-new
176dmsetup deps dm-test-3-new
177dmsetup deps dm-test-4-new
178
179echo "Device Status..."
180
181dmsetup status dm-test-1-new
182dmsetup status dm-test-2-new
183dmsetup status dm-test-3-new
184dmsetup status dm-test-4-new
185
186echo "Device Tables..."
187
188dmsetup table dm-test-1-new
189dmsetup table dm-test-2-new
190dmsetup table dm-test-3-new
191dmsetup table dm-test-4-new
192
193echo "Device Mapper Remove-all..."
194
195dmsetup remove_all
196
197echo "Device Mapper Checking Status - Shouldn't be anything to check"
198
199dmsetup status dm-test-1-new
200dmsetup status dm-test-2-new
201dmsetup status dm-test-3-new
202dmsetup status dm-test-4-new
203
204
205