aed2a91828e05f2db39ca393df919eab83511a4f
[xfstests-dev.git] / common.config
1 ##/bin/sh
2 #
3 # Copyright (c) 2000-2003,2006 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 export XFS_PARALLEL_REPAIR_PROG="`set_prog_path xfs_prepair`"
131 export XFS_PARALLEL_REPAIR64_PROG="`set_prog_path xfs_prepair64`"
132
133 case "$HOSTOS" in
134     IRIX*)
135            export MKFS_XFS_PROG="`set_prog_path mkfs_xfs`"
136            export MKFS_UDF_PROG="`set_prog_path mkfs_udf`"
137            export XFS_FSR_PROG="`set_prog_path /usr/etc/fsr_xfs`"
138            export MKFS_NFS_PROG="false"
139            ;;
140     Linux)
141            export MKFS_XFS_PROG="`set_prog_path mkfs.xfs`"
142            export MKFS_UDF_PROG="`set_prog_path mkudffs`"
143            export XFS_FSR_PROG="`set_prog_path xfs_fsr`"
144            export MKFS_NFS_PROG="false"
145            ;;
146 esac
147
148 known_hosts()
149 {
150         case "$HOST"
151         in
152             sheila)
153                 #dedicated qa machine (has some values already set)
154                 [ -z "$MODULAR" ] && MODULAR=1
155                 EMAIL="nathans@larry"
156                 [ -z "$SCRATCH_MNT" ] && SCRATCH_MNT=/mnt/scratch
157                 [ -z "$SCRATCH_DEV" ] && SCRATCH_DEV=/dev/hdb1
158                 [ -z "$TEST_DIR" ] && TEST_DIR=/mnt/test
159                 [ -z "$TEST_DEV" ] && TEST_DEV=/dev/hdb2
160                 [ -z "$TEST_LOGDEV" ] && TEST_LOGDEV=/dev/hdb3
161                 [ -z "$SCRATCH_LOGDEV" ] && SCRATCH_LOGDEV=/dev/hdb5
162                 ;;
163             break)
164                 MODULAR=1
165                 EMAIL="nathans@larry"
166                 SCRATCH_MNT=/mnt/scratch
167                 #SCRATCH_DEV=/dev/sda6
168                 SCRATCH_DEV=budgie:/mnt/scratch
169                 TEST_DIR=/mnt/test
170                 #TEST_DEV=/dev/sda5
171                 TEST_DEV=budgie:/mnt/test
172                 ;;
173             bruce)
174                 MODULAR=0
175                 EMAIL="nathans@larry"
176                 SCRATCH_MNT=/mnt/scratch
177                 SCRATCH_DEV=/dev/sdb5
178                 SCRATCH_RTDEV=/dev/sdc1
179                 SCRATCH_LOGDEV=/dev/ram0
180                 TEST_DIR=/mnt/test
181                 TEST_DEV=/dev/sdc3
182                 TEST_RTDEV=/dev/sdb6
183                 TEST_LOGDEV=/dev/ram1
184                 #TAPE_DEV=/dev/st0
185                 #RMT_TAPE_DEV=bruce:/dev/st0
186                 #RMT_IRIXTAPE_DEV=snort:/dev/tape
187                 #RMT_TAPE_USER=guest
188                 ;;
189             frodo)
190                 MODULAR=0
191                 EMAIL="nathans@larry"
192                 TEST_DEV=/dev/hda6
193                 TEST_DIR=/mnt/test
194                 SCRATCH_DEV=/dev/hda7
195                 SCRATCH_MNT=/mnt/scratch
196                 SCRATCH_LOGDEV=/dev/hda9
197                 ;;
198             goldfish)
199                 MODULAR=0
200                 TEST_DEV=/dev/hdc1
201                 TEST_DIR=/mnt/xfs0
202                 SCRATCH_DEV=/dev/hdc2
203                 SCRATCH_MNT=/mnt/xfs1
204                 SCRATCH_LOGDEV=/dev/hdc3
205                 ;;
206             burst)
207                 TEST_DIR=/xfs
208                 TEST_DEV=/dev/hda3
209                 SCRATCH_DEV=/dev/hda7
210                 SCRATCH_MNT=/scratch
211                 ;;
212             lumpy)
213                 TEST_DEV=/dev/sdc5
214                 TEST_DIR=/mnt/scratch_0
215                 SCRATCH_DEV=/dev/sdc7
216                 SCRATCH_MNT=/mnt/scratch_2
217                 ;;
218             bongo)
219                 TEST_DEV=/dev/hda8
220                 TEST_DIR=/xfs1
221                 SCRATCH_DEV=/dev/hda9
222                 SCRATCH_MNT=/xfs2
223                 SCRATCH_LOGDEV=/dev/hda10
224                 SCRATCH_RTDEV=/dev/hda11
225                 ;;
226             surly)
227                 TEST_DEV=/dev/hda9
228                 TEST_DIR=/mnt/xfs1
229                 SCRATCH_DEV=/dev/hda8
230                 SCRATCH_MNT=/mnt/xfs0
231                 SCRATCH_LOGDEV=/dev/hda10
232                 TAPE_DEV=/dev/st0
233                 RMT_TAPE_DEV=fuzzy:/dev/st0
234                 RMT_IRIXTAPE_DEV=blub:/dev/tape
235                 RMT_TAPE_USER=guest
236                 ;;
237             permit)
238                 TEST_DEV=/dev/sdc1
239                 TEST_DIR=/mnt/xfs0
240                 SCRATCH_DEV=/dev/sdd1
241                 SCRATCH_MNT=/mnt/xfs1
242                 ;;
243             indra)
244                 TEST_DEV=/dev/sdb1
245                 TEST_DIR=/mnt/xfs0
246                 SCRATCH_DEV=/dev/sdb2
247                 SCRATCH_MNT=/mnt/xfs1
248                 ;;
249             usermode)
250                 TEST_DEV=/dev/ubd/1
251                 TEST_DIR=/mnt/test
252                 SCRATCH_DEV=/dev/ubd/2
253                 SCRATCH_MNT=/mnt/scratch
254                 SCRATCH_RTDEV=/dev/ubd/3
255                 SCRATCH_LOGDEV=/dev/ubd/4
256                 ;;
257             lite)
258                 TEST_DEV=/dev/sda1
259                 TEST_DIR=/mnt/sda1
260                 SCRATCH_DEV=/dev/sda2
261                 SCRATCH_MNT=/mnt/sda2
262                 SCRATCH_LOGDEV=/dev/sda3
263                 SCRATCH_RTDEV=/dev/sda4
264                 ;;
265             dmfnt2)
266                 TEST_DEV=/dev/sda6
267                 TEST_DIR=/mnt/test
268                 SCRATCH_DEV=/dev/sdc6
269                 SCRATCH_MNT=/mnt/scratch
270                 TAPE_DEV=/dev/st0
271                 RMT_TAPE_DEV=longhorn:/dev/tape
272                 # RMT_IRIXTAPE_DEV=longhorn:/dev/tape
273                 RMT_TAPE_USER=guest
274                 ;;
275             lab343)
276                 MODULAR=0
277                 EMAIL="hch@sgi.com"
278                 TEST_DEV=/dev/sdb1
279                 SCRATCH_DEV=/dev/sdb2
280                 SCRATCH_LOGDEV=/dev/sdb5
281                 SCRATCH_RTDEV=/dev/sdb6
282                 TEST_DIR=/qa/test
283                 SCRATCH_MNT=/qa/scratch
284                 ;;
285             dribble)
286                 #dedicated qa machine
287                 MODULAR=0
288                 EMAIL="ddiss@sgi.com"
289                 TEST_DIR=/mnt/test
290                 TEST_DEV=/dev/dsk/dks0d2s0
291                 SCRATCH_MNT=/mnt/scratch
292                 SCRATCH_DEV=/dev/dsk/dks0d2s6
293                 #TAPE_DEV=/dev/tape
294                 #RMT_TAPE_DEV=icy:/dev/st0
295                 #RMT_TAPE_USER=guest
296                 ;;
297              giro)
298                 MODULAR=0
299                 EMAIL="ddiss@sgi.com"
300                 TEST_DIR=/mnt/test
301                 TEST_DEV=/dev/dsk/dks0d2s0
302                 SCRATCH_MNT=/mnt/scratch
303                 SCRATCH_DEV=/dev/dsk/dks0d2s6
304                 #TAPE_DEV=/dev/tape
305                 #RMT_TAPE_DEV=icy:/dev/st0
306                 #RMT_TAPE_USER=guest
307                 ;;
308             cxfsirix1)
309                 EMAIL="ajones@sgi.com"
310                 TEST_DIR=/mnt/xfs_test0
311                 TEST_DEV=/dev/cxvm/xfs_test0
312                 SCRATCH_MNT=/mnt/xfs_test1
313                 SCRATCH_DEV=/dev/cxvm/xfs_test1
314                 ;;
315             hammer)
316                 EMAIL="bnaujok@sgi.com"
317                 TEST_DIR=/mnt/test
318                 TEST_DEV=/dev/sda5
319                 SCRATCH_MNT=/mnt/scratch
320                 SCRATCH_DEV=/dev/sda6
321                 ;;
322             emu)
323                 MODULAR=0
324                 EMAIL="vapo@sgi.com"
325                 TEST_DIR=/mnt/test
326                 TEST_DEV=/dev/sdb1
327                 SCRATCH_MNT=/mnt/scratch1
328                 SCRATCH_DEV=/dev/sdb2
329                 ;;
330             scaly)
331                 EMAIL="bnaujok@sgi.com"
332                 TEST_DIR=/mnt/test
333                 TEST_DEV=/dev/sdd3
334                 #TEST_LOGDEV=/dev/sdd1
335                 SCRATCH_MNT=/mnt/scratch
336                 SCRATCH_DEV=/dev/sdd4
337                 #SCRATCH_LOGDEV=/dev/sdd2
338                 ;;
339             inferno)
340                 #dedicated qa machine (has some values already set)
341                 [ -z "$MODULAR" ] && MODULAR=1
342                 EMAIL="ajones@sgi.com"
343                 [ -z "$TEST_DIR" ] && TEST_DIR=/mnt/test
344                 [ -z "$TEST_DEV" ] && TEST_DEV=/dev/sdb1
345                 [ -z "$TEST_LOGDEV" ] && TEST_LOGDEV=/dev/ram0
346                 [ -z "$SCRATCH_MNT" ] && SCRATCH_MNT=/mnt/scratch
347                 [ -z "$SCRATCH_DEV" ] && SCRATCH_DEV=/dev/sdb2
348                 [ -z "$SCRATCH_LOGDEV" ] && SCRATCH_LOGDEV=/dev/ram1
349                 #[ -z "$SCRATCH_RTDEV" ] && SCRATCH_RTDEV=/dev/sdb5
350                 [ -z "$TAPE_DEV" ] && TAPE_DEV=/dev/st0
351                 ;;
352             hellfire)
353                 MODULAR=1
354                 EMAIL="ajones@sgi.com"
355                 TEST_DIR=/mnt/test
356                 TEST_DEV=/dev/sda3
357                 TEST_LOGDEV=/dev/sda5
358                 SCRATCH_MNT=/mnt/scratch
359                 SCRATCH_DEV=/dev/sda4
360                 SCRATCH_LOGDEV=/dev/sda6
361                 #SCRATCH_RTDEV=/dev/sda7
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             rooster)
368                 MODULAR=1
369                 EMAIL="ajones@sgi.com"
370                 TEST_DIR=/mnt/test
371                 TEST_DEV=/dev/sdb1
372                 SCRATCH_MNT=/mnt/scratch
373                 SCRATCH_DEV=/dev/sdb2
374                 TAPE_DEV=/dev/st0
375                 #RMT_IRIXTAPE_DEV=snort:/dev/tape
376                 #RMT_TAPE_DEV=icy:/dev/st0
377                 #RMT_TAPE_USER=guest
378                 ;;
379             rosella)
380                 MODULAR=1
381                 EMAIL="ajones@sgi.com"
382                 TEST_DIR=/mnt/test
383                 TEST_DEV=/dev/sdb1
384                 SCRATCH_MNT=/mnt/scratch
385                 SCRATCH_DEV=/dev/sdb3
386                 TAPE_DEV=/dev/st0
387                 #RMT_IRIXTAPE_DEV=snort:/dev/tape
388                 #RMT_TAPE_DEV=icy:/dev/st0
389                 #RMT_TAPE_USER=guest
390                 ;;
391             crackle)
392                 #irix-crackle
393                 TEST_DIR=/mnt/xfs
394                 SCRATCH_MNT=/mnt/xfs2
395                 TEST_DEV=/dev/dsk/dks0d1s3
396                 SCRATCH_DEV=/dev/dsk/dks0d1s4
397                 ;;
398             tinkle)
399                 #irix-patchbox-tinkle
400                 TEST_DEV=/dev/dsk/dks0d2s0
401                 TEST_DIR=/mnt/xfs_test
402                 SCRATCH_DEV=/dev/dsk/dks0d2s1
403                 SCRATCH_MNT=/mnt/xfs_scratch
404                 ;;
405             cocky)
406                 MODULAR=1
407                 EMAIL="ajones@sgi.com"
408                 TEST_DIR=/mnt/test
409                 TEST_DEV=/dev/sdb1
410                 TEST_LOGDEV=/dev/sdb3
411                 SCRATCH_MNT=/mnt/scratch
412                 SCRATCH_DEV=/dev/sdb2
413                 SCRATCH_LOGDEV=/dev/sdb4
414                 #SCRATCH_RTDEV=/dev/sdb5
415                 TAPE_DEV=/dev/st0
416                 #RMT_IRIXTAPE_DEV=snort:/dev/tape
417                 #RMT_TAPE_DEV=icy:/dev/st0
418                 #RMT_TAPE_USER=guest
419                 ;;
420             porky)
421                 #dedicated qa machine (has some values already set)
422                 [ -z "$MODULAR" ] && MODULAR=1
423                 EMAIL="ajones@sgi.com"
424                 [ -z "$TEST_DIR" ] && TEST_DIR=/mnt/test
425                 [ -z "$TEST_DEV" ] && TEST_DEV=/dev/sdb1
426                 [ -z "$TEST_LOGDEV" ] && TEST_LOGDEV=/dev/sdb3
427                 [ -z "$SCRATCH_MNT" ] && SCRATCH_MNT=/mnt/scratch
428                 [ -z "$SCRATCH_DEV" ] && SCRATCH_DEV=/dev/sdb2
429                 [ -z "$SCRATCH_LOGDEV" ] && SCRATCH_LOGDEV=/dev/sdb4
430                 #[ -z "$SCRATCH_RTDEV" ] && SCRATCH_RTDEV=/dev/sdb7
431                 #[ -z "$TAPE_DEV" ] && TAPE_DEV=/dev/st0
432                 ;;
433             puffy)
434                 MODULAR=1
435                 EMAIL="tes@sgi.com"
436                 TEST_DIR=/mnt/test
437                 TEST_DEV=/dev/sda7
438                 SCRATCH_MNT=/mnt/scratch
439                 SCRATCH_DEV=/dev/sda8
440                 TAPE_DEV=/dev/st0
441                 ;;
442             galah)
443                 MODULAR=1
444                 EMAIL="ddiss@sgi.com"
445                 TEST_DIR=/mnt/data
446                 TEST_DEV=/dev/sdb1
447                 SCRATCH_MNT=/mnt/scratch
448                 SCRATCH_DEV=/dev/sda6
449                 #RMT_IRIXTAPE_DEV=snort:/dev/tape
450                 #RMT_TAPE_DEV=icy:/dev/st0
451                 #RMT_TAPE_USER=guest
452                 ;;
453              screamer)
454                 #dedicated qa machine (has some values already set)
455                 [ -z "$MODULAR" ] && MODULAR=1
456                 EMAIL="ddiss@sgi.com"
457                 [ -z "$TEST_DIR" ] && TEST_DIR=/mnt/test
458                 [ -z "$TEST_DEV" ] && TEST_DEV=/dev/sdb1
459                 #[ -z "$TEST_LOGDEV" ] && TEST_LOGDEV=/dev/sdb3
460                 [ -z "$SCRATCH_MNT" ] && SCRATCH_MNT=/mnt/scratch
461                 [ -z "$SCRATCH_DEV" ] && SCRATCH_DEV=/dev/sdb2
462                 #[ -z "$SCRATCH_LOGDEV" ] && SCRATCH_LOGDEV=/dev/sdb4
463                 #[ -z "$SCRATCH_RTDEV" ] && SCRATCH_RTDEV=/dev/sdb5
464                 ;;
465              linux-chatz)
466                 #vmware on pc-chatz
467                 MODULAR=1
468                 EMAIL="chatz@sgi.com"
469                 USE_EXTERNAL=yes
470                 TEST_DIR="/mnt/data"
471                 TEST_DEV=/dev/sdd
472                 TEST_LOGDEV=/dev/sdb
473                 SCRATCH_MNT=/mnt/scratch
474                 SCRATCH_DEV=/dev/sdg
475                 SCRATCH_LOGDEV=/mnt/sde
476                 ;;
477              chapter11)
478                 [ -z "$MODULAR" ] && MODULAR=1
479                 EMAIL="ddiss@sgi.com"
480                 [ -z "$TEST_DIR" ] && TEST_DIR=/mnt/test
481                 [ -z "$TEST_DEV" ] && TEST_DEV=/dev/sdb6
482                 [ -z "$SCRATCH_MNT" ] && SCRATCH_MNT=/mnt/scratch
483                 [ -z "$SCRATCH_DEV" ] && SCRATCH_DEV=/dev/sdb7
484                 ;;
485              dassi)
486                 MODULAR=0
487                 EMAIL="ddiss@sgi.com"
488                 TEST_DIR=/mnt/test
489                 TEST_DEV=/dev/dsk/dks0d2s0
490                 SCRATCH_MNT=/mnt/scratch
491                 SCRATCH_DEV=/dev/dsk/dks0d2s6
492                 ;;
493              molten)
494                 [ -z "$MODULAR" ] && MODULAR=1
495                 EMAIL="ddiss@sgi.com"
496                 [ -z "$TEST_DIR" ] && TEST_DIR=/mnt/test
497                 [ -z "$TEST_DEV" ] && TEST_DEV=/dev/sdb5
498                 [ -z "$SCRATCH_MNT" ] && SCRATCH_MNT=/mnt/scratch
499                 [ -z "$SCRATCH_DEV" ] && SCRATCH_DEV=/dev/sdb6
500                 ;;
501              *)
502                 echo "Error: need to define parameters for host $HOST"
503                 exit 1
504                 ;;
505         esac
506 }
507
508 if [ -f "$HOST_OPTIONS" ]; then
509     . "$HOST_OPTIONS"
510 else
511     known_hosts
512 fi
513
514 echo $TEST_DEV | grep -q ":" > /dev/null 2>&1
515 if [ ! -b "$TEST_DEV" -a "$?" != "0" ]
516 then
517     echo "common.config: Error: \$TEST_DEV ($TEST_DEV) is not a block device or a NFS filesystem"
518     exit 1
519 fi
520
521 if [ ! -d "$TEST_DIR" ]
522 then
523     echo "common.config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
524     exit 1
525 fi
526
527 echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
528 if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]
529 then
530     echo "common.config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) is not a block device or a NFS filesystem"
531     exit 1
532 fi
533
534 if [ ! -z "$SCRATCH_MNT" -a ! -d "$SCRATCH_MNT" ]
535 then
536     echo "common.config: Error: \$SCRATCH_MNT ($SCRATCH_MNT) is not a directory"
537     exit 1
538 fi
539
540 _readlink()
541 {
542     if [ $# -ne 1 ]
543     then
544         echo "Usage: _readlink filename" 1>&2
545         exit 1
546     fi
547
548     perl -e "\$in=\"$1\";" -e '
549         $lnk = readlink($in);
550         if ($lnk =~ m!^/.*!) {
551           print "$lnk\n";
552         }
553         else {
554           chomp($dir = `dirname $in`);
555           print "$dir/$lnk\n";
556         }'
557 }
558
559 # if devfs is running expand the full /dev/.. pathname - this is what will be
560 # returned by utilities such as mount
561 [ -L "$TEST_DEV" ] && TEST_DEV=`_readlink $TEST_DEV`
562 [ -L "$SCRATCH_DEV" ] && SCRATCH_DEV=`_readlink $SCRATCH_DEV`
563 [ -L "$SCRATCH_LOGDEV" ] && SCRATCH_LOGDEV=`_readlink $SCRATCH_LOGDEV`
564 [ -L "$SCRATCH_RTDEV" ] && SCRATCH_RTDEV=`_readlink $SCRATCH_LOGDEV`
565
566 # make sure this script returns success
567 /bin/true