3 # Copyright (c) 2000-2003,2006 Silicon Graphics, Inc. All Rights Reserved.
5 # setup and check for config parameters, and in particular
7 # EMAIL - email of the script runner.
8 # TEST_DIR - scratch test directory that is in an already
9 # mounted XFS file system, needs to be be world
11 # TEST_DEV - device for file system containing TEST_DIR
12 # SCRATCH_DEV - device you can make a scratch file system on
13 # SCRATCH_MNT - mount point for scratch file system
16 # SCRATCH_LOGDEV - scratch log device for external log testing
17 # SCRATCH_RTDEV - scratch rt dev
18 # TEST_LOGDEV - test log device for external log testing
19 # TEST_RTDEV - test rt dev
20 # TAPE_DEV - the tape device for the xfsdump tests
21 # RMT_TAPE_DEV - the remote tape device for the xfsdump tests
22 # RMT_IRIXTAPE_DEV- the IRIX remote tape device for the xfsdump tests
23 # RMT_TAPE_USER - remote user for tape device
25 # - These can be added to $HOST_CONFIG_DIR (witch default to ./config)
26 # below or a separate local configuration file can be used (using
27 # the HOST_OPTIONS variable).
28 # - This script is shared by the stress test system and the auto-qa
29 # system (includes both regression test and benchmark components).
30 # - TEST_DEV & TEST_DIR must be assigned.
31 # - this script shouldn't make any assertions about filesystem
32 # validity or mountedness.
35 # Warning: don't put freeware before /usr/bsd on IRIX coz you'll
36 # get the wrong hostname and set your system name to -s :)
37 [ -d /usr/bsd ] && PATH=$PATH:/usr/bsd
38 [ -d /usr/freeware/bin ] && PATH=$PATH:/usr/freeware/bin
43 [ "$HOSTOS" = "IRIX64" ] && HOSTOS="IRIX"
45 MODULAR=0 # using XFS as a module or not
46 BOOT="/boot" # install target for kernels
47 export EXTRA=${EXTRA:=xfs-qa}
49 # general parameters (mainly for auto-qa)
50 SOAK_PROC=3 # -p option to fsstress
51 SOAK_STRESS=10000 # -n option to fsstress
52 SOAK_PASSES=-1 # count of repetitions of fsstress (while soaking)
53 EMAIL=root@localhost # where auto-qa will send its status messages
54 export HOST_OPTIONS=${HOST_OPTIONS:=local.config}
55 export CHECK_OPTIONS=${CHECK_OPTIONS:="-g auto"}
56 export BENCH_PASSES=${BENCH_PASSES:=5}
57 export XFS_MKFS_OPTIONS=${XFS_MKFS_OPTIONS:=-bsize=4096}
60 #export DEBUG=${DEBUG:=...} # arbitrary CFLAGS really.
61 export MALLOCLIB=${MALLOCLIB:=/usr/lib/libefence.a}
62 export LOCAL_CONFIGURE_OPTIONS=${LOCAL_CONFIGURE_OPTIONS:=--enable-readline=yes}
64 # $1 = prog to look for, $2* = default pathnames if not found in $PATH
67 p=`which $1 2> /dev/null`
68 if [ -n "$p" -a -x "$p" ]; then
93 export MKFS_PROG="`set_prog_path mkfs`"
94 [ "$MKFS_PROG" = "" ] && _fatal "mkfs not found"
96 export MOUNT_PROG="`set_prog_path mount`"
97 [ "$MOUNT_PROG" = "" ] && _fatal "mount not found"
99 export UMOUNT_PROG="`set_prog_path umount`"
100 [ "$UMOUNT_PROG" = "" ] && _fatal "umount not found"
102 export FSSTRESS_PROG="`set_prog_path fsstress $PWD/ltp/fsstress`"
103 [ "$FSSTRESS_PROG" = "" ] && _fatal "fsstress not found"
105 export NSLOOKUP_PROG="`set_prog_path nslookup`"
106 [ "$NSLOOKUP_PROG" = "" ] && _fatal "nslookup not found"
108 export PERL_PROG="`set_prog_path perl`"
109 [ "$PERL_PROG" = "" ] && _fatal "perl not found"
111 export AWK_PROG="`set_prog_path awk`"
112 [ "$AWK_PROG" = "" ] && _fatal "awk not found"
114 export SED_PROG="`set_prog_path sed`"
115 [ "$SED_PROG" = "" ] && _fatal "sed not found"
117 export PS_ALL_FLAGS="-ef"
119 export DF_PROG="`set_prog_path df`"
120 [ "$DF_PROG" = "" ] && _fatal "df not found"
121 [ "$HOSTOS" = "Linux" ] && export DF_PROG="$DF_PROG -T"
123 export XFS_LOGPRINT_PROG="`set_prog_path xfs_logprint`"
124 export XFS_REPAIR_PROG="`set_prog_path xfs_repair`"
125 export XFS_CHECK_PROG="`set_prog_path xfs_check`"
126 export XFS_DB_PROG="`set_prog_path xfs_db`"
127 export XFS_GROWFS_PROG=`set_prog_path xfs_growfs`
128 export XFS_IO_PROG="`set_prog_path xfs_io`"
129 export XFS_PARALLEL_REPAIR_PROG="`set_prog_path xfs_prepair`"
130 export XFS_PARALLEL_REPAIR64_PROG="`set_prog_path xfs_prepair64`"
134 export MKFS_XFS_PROG="`set_prog_path mkfs_xfs`"
135 export MKFS_UDF_PROG="`set_prog_path mkfs_udf`"
136 export XFS_FSR_PROG="`set_prog_path /usr/etc/fsr_xfs`"
137 export MKFS_NFS_PROG="false"
140 export MKFS_XFS_PROG="`set_prog_path mkfs.xfs`"
141 export MKFS_UDF_PROG="`set_prog_path mkudffs`"
142 export XFS_FSR_PROG="`set_prog_path xfs_fsr`"
143 export MKFS_NFS_PROG="false"
149 [ "$HOST_CONFIG_DIR" ] || HOST_CONFIG_DIR=`pwd`/configs
151 [ -f /etc/xfsqa.config ] && . /etc/xfsqa.config
152 [ -f $HOST_CONFIG_DIR/$HOST ] && . $HOST_CONFIG_DIR/$HOST
153 [ -f $HOST_CONFIG_DIR/$HOST.config ] && . $HOST_CONFIG_DIR/$HOST.config
156 # Non-Mandatory Config values.
157 # [ -z "$MODULAR" ] && MC="$MC MODULAR"
158 # [ -z "$TEST_LOGDEV" ] && MC="$MC TEST_LOGDEV"
159 # [ -z "$SCRATCH_LOGDEV" ] && MC="$MC SCRATCH_LOGDEV"
160 # [ -z "$SCRATCH_RTDEV" ] && MC="$MC SCRATCH_RTDEV"
162 [ -z "$EMAIL" ] && MC="$MC EMAIL"
163 [ -z "$TEST_DIR" ] && MC="$MC TEST_DIR"
164 [ -z "$TEST_DEV" ] && MC="$MC TEST_DEV"
166 [ -z "$SCRATCH_MNT" ] && MC="$MC SCRATCH_MNT"
167 [ -z "$SCRATCH_DEV" ] && MC="$MC SCRATCH_DEV"
169 [ "$MC" ] && (echo "Warning: need to define parameters for host $HOST";\
170 echo " or set variables:"; \
172 # if [ -e configs/$HOST.config ]
173 # then echo "Not carring, we have a configfile ($HOST_CONFIG_DIR/$HOST)"
179 if [ -f "$HOST_OPTIONS" ]; then
185 echo $TEST_DEV | grep -q ":" > /dev/null 2>&1
186 if [ ! -b "$TEST_DEV" -a "$?" != "0" ]; then
187 echo "common.config: Error: \$TEST_DEV ($TEST_DEV) is not a block device or a NFS filesystem"
191 if [ ! -d "$TEST_DIR" ]; then
192 echo "common.config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
196 echo $SCRATCH_DEV | grep -q ":" > /dev/null 2>&1
197 if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" -a "$?" != "0" ]; then
198 echo "common.config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) is not a block device or a NFS filesystem"
202 if [ ! -z "$SCRATCH_MNT" -a ! -d "$SCRATCH_MNT" ]; then
203 echo "common.config: Error: \$SCRATCH_MNT ($SCRATCH_MNT) is not a directory"
209 if [ $# -ne 1 ]; then
210 echo "Usage: _readlink filename" 1>&2
214 perl -e "\$in=\"$1\";" -e '
215 $lnk = readlink($in);
216 if ($lnk =~ m!^/.*!) {
220 chomp($dir = `dirname $in`);
225 # if devfs is running expand the full /dev/.. pathname - this is what will be
226 # returned by utilities such as mount
227 [ -L "$TEST_DEV" ] && TEST_DEV=`_readlink $TEST_DEV`
228 [ -L "$SCRATCH_DEV" ] && SCRATCH_DEV=`_readlink $SCRATCH_DEV`
229 [ -L "$SCRATCH_LOGDEV" ] && SCRATCH_LOGDEV=`_readlink $SCRATCH_LOGDEV`
230 [ -L "$SCRATCH_RTDEV" ] && SCRATCH_RTDEV=`_readlink $SCRATCH_LOGDEV`
232 # make sure this script returns success