minor porting issue wrt versions of touch cmd.
[xfstests-dev.git] / common.config
1 ##/bin/sh
2
3 #
4 # Copyright (c) 2000 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 (only for testing cmds currently)
48 # TAPE_DEV              - the tape device for the xfsdump tests
49 # RMT_TAPE_DEV          - the remote tape device for the xfsdump tests
50 # RMT_IRIXTAPE_DEV      - the IRIX remote tape device for the xfsdump tests
51 #
52
53 #
54 # - This script is shared by the stress test system and the auto-qa
55 #   system
56 # - TEST_DEV & TEST_DIR must be assigned.
57 # - this script shouldn't make any assertions about filesystem
58 #   validity or mountedness.
59 #
60
61 _readlink()
62 {
63     if [ $# -ne 1 ]
64     then
65         echo "Usage: _readlink filename" 1>&2
66         exit 1
67     fi
68
69     perl -e "\$in=\"$1\";" -e '
70         $lnk = readlink($in);
71         if ($lnk =~ m!^/.*!) {
72           print "$lnk\n";
73         }
74         else {
75           chomp($dir = `dirname $in`);
76           print "$dir/$lnk\n";
77         }'
78 }
79
80
81 case `hostname -s`
82 in
83     fuzzy)
84         TEST_DEV=/dev/sda6
85         TEST_DIR=/mnt/xfs1
86         SCRATCH_DEV=/dev/sda5
87         SCRATCH_MNT=/mnt/xfs0
88         SCRATCH_LOGDEV=/dev/sda7
89         ;;
90     bruce)
91         TEST_DEV=/dev/sda10
92         TEST_DIR=/mnt/xfs1
93         SCRATCH_DEV=/dev/sda9
94         SCRATCH_MNT=/mnt/xfs0
95         SCRATCH_LOGDEV=/dev/sda11
96         TAPE_DEV=/dev/st0
97         RMT_TAPE_DEV=bruce:/dev/st0
98         RMT_IRIXTAPE_DEV=snort:/dev/tape
99         ;;
100     sherman)
101         TEST_DEV=/dev/sda10
102         TEST_DIR=/mnt/xfs1
103         SCRATCH_DEV=/dev/sda9
104         SCRATCH_MNT=/mnt/xfs0
105         ;;
106     sagan)
107         TEST_DEV=/dev/sda6
108         TEST_DIR=/mnt/xfs0
109         SCRATCH_DEV=/dev/sda7
110         SCRATCH_MNT=/mnt/xfs1
111         TAPE_DEV=/dev/st0
112         RMT_TAPE_DEV=sagan:/dev/st0
113         RMT_IRIXTAPE_DEV=snort:/dev/tape
114         ;;
115     leesa)
116         TEST_DEV=/dev/xfs_test
117         TEST_DIR=/mnt/xfs_test
118         SCRATCH_DEV=/dev/xfs_scratch
119         SCRATCH_MNT=/mnt/xfs_scratch
120         SCRATCH_LOGDEV=/dev/xfs_log
121         ;;
122     troppo)
123         TEST_DEV=/dev/hdb6
124         TEST_DIR=/mnt/test
125         SCRATCH_DEV=/dev/hdb7
126         SCRATCH_MNT=/mnt/scratch
127         SCRATCH_LOGDEV=/dev/hdb9
128         SCRATCH_RTDEV=/dev/hdb10
129         ;;
130     lord)
131         TEST_DIR=/xfs
132         TEST_DEV=/dev/sda4
133         SCRATCH_DEV=/dev/hda2
134         SCRATCH_MNT=/xfs1
135         ;;
136     lumpy)
137         TEST_DEV=/dev/sdc5
138         TEST_DIR=/mnt/scratch_0
139         SCRATCH_DEV=/dev/sdc7
140         SCRATCH_MNT=/mnt/scratch_2
141         ;;
142     bongo)
143         TEST_DEV=/dev/hda8
144         TEST_DIR=/xfs1
145         SCRATCH_DEV=/dev/hda9
146         SCRATCH_MNT=/xfs2
147         SCRATCH_LOGDEV=/dev/hda10
148         SCRATCH_RTDEV=/dev/hda11
149         ;;
150
151     *)
152         echo "common.config: Error: need to define parameters for host `hostname -s`"
153         exit 1
154         ;;
155 esac
156
157 if [ ! -b "$TEST_DEV" ]
158 then
159     echo "common.config: Error: \$TEST_DEV ($TEST_DEV) is not a block device"
160     exit 1
161 fi
162
163 if [ ! -d "$TEST_DIR" ]
164 then
165     echo "common.config: Error: \$TEST_DIR ($TEST_DIR) is not a directory"
166     exit 1
167 fi
168
169 if [ ! -z "$SCRATCH_DEV" -a ! -b "$SCRATCH_DEV" ]
170 then
171     echo "common.config: Error: \$SCRATCH_DEV ($SCRATCH_DEV) is not a block device"
172     exit 1
173 fi
174
175 if [ ! -z "$SCRATCH_DEV" -a ! -d "$SCRATCH_MNT" ]
176 then
177     echo "common.config: Error: \$SCRATCH_MNT ($SCRATCH_MNT) is not a directory"
178     exit 1
179 fi
180
181 # if devfs is running expand the full /dev/.. pathname - this is what will be
182 # returned by utilities such as mount
183 [ -L "$TEST_DEV" ] && TEST_DEV=`_readlink $TEST_DEV`
184 [ -L "$SCRATCH_DEV" ] && SCRATCH_DEV=`_readlink $SCRATCH_DEV`
185 [ -L "$SCRATCH_LOGDEV" ] && SCRATCH_LOGDEV=`_readlink $SCRATCH_LOGDEV`
186 [ -L "$SCRATCH_RTDEV" ] && SCRATCH_RTDEV=`_readlink $SCRATCH_LOGDEV`
187
188 # make sure this script returns success
189 /bin/true