Merge of xfs-cmds-2.4.18:slinx:112579a by nathans.
[xfstests-dev.git] / common.config
1 ##/bin/sh
2
3 #
4 # Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
5
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of version 2 of the GNU General Public License as
8 # published by the Free Software Foundation.
9
10 # This program is distributed in the hope that it would be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
14 # Further, this software is distributed without any warranty that it is
15 # free of the rightful claim of any third person regarding infringement
16 # or the like.  Any license provided herein, whether implied or
17 # otherwise, applies only to this software file.  Patent licenses, if
18 # any, provided herein do not apply to combinations of this program with
19 # other software, or any other product whatsoever.
20
21 # You should have received a copy of the GNU General Public License along
22 # with this program; if not, write the Free Software Foundation, Inc., 59
23 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
24
25 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
26 # Mountain View, CA  94043, or:
27
28 # http://www.sgi.com 
29
30 # For further information regarding this notice, see: 
31
32 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
33 #
34
35 #
36 # setup and check for config parameters, and in particular
37 #
38 # TEST_DIR              - scratch test directory that is in an already
39 #                         mounted XFS file system, needs to be be world
40 #                         writeable
41 # TEST_DEV              - device for file system containing TEST_DIR
42 # SCRATCH_DEV           - device you can make a scratch file system on
43 # SCRATCH_MNT           - mount point for scratch file system
44
45 # and optionally:
46 # SCRATCH_LOGDEV        - scratch log device for external log testing
47 # SCRATCH_RTDEV         - scratch rt dev (only for testing cmds currently)
48 # TAPE_DEV              - the tape device for the xfsdump tests
49 # RMT_TAPE_DEV          - the remote tape device for the xfsdump tests
50 # RMT_IRIXTAPE_DEV      - the IRIX remote tape device for the xfsdump tests
51 # RMT_TAPE_USER         - remote user for tape device
52 #
53
54 #
55 # - This script is shared by the stress test system and the auto-qa
56 #   system
57 # - TEST_DEV & TEST_DIR must be assigned.
58 # - this script shouldn't make any assertions about filesystem
59 #   validity or mountedness.
60 #
61
62 _readlink()
63 {
64     if [ $# -ne 1 ]
65     then
66         echo "Usage: _readlink filename" 1>&2
67         exit 1
68     fi
69
70     perl -e "\$in=\"$1\";" -e '
71         $lnk = readlink($in);
72         if ($lnk =~ m!^/.*!) {
73           print "$lnk\n";
74         }
75         else {
76           chomp($dir = `dirname $in`);
77           print "$dir/$lnk\n";
78         }'
79 }
80
81
82 case `hostname -s`
83 in
84     fuzzy)
85         TEST_DEV=/dev/sda6
86         TEST_DIR=/mnt/xfs1
87         SCRATCH_DEV=/dev/sda5
88         SCRATCH_MNT=/mnt/xfs0
89         SCRATCH_LOGDEV=/dev/sda7
90         TAPE_DEV=/dev/st0
91         RMT_TAPE_DEV=fuzzy:/dev/st0
92         RMT_IRIXTAPE_DEV=snort:/dev/tape
93         RMT_TAPE_USER=guest
94         ;;
95     bruce)
96         TEST_DEV=/dev/sda10
97         TEST_DIR=/mnt/xfs1
98         SCRATCH_DEV=/dev/sda9
99         SCRATCH_MNT=/mnt/xfs0
100         SCRATCH_LOGDEV=/dev/sda11
101         TAPE_DEV=/dev/st0
102         RMT_TAPE_DEV=bruce:/dev/st0
103         RMT_IRIXTAPE_DEV=snort:/dev/tape
104         ;;
105     sherman)
106         TEST_DEV=/dev/sda10
107         TEST_DIR=/mnt/xfs1
108         SCRATCH_DEV=/dev/sda9
109         SCRATCH_MNT=/mnt/xfs0
110         ;;
111     sagan)
112         TEST_DEV=/dev/sda6
113         TEST_DIR=/mnt/xfs0
114         SCRATCH_DEV=/dev/sda7
115         SCRATCH_MNT=/mnt/xfs1
116         TAPE_DEV=/dev/st0
117         RMT_TAPE_DEV=sagan:/dev/st0
118         RMT_IRIXTAPE_DEV=snort:/dev/tape
119         RMT_TAPE_USER=guest
120         ;;
121     leesa)
122         TEST_DEV=/dev/xfs_test
123         TEST_DIR=/mnt/xfs_test
124         SCRATCH_DEV=/dev/xfs_scratch
125         SCRATCH_MNT=/mnt/xfs_scratch
126         SCRATCH_LOGDEV=/dev/xfs_log
127         ;;
128     troppo)
129         TEST_DEV=/dev/hdb13
130         TEST_DIR=/mnt/test
131         SCRATCH_DEV=/dev/hdb14
132         SCRATCH_MNT=/mnt/scratch
133         SCRATCH_LOGDEV=/dev/hdb15
134         ;;
135     lord)
136         TEST_DIR=/xfs
137         TEST_DEV=/dev/sda5
138         SCRATCH_DEV=/dev/sda6
139         SCRATCH_LOGDEV=/dev/hda7
140         SCRATCH_RTDEV=/dev/hda8
141         SCRATCH_MNT=/xfs1
142         ;;
143     burst)
144         TEST_DIR=/xfs
145         TEST_DEV=/dev/hda3
146         SCRATCH_DEV=/dev/hda7
147         SCRATCH_MNT=/scratch
148         ;;
149     lumpy)
150         TEST_DEV=/dev/sdc5
151         TEST_DIR=/mnt/scratch_0
152         SCRATCH_DEV=/dev/sdc7
153         SCRATCH_MNT=/mnt/scratch_2
154         ;;
155     bongo)
156         TEST_DEV=/dev/hda8
157         TEST_DIR=/xfs1
158         SCRATCH_DEV=/dev/hda9
159         SCRATCH_MNT=/xfs2
160         SCRATCH_LOGDEV=/dev/hda10
161         SCRATCH_RTDEV=/dev/hda11
162         ;;
163     snowy)
164         TEST_DEV=/dev/sda7
165         TEST_DIR=/mnt/xfs0
166         SCRATCH_DEV=/dev/sda8
167         SCRATCH_MNT=/mnt/xfs1
168         SCRATCH_LOGDEV=/dev/sda9
169         ;;
170     surly)
171         TEST_DEV=/dev/hda9
172         TEST_DIR=/mnt/xfs1
173         SCRATCH_DEV=/dev/hda8
174         SCRATCH_MNT=/mnt/xfs0
175         SCRATCH_LOGDEV=/dev/hda10
176         TAPE_DEV=/dev/st0
177         RMT_TAPE_DEV=fuzzy:/dev/st0
178         RMT_IRIXTAPE_DEV=blub:/dev/tape
179         RMT_TAPE_USER=guest
180         ;;
181     permit)
182         TEST_DEV=/dev/sdc1
183         TEST_DIR=/mnt/xfs0
184         SCRATCH_DEV=/dev/sdd1
185         SCRATCH_MNT=/mnt/xfs1
186         ;;
187     indra)
188         TEST_DEV=/dev/sdb1
189         TEST_DIR=/mnt/xfs0
190         SCRATCH_DEV=/dev/sdb2
191         SCRATCH_MNT=/mnt/xfs1
192         ;;
193     usermode)
194         TEST_DEV=/dev/ubd/1
195         TEST_DIR=/mnt/test
196         SCRATCH_DEV=/dev/ubd/2
197         SCRATCH_MNT=/mnt/scratch
198         SCRATCH_RTDEV=/dev/ubd/3
199         SCRATCH_LOGDEV=/dev/ubd/4
200         ;;
201     lite)
202         TEST_DEV=/dev/sda1
203         TEST_DIR=/mnt/sda1
204         SCRATCH_DEV=/dev/sda2
205         SCRATCH_MNT=/mnt/sda2
206         SCRATCH_LOGDEV=/dev/sda3
207         ;;
208     *)
209         echo "common.config: Error: need to define parameters for host `hostname -s`"
210         exit 1
211         ;;
212 esac
213
214 if [ ! -b "$TEST_DEV" ]
215 then
216     echo "common.config: Error: \$TEST_DEV ($TEST_DEV) is not a block device"
217     exit 1
218 fi
219
220 if [ ! -d "$TEST_DIR" ]
221 then
222     echo "common.config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
223     exit 1
224 fi
225
226 if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" ]
227 then
228     echo "common.config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) is not a block device"
229     exit 1
230 fi
231
232 if [ ! -z "$SCRATCH_DEV" -a ! -d "$SCRATCH_MNT" ]
233 then
234     echo "common.config: Error: \$SCRATCH_MNT ($SCRATCH_MNT) is not a directory"
235     exit 1
236 fi
237
238 # if devfs is running expand the full /dev/.. pathname - this is what will be
239 # returned by utilities such as mount
240 [ -L "$TEST_DEV" ] && TEST_DEV=`_readlink $TEST_DEV`
241 [ -L "$SCRATCH_DEV" ] && SCRATCH_DEV=`_readlink $SCRATCH_DEV`
242 [ -L "$SCRATCH_LOGDEV" ] && SCRATCH_LOGDEV=`_readlink $SCRATCH_LOGDEV`
243 [ -L "$SCRATCH_RTDEV" ] && SCRATCH_RTDEV=`_readlink $SCRATCH_LOGDEV`
244
245 # make sure this script returns success
246 /bin/true