Fixed merge problems
[xfstests-dev.git] / common.config
1 ##/bin/sh
2 #
3 # Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
4
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of version 2 of the GNU General Public License as
7 # published by the Free Software Foundation.
8
9 # This program is distributed in the hope that it would be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 # Further, this software is distributed without any warranty that it is
14 # free of the rightful claim of any third person regarding infringement
15 # or the like.  Any license provided herein, whether implied or
16 # otherwise, applies only to this software file.  Patent licenses, if
17 # any, provided herein do not apply to combinations of this program with
18 # other software, or any other product whatsoever.
19
20 # You should have received a copy of the GNU General Public License along
21 # with this program; if not, write the Free Software Foundation, Inc., 59
22 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
23
24 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
25 # Mountain View, CA  94043, or:
26
27 # http://www.sgi.com 
28
29 # For further information regarding this notice, see: 
30
31 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
32 #
33
34 #
35 # setup and check for config parameters, and in particular
36 #
37 # TEST_DIR              - scratch test directory that is in an already
38 #                         mounted XFS file system, needs to be be world
39 #                         writeable
40 # TEST_DEV              - device for file system containing TEST_DIR
41 # SCRATCH_DEV           - device you can make a scratch file system on
42 # SCRATCH_MNT           - mount point for scratch file system
43
44 # and optionally:
45 # SCRATCH_LOGDEV        - scratch log device for external log testing
46 # SCRATCH_RTDEV         - scratch rt dev
47 # TEST_LOGDEV           - test log device for external log testing
48 # TEST_RTDEV            - test rt dev
49 # TAPE_DEV              - the tape device for the xfsdump tests
50 # RMT_TAPE_DEV          - the remote tape device for the xfsdump tests
51 # RMT_IRIXTAPE_DEV      - the IRIX remote tape device for the xfsdump tests
52 # RMT_TAPE_USER         - remote user for tape device
53 #
54 # - These can be added to known_hosts() below or a separate local
55 #   configuration file can be used (using the HOST_OPTIONS variable).
56 # - This script is shared by the stress test system and the auto-qa
57 #   system (includes both regression test and benchmark components).
58 # - TEST_DEV & TEST_DIR must be assigned.
59 # - this script shouldn't make any assertions about filesystem
60 #   validity or mountedness.
61 #
62
63 # Warning: don't put freeware before /usr/bsd on IRIX coz you'll
64 #          get the wrong hostname and set your system name to -s  :)
65 [ -d /usr/bsd ] && PATH=$PATH:/usr/bsd
66 [ -d /usr/freeware/bin ] && PATH=$PATH:/usr/freeware/bin
67 PATH=".:$PATH"
68
69 HOST=`hostname -s`
70 HOSTOS=`uname -s`
71 [ "$HOSTOS" = "IRIX64" ] && HOSTOS="IRIX"
72
73 MODULAR=0               # using XFS as a module or not
74 BOOT="/boot"            # install target for kernels
75 export EXTRA=${EXTRA:=xfs-qa}
76
77 # general parameters (mainly for auto-qa)
78 SOAK_PROC=3             # -p option to fsstress
79 SOAK_STRESS=10000       # -n option to fsstress
80 SOAK_PASSES=-1          # count of repetitions of fsstress (while soaking)
81 EMAIL=root@localhost    # where auto-qa will send its status messages
82 export HOST_OPTIONS=${HOST_OPTIONS:=local.config}
83 export CHECK_OPTIONS=${CHECK_OPTIONS:="-g auto"}
84 export BENCH_PASSES=${BENCH_PASSES:=5}
85 export XFS_MKFS_OPTIONS=${XFS_MKFS_OPTIONS:=-bsize=4096}
86 [ "$HOSTOS" == "Linux" ] && export XFS_MOUNT_OPTIONS=${XFS_MOUNT_OPTIONS:=-ologbufs=2}
87 export UDF_MKFS_OPTIONS=${UDF_MKFS_OPTIONS}
88 export UDF_MOUNT_OPTIONS=${UDF_MOUNT_OPTIONS}
89 export NFS_MKFS_OPTIONS=${NFS_MKFS_OPTIONS}
90 export NFS_MOUNT_OPTIONS=${NFS_MOUNT_OPTIONS}
91
92 #export DEBUG=${DEBUG:=...} # arbitrary CFLAGS really.
93 export MALLOCLIB=${MALLOCLIB:=/usr/lib/libefence.a}
94 export LOCAL_CONFIGURE_OPTIONS=${LOCAL_CONFIGURE_OPTIONS:=--enable-readline=yes}
95
96 # $1 = prog to look for, $2* = default pathnames if not found in $PATH
97 set_prog_path()
98 {
99     p=`which $1 2> /dev/null`
100     if [ -n "$p" -a -x "$p" ]
101     then
102         echo $p
103         return 0
104     fi
105     p=$1
106
107     shift
108     for f
109     do
110         if [ -x $f ]
111         then
112             echo $f
113             return 0
114         fi
115     done
116
117     echo ""
118     return 1
119 }
120
121 _fatal()
122 {
123     echo "$*"
124     status=1
125     exit 1
126 }
127
128 export MKFS_PROG="`set_prog_path mkfs`"
129 [ "$MKFS_PROG" = "" ] && _fatal "mkfs not found"
130
131 export AWK_PROG="`set_prog_path awk`"
132 [ "$AWK_PROG" = "" ] && _fatal "awk not found"
133
134 export MOUNT_PROG="`set_prog_path mount`"
135 [ "$MOUNT_PROG" = "" ] && _fatal "mount not found"
136
137 export UMOUNT_PROG="`set_prog_path umount`"
138 [ "$UMOUNT_PROG" = "" ] && _fatal "umount not found"
139
140 export NSLOOKUP_PROG="`set_prog_path nslookup`"
141 [ "$NSLOOKUP_PROG" = "" ] && _fatal "nslookup not found"
142
143 export PERL_PROG="`set_prog_path perl`"
144 [ "$PERL_PROG" = "" ] && _fatal "perl not found"
145
146 export SED_PROG="`set_prog_path sed`"
147 [ "$SED_PROG" = "" ] && _fatal "sed not found"
148
149 export MAKE_PROG="`set_prog_path gmake`"
150 [ "$MAKE_PROG" = "" ] && _fatal "gmake not found"
151
152 export PS_ALL_FLAGS="-ef"
153
154 export DF_PROG="`set_prog_path df`"
155 [ "$DF_PROG" = "" ] && _fatal "df not found"
156 [ "$HOSTOS" = "Linux" ] && export DF_PROG="$DF_PROG -T"
157
158 export XFS_LOGPRINT_PROG="`set_prog_path xfs_logprint`"
159 export XFS_REPAIR_PROG="`set_prog_path xfs_repair`"
160 export XFS_CHECK_PROG="`set_prog_path xfs_check`"
161 export XFS_DB_PROG="`set_prog_path xfs_db`"
162
163 case "$HOSTOS" in
164     IRIX*)
165            export MKFS_XFS_PROG="`set_prog_path mkfs_xfs`"
166            export MKFS_UDF_PROG="`set_prog_path mkfs_udf`" 
167            export XFS_FSR_PROG="`set_prog_path /usr/etc/fsr_xfs`"
168            export MKFS_NFS_PROG="false" 
169            ;;
170     Linux)
171            export MKFS_XFS_PROG="`set_prog_path mkfs.xfs`"
172            export MKFS_UDF_PROG="`set_prog_path mkfs.udf`"
173            export XFS_FSR_PROG="`set_prog_path xfs_fsr`"
174            export MKFS_NFS_PROG="false" 
175            ;;
176 esac
177
178 known_hosts()
179 {
180         case "$HOST"
181         in
182             bruce)
183                 MODULAR=0
184                 EMAIL="nathans@larry"
185                 SCRATCH_MNT=/mnt/xfs0
186                 SCRATCH_DEV=/dev/sdb5
187                 SCRATCH_LOGDEV=/dev/sda11
188                 TEST_DIR=/mnt/xfs1
189                 TEST_DEV=/dev/sdc3
190                 TEST_LOGDEV=/dev/sda9
191                 TAPE_DEV=/dev/st0
192                 RMT_TAPE_DEV=bruce:/dev/st0
193                 RMT_IRIXTAPE_DEV=snort:/dev/tape
194                 RMT_TAPE_USER=guest
195                 ;;
196             sherman)
197                 TEST_DEV=/dev/sda10
198                 TEST_DIR=/mnt/xfs1
199                 SCRATCH_DEV=/dev/sda9
200                 SCRATCH_MNT=/mnt/xfs0
201                 ;;
202             flutz)
203                 MODULAR=0
204                 EMAIL="nathans@larry"
205                 TEST_DEV=/dev/sda5
206                 TEST_LOGDEV=/dev/sda9
207                 TEST_DIR=/xfsqa1
208                 SCRATCH_DEV=/dev/sda6
209                 SCRATCH_LOGDEV=/dev/sda7
210                 SCRATCH_MNT=/xfsqa2
211                 TAPE_DEV=/dev/st0
212                 RMT_TAPE_DEV=bruce:/dev/st0
213                 RMT_IRIXTAPE_DEV=snort:/dev/tape
214                 RMT_TAPE_USER=guest
215                 ;;
216             frodo)
217                 MODULAR=0
218                 EMAIL="nathans@larry"
219                 TEST_DEV=/dev/hda6
220                 TEST_DIR=/mnt/test
221                 SCRATCH_DEV=/dev/hda7
222                 SCRATCH_MNT=/mnt/scratch
223                 SCRATCH_LOGDEV=/dev/hda9
224                 ;;
225             goldfish)
226                 MODULAR=0
227                 TEST_DEV=/dev/hdc1
228                 TEST_DIR=/mnt/xfs0
229                 SCRATCH_DEV=/dev/hdc2
230                 SCRATCH_MNT=/mnt/xfs1
231                 SCRATCH_LOGDEV=/dev/hdc3
232                 ;;
233             lord)
234                 TEST_DIR=/xfs
235                 TEST_DEV=/dev/sda1
236                 SCRATCH_DEV=/dev/sda5
237                 SCRATCH_LOGDEV=/dev/sda6
238                 SCRATCH_MNT=/xfs1
239                 ;;
240             burst)
241                 TEST_DIR=/xfs
242                 TEST_DEV=/dev/hda3
243                 SCRATCH_DEV=/dev/hda7
244                 SCRATCH_MNT=/scratch
245                 ;;
246             lumpy)
247                 TEST_DEV=/dev/sdc5
248                 TEST_DIR=/mnt/scratch_0
249                 SCRATCH_DEV=/dev/sdc7
250                 SCRATCH_MNT=/mnt/scratch_2
251                 ;;
252             bongo)
253                 TEST_DEV=/dev/hda8
254                 TEST_DIR=/xfs1
255                 SCRATCH_DEV=/dev/hda9
256                 SCRATCH_MNT=/xfs2
257                 SCRATCH_LOGDEV=/dev/hda10
258                 SCRATCH_RTDEV=/dev/hda11
259                 ;;
260             surly)
261                 TEST_DEV=/dev/hda9
262                 TEST_DIR=/mnt/xfs1
263                 SCRATCH_DEV=/dev/hda8
264                 SCRATCH_MNT=/mnt/xfs0
265                 SCRATCH_LOGDEV=/dev/hda10
266                 TAPE_DEV=/dev/st0
267                 RMT_TAPE_DEV=fuzzy:/dev/st0
268                 RMT_IRIXTAPE_DEV=blub:/dev/tape
269                 RMT_TAPE_USER=guest
270                 ;;
271             permit)
272                 TEST_DEV=/dev/sdc1
273                 TEST_DIR=/mnt/xfs0
274                 SCRATCH_DEV=/dev/sdd1
275                 SCRATCH_MNT=/mnt/xfs1
276                 ;;
277             indra)
278                 TEST_DEV=/dev/sdb1
279                 TEST_DIR=/mnt/xfs0
280                 SCRATCH_DEV=/dev/sdb2
281                 SCRATCH_MNT=/mnt/xfs1
282                 ;;
283             usermode)
284                 TEST_DEV=/dev/ubd/1
285                 TEST_DIR=/mnt/test
286                 SCRATCH_DEV=/dev/ubd/2
287                 SCRATCH_MNT=/mnt/scratch
288                 SCRATCH_RTDEV=/dev/ubd/3
289                 SCRATCH_LOGDEV=/dev/ubd/4
290                 ;;
291             lite)
292                 TEST_DEV=/dev/sda1
293                 TEST_DIR=/mnt/sda1
294                 SCRATCH_DEV=/dev/sda2
295                 SCRATCH_MNT=/mnt/sda2
296                 SCRATCH_LOGDEV=/dev/sda3
297                 ;;
298             dmfnt2)
299                 TEST_DEV=/dev/sda6
300                 TEST_DIR=/mnt/test
301                 SCRATCH_DEV=/dev/sdc6
302                 SCRATCH_MNT=/mnt/scratch
303                 TAPE_DEV=/dev/st0
304                 RMT_TAPE_DEV=longhorn:/dev/tape
305                 # RMT_IRIXTAPE_DEV=longhorn:/dev/tape
306                 RMT_TAPE_USER=guest
307                 ;;
308             lab343)
309                 MODULAR=0
310                 EMAIL="hch@sgi.com"
311                 TEST_DEV=/dev/sdb1
312                 SCRATCH_DEV=/dev/sdb2
313                 SCRATCH_LOGDEV=/dev/sdb5
314                 SCRATCH_RTDEV=/dev/sdb6
315                 TEST_DIR=/qa/test
316                 SCRATCH_MNT=/qa/scratch
317                 ;;
318             *)
319                 echo "Error: need to define parameters for host $HOST"
320                 exit 1
321                 ;;
322         esac
323 }
324
325 if [ -f "$HOST_OPTIONS" ]; then
326     . ./"$HOST_OPTIONS"
327 else
328     known_hosts
329 fi
330
331 echo $TEST_DEV | grep -q ":" > /dev/null 2>&1
332 if [ ! -b "$TEST_DEV" -a "$?" != "0" ]
333 then
334     echo "common.config: Error: \$TEST_DEV ($TEST_DEV) is not a block device or a NFS filesystem"
335     exit 1
336 fi
337
338 if [ ! -d "$TEST_DIR" ]
339 then
340     echo "common.config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
341     exit 1
342 fi
343
344 echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
345 if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]
346 then
347     echo "common.config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) is not a block device or a NFS filesystem"
348     exit 1
349 fi
350
351 if [ ! -z "$SCRATCH_MNT" -a ! -d "$SCRATCH_MNT" ]
352 then
353     echo "common.config: Error: \$SCRATCH_MNT ($SCRATCH_MNT) is not a directory"
354     exit 1
355 fi
356
357 _readlink()
358 {
359     if [ $# -ne 1 ]
360     then
361         echo "Usage: _readlink filename" 1>&2
362         exit 1
363     fi
364
365     perl -e "\$in=\"$1\";" -e '
366         $lnk = readlink($in);
367         if ($lnk =~ m!^/.*!) {
368           print "$lnk\n";
369         }
370         else {
371           chomp($dir = `dirname $in`);
372           print "$dir/$lnk\n";
373         }'
374 }
375
376 # if devfs is running expand the full /dev/.. pathname - this is what will be
377 # returned by utilities such as mount
378 [ -L "$TEST_DEV" ] && TEST_DEV=`_readlink $TEST_DEV`
379 [ -L "$SCRATCH_DEV" ] && SCRATCH_DEV=`_readlink $SCRATCH_DEV`
380 [ -L "$SCRATCH_LOGDEV" ] && SCRATCH_LOGDEV=`_readlink $SCRATCH_LOGDEV`
381 [ -L "$SCRATCH_RTDEV" ] && SCRATCH_RTDEV=`_readlink $SCRATCH_LOGDEV`
382
383 # make sure this script returns success
384 /bin/true