QA updates - make builds on older versions of headers work, reenable rt on bruce.
[xfstests-dev.git] / common.config
1 ##/bin/sh
2 #
3 # Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # setup and check for config parameters, and in particular
6 #
7 # TEST_DIR              - scratch test directory that is in an already
8 #                         mounted XFS file system, needs to be be world
9 #                         writeable
10 # TEST_DEV              - device for file system containing TEST_DIR
11 # SCRATCH_DEV           - device you can make a scratch file system on
12 # SCRATCH_MNT           - mount point for scratch file system
13 #
14 # and optionally:
15 # SCRATCH_LOGDEV        - scratch log device for external log testing
16 # SCRATCH_RTDEV         - scratch rt dev
17 # TEST_LOGDEV           - test log device for external log testing
18 # TEST_RTDEV            - test rt dev
19 # TAPE_DEV              - the tape device for the xfsdump tests
20 # RMT_TAPE_DEV          - the remote tape device for the xfsdump tests
21 # RMT_IRIXTAPE_DEV      - the IRIX remote tape device for the xfsdump tests
22 # RMT_TAPE_USER         - remote user for tape device
23 #
24 # - These can be added to known_hosts() below or a separate local
25 #   configuration file can be used (using the HOST_OPTIONS variable).
26 # - This script is shared by the stress test system and the auto-qa
27 #   system (includes both regression test and benchmark components).
28 # - TEST_DEV & TEST_DIR must be assigned.
29 # - this script shouldn't make any assertions about filesystem
30 #   validity or mountedness.
31 #
32
33 # Warning: don't put freeware before /usr/bsd on IRIX coz you'll
34 #          get the wrong hostname and set your system name to -s  :)
35 [ -d /usr/bsd ] && PATH=$PATH:/usr/bsd
36 [ -d /usr/freeware/bin ] && PATH=$PATH:/usr/freeware/bin
37 PATH=".:$PATH"
38
39 HOST=`hostname -s`
40 HOSTOS=`uname -s`
41 [ "$HOSTOS" = "IRIX64" ] && HOSTOS="IRIX"
42
43 MODULAR=0               # using XFS as a module or not
44 BOOT="/boot"            # install target for kernels
45 export EXTRA=${EXTRA:=xfs-qa}
46
47 # general parameters (mainly for auto-qa)
48 SOAK_PROC=3             # -p option to fsstress
49 SOAK_STRESS=10000       # -n option to fsstress
50 SOAK_PASSES=-1          # count of repetitions of fsstress (while soaking)
51 EMAIL=root@localhost    # where auto-qa will send its status messages
52 export HOST_OPTIONS=${HOST_OPTIONS:=local.config}
53 export CHECK_OPTIONS=${CHECK_OPTIONS:="-g auto"}
54 export BENCH_PASSES=${BENCH_PASSES:=5}
55 export XFS_MKFS_OPTIONS=${XFS_MKFS_OPTIONS:=-bsize=4096}
56
57 export PWD=`pwd`
58 #export DEBUG=${DEBUG:=...} # arbitrary CFLAGS really.
59 export MALLOCLIB=${MALLOCLIB:=/usr/lib/libefence.a}
60 export LOCAL_CONFIGURE_OPTIONS=${LOCAL_CONFIGURE_OPTIONS:=--enable-readline=yes}
61
62 # $1 = prog to look for, $2* = default pathnames if not found in $PATH
63 set_prog_path()
64 {
65     p=`which $1 2> /dev/null`
66     if [ -n "$p" -a -x "$p" ]
67     then
68         echo $p
69         return 0
70     fi
71     p=$1
72
73     shift
74     for f
75     do
76         if [ -x $f ]
77         then
78             echo $f
79             return 0
80         fi
81     done
82
83     echo ""
84     return 1
85 }
86
87 _fatal()
88 {
89     echo "$*"
90     status=1
91     exit 1
92 }
93
94 export MKFS_PROG="`set_prog_path mkfs`"
95 [ "$MKFS_PROG" = "" ] && _fatal "mkfs not found"
96
97 export MOUNT_PROG="`set_prog_path mount`"
98 [ "$MOUNT_PROG" = "" ] && _fatal "mount not found"
99
100 export UMOUNT_PROG="`set_prog_path umount`"
101 [ "$UMOUNT_PROG" = "" ] && _fatal "umount not found"
102
103 export FSSTRESS_PROG="`set_prog_path fsstress $PWD/ltp/fsstress`"
104 [ "$FSSTRESS_PROG" = "" ] && _fatal "fsstress not found"
105
106 export NSLOOKUP_PROG="`set_prog_path nslookup`"
107 [ "$NSLOOKUP_PROG" = "" ] && _fatal "nslookup not found"
108
109 export PERL_PROG="`set_prog_path perl`"
110 [ "$PERL_PROG" = "" ] && _fatal "perl not found"
111
112 export AWK_PROG="`set_prog_path awk`"
113 [ "$AWK_PROG" = "" ] && _fatal "awk not found"
114
115 export SED_PROG="`set_prog_path sed`"
116 [ "$SED_PROG" = "" ] && _fatal "sed not found"
117
118 export PS_ALL_FLAGS="-ef"
119
120 export DF_PROG="`set_prog_path df`"
121 [ "$DF_PROG" = "" ] && _fatal "df not found"
122 [ "$HOSTOS" = "Linux" ] && export DF_PROG="$DF_PROG -T"
123
124 export XFS_LOGPRINT_PROG="`set_prog_path xfs_logprint`"
125 export XFS_REPAIR_PROG="`set_prog_path xfs_repair`"
126 export XFS_CHECK_PROG="`set_prog_path xfs_check`"
127 export XFS_DB_PROG="`set_prog_path xfs_db`"
128 export XFS_GROWFS_PROG=`set_prog_path xfs_growfs`
129 export XFS_IO_PROG="`set_prog_path xfs_io`"
130
131 case "$HOSTOS" in
132     IRIX*)
133            export MKFS_XFS_PROG="`set_prog_path mkfs_xfs`"
134            export MKFS_UDF_PROG="`set_prog_path mkfs_udf`"
135            export XFS_FSR_PROG="`set_prog_path /usr/etc/fsr_xfs`"
136            export MKFS_NFS_PROG="false"
137            ;;
138     Linux)
139            export MKFS_XFS_PROG="`set_prog_path mkfs.xfs`"
140            export MKFS_UDF_PROG="`set_prog_path mkudffs`"
141            export XFS_FSR_PROG="`set_prog_path xfs_fsr`"
142            export MKFS_NFS_PROG="false"
143            ;;
144 esac
145
146 known_hosts()
147 {
148         case "$HOST"
149         in
150             sheila)
151                 MODULAR=1
152                 EMAIL="nathans@larry"
153                 SCRATCH_MNT=/mnt/scratch
154                 SCRATCH_DEV=/dev/hdb1
155                 TEST_DIR=/mnt/test
156                 TEST_DEV=/dev/hdb2
157                 TEST_LOGDEV=/dev/hdb3
158                 SCRATCH_LOGDEV=/dev/hdb5
159                 #RMT_TAPE_DEV=bruce:/dev/st0
160                 #RMT_IRIXTAPE_DEV=snort:/dev/tape
161                 #RMT_TAPE_USER=guest
162                 ;;
163             bruce)
164                 MODULAR=0
165                 EMAIL="nathans@larry"
166                 SCRATCH_MNT=/mnt/scratch
167                 SCRATCH_DEV=/dev/sdb5
168                 SCRATCH_RTDEV=/dev/sdc1
169                 SCRATCH_LOGDEV=/dev/sda11
170                 TEST_DIR=/mnt/test
171                 TEST_DEV=/dev/sdc3
172                 TEST_RTDEV=/dev/sdb6
173                 TEST_LOGDEV=/dev/sda9
174                 #TAPE_DEV=/dev/st0
175                 #RMT_TAPE_DEV=bruce:/dev/st0
176                 #RMT_IRIXTAPE_DEV=snort:/dev/tape
177                 #RMT_TAPE_USER=guest
178                 ;;
179             frodo)
180                 MODULAR=0
181                 EMAIL="nathans@larry"
182                 TEST_DEV=/dev/hda6
183                 TEST_DIR=/mnt/test
184                 SCRATCH_DEV=/dev/hda7
185                 SCRATCH_MNT=/mnt/scratch
186                 SCRATCH_LOGDEV=/dev/hda9
187                 ;;
188             goldfish)
189                 MODULAR=0
190                 TEST_DEV=/dev/hdc1
191                 TEST_DIR=/mnt/xfs0
192                 SCRATCH_DEV=/dev/hdc2
193                 SCRATCH_MNT=/mnt/xfs1
194                 SCRATCH_LOGDEV=/dev/hdc3
195                 ;;
196             burst)
197                 TEST_DIR=/xfs
198                 TEST_DEV=/dev/hda3
199                 SCRATCH_DEV=/dev/hda7
200                 SCRATCH_MNT=/scratch
201                 ;;
202             lumpy)
203                 TEST_DEV=/dev/sdc5
204                 TEST_DIR=/mnt/scratch_0
205                 SCRATCH_DEV=/dev/sdc7
206                 SCRATCH_MNT=/mnt/scratch_2
207                 ;;
208             bongo)
209                 TEST_DEV=/dev/hda8
210                 TEST_DIR=/xfs1
211                 SCRATCH_DEV=/dev/hda9
212                 SCRATCH_MNT=/xfs2
213                 SCRATCH_LOGDEV=/dev/hda10
214                 SCRATCH_RTDEV=/dev/hda11
215                 ;;
216             surly)
217                 TEST_DEV=/dev/hda9
218                 TEST_DIR=/mnt/xfs1
219                 SCRATCH_DEV=/dev/hda8
220                 SCRATCH_MNT=/mnt/xfs0
221                 SCRATCH_LOGDEV=/dev/hda10
222                 TAPE_DEV=/dev/st0
223                 RMT_TAPE_DEV=fuzzy:/dev/st0
224                 RMT_IRIXTAPE_DEV=blub:/dev/tape
225                 RMT_TAPE_USER=guest
226                 ;;
227             permit)
228                 TEST_DEV=/dev/sdc1
229                 TEST_DIR=/mnt/xfs0
230                 SCRATCH_DEV=/dev/sdd1
231                 SCRATCH_MNT=/mnt/xfs1
232                 ;;
233             indra)
234                 TEST_DEV=/dev/sdb1
235                 TEST_DIR=/mnt/xfs0
236                 SCRATCH_DEV=/dev/sdb2
237                 SCRATCH_MNT=/mnt/xfs1
238                 ;;
239             usermode)
240                 TEST_DEV=/dev/ubd/1
241                 TEST_DIR=/mnt/test
242                 SCRATCH_DEV=/dev/ubd/2
243                 SCRATCH_MNT=/mnt/scratch
244                 SCRATCH_RTDEV=/dev/ubd/3
245                 SCRATCH_LOGDEV=/dev/ubd/4
246                 ;;
247             lite)
248                 TEST_DEV=/dev/sda1
249                 TEST_DIR=/mnt/sda1
250                 SCRATCH_DEV=/dev/sda2
251                 SCRATCH_MNT=/mnt/sda2
252                 SCRATCH_LOGDEV=/dev/sda3
253                 SCRATCH_RTDEV=/dev/sda4
254                 ;;
255             dmfnt2)
256                 TEST_DEV=/dev/sda6
257                 TEST_DIR=/mnt/test
258                 SCRATCH_DEV=/dev/sdc6
259                 SCRATCH_MNT=/mnt/scratch
260                 TAPE_DEV=/dev/st0
261                 RMT_TAPE_DEV=longhorn:/dev/tape
262                 # RMT_IRIXTAPE_DEV=longhorn:/dev/tape
263                 RMT_TAPE_USER=guest
264                 ;;
265             lab343)
266                 MODULAR=0
267                 EMAIL="hch@sgi.com"
268                 TEST_DEV=/dev/sdb1
269                 SCRATCH_DEV=/dev/sdb2
270                 SCRATCH_LOGDEV=/dev/sdb5
271                 SCRATCH_RTDEV=/dev/sdb6
272                 TEST_DIR=/qa/test
273                 SCRATCH_MNT=/qa/scratch
274                 ;;
275             dribble)
276                 MODULAR=0
277                 EMAIL="ajones@sgi.com"
278                 TEST_DIR=/mnt/test
279                 TEST_DEV=/dev/dsk/dks0d2s0
280                 #TEST_LOGDEV=
281                 SCRATCH_MNT=/mnt/scratch
282                 #SCRATCH_DEV=emu:/mnt/scratch
283                 SCRATCH_DEV=/dev/dsk/dks0d2s1
284                 #SCRATCH_LOGDEV=
285                 #SCRATCH_RTDEV=
286                 TAPE_DEV=/dev/tape
287                 RMT_TAPE_DEV=icy:/dev/st0
288                 RMT_TAPE_USER=guest
289                 #RMT_IRIXTAPE_DEV=snort:/dev/tape
290                 ;;
291             cxfsirix1)
292                 EMAIL="ajones@sgi.com"
293                 TEST_DIR=/mnt/xfs_test0
294                 TEST_DEV=/dev/cxvm/xfs_test0
295                 SCRATCH_MNT=/mnt/xfs_test1
296                 SCRATCH_DEV=/dev/cxvm/xfs_test1
297                 ;;
298             hammer)
299                 EMAIL="bnaujok@sgi.com"
300                 TEST_DIR=/mnt/xfs1
301                 TEST_DEV=/dev/sda5
302                 SCRATCH_MNT=/mnt/xfs2
303                 SCRATCH_DEV=/dev/sda6
304                 ;;
305             emu)
306                 MODULAR=0
307                 EMAIL="ajones@sgi.com"
308                 TEST_DIR=/mnt/test
309                 TEST_DEV=/dev/sdb1
310                 SCRATCH_MNT=/mnt/scratch
311                 SCRATCH_DEV=/dev/sdb2
312                 ;;
313             inferno)
314                 MODULAR=1
315                 EMAIL="ajones@sgi.com"
316                 TEST_DIR=/mnt/test
317                 TEST_DEV=/dev/sdb1
318                 TEST_LOGDEV=/dev/sdb3
319                 SCRATCH_MNT=/mnt/scratch
320                 SCRATCH_DEV=/dev/sdb2
321                 SCRATCH_LOGDEV=/dev/sdb4
322                 #SCRATCH_RTDEV=/dev/sdb5
323                 TAPE_DEV=/dev/st0
324                 #RMT_IRIXTAPE_DEV=snort:/dev/tape
325                 #RMT_TAPE_DEV=icy:/dev/st0
326                 #RMT_TAPE_USER=guest
327                 ;;
328             hellfire)
329                 MODULAR=1
330                 EMAIL="ajones@sgi.com"
331                 TEST_DIR=/mnt/test
332                 TEST_DEV=/dev/sda3
333                 TEST_LOGDEV=/dev/sda5
334                 SCRATCH_MNT=/mnt/scratch
335                 SCRATCH_DEV=/dev/sda4
336                 SCRATCH_LOGDEV=/dev/sda6
337                 #SCRATCH_RTDEV=/dev/sda7
338                 TAPE_DEV=/dev/st0
339                 #RMT_IRIXTAPE_DEV=snort:/dev/tape
340                 #RMT_TAPE_DEV=icy:/dev/st0
341                 #RMT_TAPE_USER=guest
342                 ;;
343             rooster)
344                 MODULAR=1
345                 EMAIL="ajones@sgi.com"
346                 TEST_DIR=/mnt/test
347                 TEST_DEV=/dev/sdb1
348                 SCRATCH_MNT=/mnt/scratch
349                 SCRATCH_DEV=/dev/sdb2
350                 TAPE_DEV=/dev/st0
351                 #RMT_IRIXTAPE_DEV=snort:/dev/tape
352                 #RMT_TAPE_DEV=icy:/dev/st0
353                 #RMT_TAPE_USER=guest
354                 ;;
355             rosella)
356                 MODULAR=1
357                 EMAIL="ajones@sgi.com"
358                 TEST_DIR=/mnt/test
359                 TEST_DEV=/dev/sdb1
360                 SCRATCH_MNT=/mnt/scratch
361                 SCRATCH_DEV=/dev/sdb3
362                 TAPE_DEV=/dev/st0
363                 #RMT_IRIXTAPE_DEV=snort:/dev/tape
364                 #RMT_TAPE_DEV=icy:/dev/st0
365                 #RMT_TAPE_USER=guest
366                 ;;
367             crackle)
368                 #irix-crackle
369                 TEST_DIR=/mnt/xfs
370                 SCRATCH_MNT=/mnt/xfs2
371                 TEST_DEV=/dev/dsk/dks0d1s3
372                 SCRATCH_DEV=/dev/dsk/dks0d1s4
373                 ;;
374             tinkle)
375                 #irix-patchbox-tinkle
376                 TEST_DEV=/dev/dsk/dks0d2s0
377                 TEST_DIR=/mnt/xfs_test
378                 SCRATCH_DEV=/dev/dsk/dks0d2s1
379                 SCRATCH_MNT=/mnt/xfs_scratch
380                 ;;
381             cocky)
382                 MODULAR=1
383                 EMAIL="ajones@sgi.com"
384                 TEST_DIR=/mnt/test
385                 TEST_DEV=/dev/sdb1
386                 TEST_LOGDEV=/dev/sdb3
387                 SCRATCH_MNT=/mnt/scratch
388                 SCRATCH_DEV=/dev/sdb2
389                 SCRATCH_LOGDEV=/dev/sdb4
390                 #SCRATCH_RTDEV=/dev/sdb5
391                 TAPE_DEV=/dev/st0
392                 #RMT_IRIXTAPE_DEV=snort:/dev/tape
393                 #RMT_TAPE_DEV=icy:/dev/st0
394                 #RMT_TAPE_USER=guest
395                 ;;
396             porky)
397                 MODULAR=1
398                 EMAIL="ajones@sgi.com"
399                 TEST_DIR=/mnt/test
400                 TEST_DEV=/dev/sdb2
401                 TEST_LOGDEV=/dev/sdb5
402                 SCRATCH_MNT=/mnt/scratch
403                 SCRATCH_DEV=/dev/sdb3
404                 SCRATCH_LOGDEV=/dev/sdb6
405                 #SCRATCH_RTDEV=/dev/sdb7
406                 TAPE_DEV=/dev/st0
407                 #RMT_IRIXTAPE_DEV=snort:/dev/tape
408                 #RMT_TAPE_DEV=icy:/dev/st0
409                 #RMT_TAPE_USER=guest
410                 ;;
411             puffy)
412                 MODULAR=1
413                 EMAIL="tes@sgi.com"
414                 TEST_DIR=/mnt/test
415                 TEST_DEV=/dev/sda7
416                 SCRATCH_MNT=/mnt/scratch
417                 SCRATCH_DEV=/dev/sda8
418                 TAPE_DEV=/dev/st0
419                 ;;
420             *)
421                 echo "Error: need to define parameters for host $HOST"
422                 exit 1
423                 ;;
424         esac
425 }
426
427 if [ -f "$HOST_OPTIONS" ]; then
428     . "$HOST_OPTIONS"
429 else
430     known_hosts
431 fi
432
433 echo $TEST_DEV | grep -q ":" > /dev/null 2>&1
434 if [ ! -b "$TEST_DEV" -a "$?" != "0" ]
435 then
436     echo "common.config: Error: \$TEST_DEV ($TEST_DEV) is not a block device or a NFS filesystem"
437     exit 1
438 fi
439
440 if [ ! -d "$TEST_DIR" ]
441 then
442     echo "common.config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
443     exit 1
444 fi
445
446 echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
447 if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]
448 then
449     echo "common.config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) is not a block device or a NFS filesystem"
450     exit 1
451 fi
452
453 if [ ! -z "$SCRATCH_MNT" -a ! -d "$SCRATCH_MNT" ]
454 then
455     echo "common.config: Error: \$SCRATCH_MNT ($SCRATCH_MNT) is not a directory"
456     exit 1
457 fi
458
459 _readlink()
460 {
461     if [ $# -ne 1 ]
462     then
463         echo "Usage: _readlink filename" 1>&2
464         exit 1
465     fi
466
467     perl -e "\$in=\"$1\";" -e '
468         $lnk = readlink($in);
469         if ($lnk =~ m!^/.*!) {
470           print "$lnk\n";
471         }
472         else {
473           chomp($dir = `dirname $in`);
474           print "$dir/$lnk\n";
475         }'
476 }
477
478 # if devfs is running expand the full /dev/.. pathname - this is what will be
479 # returned by utilities such as mount
480 [ -L "$TEST_DEV" ] && TEST_DEV=`_readlink $TEST_DEV`
481 [ -L "$SCRATCH_DEV" ] && SCRATCH_DEV=`_readlink $SCRATCH_DEV`
482 [ -L "$SCRATCH_LOGDEV" ] && SCRATCH_LOGDEV=`_readlink $SCRATCH_LOGDEV`
483 [ -L "$SCRATCH_RTDEV" ] && SCRATCH_RTDEV=`_readlink $SCRATCH_LOGDEV`
484
485 # make sure this script returns success
486 /bin/true