Remove an extra comma in scripts output
[xfstests-dev.git] / common.config
1 ##/bin/sh
2
3 #
4 # Copyright (c) 2000-2003 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
48 # TEST_LOGDEV           - test log device for external log testing
49 # TEST_RTDEV            - test rt dev
50 # TAPE_DEV              - the tape device for the xfsdump tests
51 # RMT_TAPE_DEV          - the remote tape device for the xfsdump tests
52 # RMT_IRIXTAPE_DEV      - the IRIX remote tape device for the xfsdump tests
53 # RMT_TAPE_USER         - remote user for tape device
54 #
55 # - These can be added to known_hosts() below or a separate local
56 #   configuration file can be used (using the HOST_OPTIONS variable).
57 # - This script is shared by the stress test system and the auto-qa
58 #   system (includes both regression test and benchmark components).
59 # - TEST_DEV & TEST_DIR must be assigned.
60 # - this script shouldn't make any assertions about filesystem
61 #   validity or mountedness.
62 #
63
64 HOST=`hostname -s`
65 MODULAR=0               # using XFS as a module or not
66 BOOT="/boot"            # install target for kernels
67 export EXTRA=${EXTRA:=xfs-qa}
68
69 # general parameters (mainly for auto-qa)
70 SOAK_PROC=3             # -p option to fsstress
71 SOAK_STRESS=10000       # -n option to fsstress
72 SOAK_PASSES=-1          # count of repetitions of fsstress (while soaking)
73 EMAIL=root@localhost    # where auto-qa will send its status messages
74 export HOST_OPTIONS=${HOST_OPTIONS:=local.config}
75 export MKFS_OPTIONS=${MKFS_OPTIONS:=-bsize=4096}
76 export MOUNT_OPTIONS=${MOUNT_OPTIONS:=-ologbufs=2}
77 export CHECK_OPTIONS=${CHECK_OPTIONS:="-g auto"}
78 export BENCH_PASSES=${BENCH_PASSES:=5}
79
80 #export DEBUG=${DEBUG:=...} # arbitrary CFLAGS really.
81 export MALLOCLIB=${MALLOCLIB:=/usr/lib/libefence.a}
82 export LOCAL_CONFIGURE_OPTIONS=${LOCAL_CONFIGURE_OPTIONS:=--enable-readline=yes}
83
84 known_hosts()
85 {
86         case "$HOST"
87         in
88             bruce)
89                 MODULAR=0
90                 EMAIL="nathans@larry"
91                 SCRATCH_MNT=/mnt/xfs0
92                 SCRATCH_DEV=/dev/sdb5
93                 SCRATCH_LOGDEV=/dev/sda11
94                 TEST_DIR=/mnt/xfs1
95                 TEST_DEV=/dev/sdc3
96                 TEST_LOGDEV=/dev/sda9
97                 TAPE_DEV=/dev/st0
98                 RMT_TAPE_DEV=bruce:/dev/st0
99                 RMT_IRIXTAPE_DEV=snort:/dev/tape
100                 RMT_TAPE_USER=guest
101                 ;;
102             sherman)
103                 TEST_DEV=/dev/sda10
104                 TEST_DIR=/mnt/xfs1
105                 SCRATCH_DEV=/dev/sda9
106                 SCRATCH_MNT=/mnt/xfs0
107                 ;;
108             flutz)
109                 MODULAR=0
110                 EMAIL="nathans@larry"
111                 TEST_DEV=/dev/sda5
112                 TEST_LOGDEV=/dev/sda9
113                 TEST_DIR=/xfsqa1
114                 SCRATCH_DEV=/dev/sda6
115                 SCRATCH_LOGDEV=/dev/sda7
116                 SCRATCH_MNT=/xfsqa2
117                 TAPE_DEV=/dev/st0
118                 RMT_TAPE_DEV=bruce:/dev/st0
119                 RMT_IRIXTAPE_DEV=snort:/dev/tape
120                 RMT_TAPE_USER=guest
121                 ;;
122             frodo)
123                 MODULAR=0
124                 EMAIL="nathans@larry"
125                 TEST_DEV=/dev/hda6
126                 TEST_DIR=/mnt/test
127                 SCRATCH_DEV=/dev/hda7
128                 SCRATCH_MNT=/mnt/scratch
129                 SCRATCH_LOGDEV=/dev/hda9
130                 ;;
131             goldfish)
132                 MODULAR=0
133                 TEST_DEV=/dev/hdc1
134                 TEST_DIR=/mnt/xfs0
135                 SCRATCH_DEV=/dev/hdc2
136                 SCRATCH_MNT=/mnt/xfs1
137                 SCRATCH_LOGDEV=/dev/hdc3
138                 ;;
139             lord)
140                 TEST_DIR=/xfs
141                 TEST_DEV=/dev/sda5
142                 SCRATCH_DEV=/dev/hda7
143                 SCRATCH_LOGDEV=/dev/sda6
144                 SCRATCH_MNT=/xfs1
145                 ;;
146             burst)
147                 TEST_DIR=/xfs
148                 TEST_DEV=/dev/hda3
149                 SCRATCH_DEV=/dev/hda7
150                 SCRATCH_MNT=/scratch
151                 ;;
152             lumpy)
153                 TEST_DEV=/dev/sdc5
154                 TEST_DIR=/mnt/scratch_0
155                 SCRATCH_DEV=/dev/sdc7
156                 SCRATCH_MNT=/mnt/scratch_2
157                 ;;
158             bongo)
159                 TEST_DEV=/dev/hda8
160                 TEST_DIR=/xfs1
161                 SCRATCH_DEV=/dev/hda9
162                 SCRATCH_MNT=/xfs2
163                 SCRATCH_LOGDEV=/dev/hda10
164                 SCRATCH_RTDEV=/dev/hda11
165                 ;;
166             surly)
167                 TEST_DEV=/dev/hda9
168                 TEST_DIR=/mnt/xfs1
169                 SCRATCH_DEV=/dev/hda8
170                 SCRATCH_MNT=/mnt/xfs0
171                 SCRATCH_LOGDEV=/dev/hda10
172                 TAPE_DEV=/dev/st0
173                 RMT_TAPE_DEV=fuzzy:/dev/st0
174                 RMT_IRIXTAPE_DEV=blub:/dev/tape
175                 RMT_TAPE_USER=guest
176                 ;;
177             permit)
178                 TEST_DEV=/dev/sdc1
179                 TEST_DIR=/mnt/xfs0
180                 SCRATCH_DEV=/dev/sdd1
181                 SCRATCH_MNT=/mnt/xfs1
182                 ;;
183             indra)
184                 TEST_DEV=/dev/sdb1
185                 TEST_DIR=/mnt/xfs0
186                 SCRATCH_DEV=/dev/sdb2
187                 SCRATCH_MNT=/mnt/xfs1
188                 ;;
189             usermode)
190                 TEST_DEV=/dev/ubd/1
191                 TEST_DIR=/mnt/test
192                 SCRATCH_DEV=/dev/ubd/2
193                 SCRATCH_MNT=/mnt/scratch
194                 SCRATCH_RTDEV=/dev/ubd/3
195                 SCRATCH_LOGDEV=/dev/ubd/4
196                 ;;
197             lite)
198                 TEST_DEV=/dev/sda1
199                 TEST_DIR=/mnt/sda1
200                 SCRATCH_DEV=/dev/sda2
201                 SCRATCH_MNT=/mnt/sda2
202                 SCRATCH_LOGDEV=/dev/sda3
203                 ;;
204             dmfnt2)
205                 TEST_DEV=/dev/sda6
206                 TEST_DIR=/mnt/test
207                 SCRATCH_DEV=/dev/sdc6
208                 SCRATCH_MNT=/mnt/scratch
209                 TAPE_DEV=/dev/st0
210                 RMT_TAPE_DEV=longhorn:/dev/tape
211                 # RMT_IRIXTAPE_DEV=longhorn:/dev/tape
212                 RMT_TAPE_USER=guest
213                 ;;
214             lab343)
215                 MODULAR=0
216                 EMAIL="hch@sgi.com"
217                 TEST_DEV=/dev/sdb1
218                 SCRATCH_DEV=/dev/sdb2
219                 SCRATCH_LOGDEV=/dev/sdb5
220                 SCRATCH_RTDEV=/dev/sdb6
221                 TEST_DIR=/qa/test
222                 SCRATCH_MNT=/qa/scratch
223                 ;;
224             *)
225                 echo "Error: need to define parameters for host $HOST"
226                 exit 1
227                 ;;
228         esac
229 }
230
231 if [ -f "$HOST_OPTIONS" ]; then
232     source "$HOST_OPTIONS"
233 else
234     known_hosts
235 fi
236
237 if [ ! -b "$TEST_DEV" ]
238 then
239     echo "common.config: Error: \$TEST_DEV ($TEST_DEV) is not a block device"
240     exit 1
241 fi
242
243 if [ ! -d "$TEST_DIR" ]
244 then
245     echo "common.config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
246     exit 1
247 fi
248
249 if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" ]
250 then
251     echo "common.config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) is not a block device"
252     exit 1
253 fi
254
255 if [ ! -z "$SCRATCH_DEV" -a ! -d "$SCRATCH_MNT" ]
256 then
257     echo "common.config: Error: \$SCRATCH_MNT ($SCRATCH_MNT) is not a directory"
258     exit 1
259 fi
260
261 _readlink()
262 {
263     if [ $# -ne 1 ]
264     then
265         echo "Usage: _readlink filename" 1>&2
266         exit 1
267     fi
268
269     perl -e "\$in=\"$1\";" -e '
270         $lnk = readlink($in);
271         if ($lnk =~ m!^/.*!) {
272           print "$lnk\n";
273         }
274         else {
275           chomp($dir = `dirname $in`);
276           print "$dir/$lnk\n";
277         }'
278 }
279
280 # if devfs is running expand the full /dev/.. pathname - this is what will be
281 # returned by utilities such as mount
282 [ -L "$TEST_DEV" ] && TEST_DEV=`_readlink $TEST_DEV`
283 [ -L "$SCRATCH_DEV" ] && SCRATCH_DEV=`_readlink $SCRATCH_DEV`
284 [ -L "$SCRATCH_LOGDEV" ] && SCRATCH_LOGDEV=`_readlink $SCRATCH_LOGDEV`
285 [ -L "$SCRATCH_RTDEV" ] && SCRATCH_RTDEV=`_readlink $SCRATCH_LOGDEV`
286
287 # make sure this script returns success
288 /bin/true