eb37d80abe48dd61959d60bca39e6c9e48fd5158
[xfstests-dev.git] / setup
1 #!/bin/bash
2 #
3 # Copyright (c) 2003-2004 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms 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,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write the Free Software Foundation,
16 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 #
18 usage()
19 {
20
21         echo "Usage: $0 [options]"'
22
23         -s section      run only specified section(s) from config file
24         -S section      exclude the specified section from the config file
25 '
26         exit 0
27 }
28
29 while [ $# -gt 0 ]; do
30         case "$1" in
31         -\? | -h | --help) usage ;;
32         -s)     RUN_SECTION="$RUN_SECTION $2"; shift ;;
33         -S)     EXCLUDE_SECTION="$EXCLUDE_SECTION $2"; shift ;;
34         *)      usage ;;
35         esac
36         shift
37 done
38
39 if ! . ./common/config
40 then
41     echo "check: failed to source common/config"
42     exit 1
43 fi
44
45 for section in $HOST_OPTIONS_SECTIONS; do
46         OLD_FSTYP=$FSTYP
47         OLD_MOUNT_OPTIONS=$MOUNT_OPTIONS
48         get_next_config $section
49
50         # Do we need to run only some sections ?
51         if [ ! -z "$RUN_SECTION" ]; then
52                 skip=true
53                 for s in $RUN_SECTION; do
54                         if [ $section == $s ]; then
55                                 skip=false
56                                 break;
57                         fi
58                 done
59                 if $skip; then
60                         continue
61                 fi
62         fi
63
64         # Did this section get excluded?
65         if [ ! -z "$EXCLUDE_SECTION" ]; then
66                 skip=false
67                 for s in $EXCLUDE_SECTION; do
68                         if [ $section == $s ]; then
69                                 skip=true
70                                 break;
71                         fi
72                 done
73                 if $skip; then
74                         continue
75                 fi
76         fi
77
78         [ "$USE_EXTERNAL"    = yes ] || USE_EXTERNAL=no
79         [ "$USE_LBD_PATCH"   = yes ] || USE_LBD_PATCH=no
80         [ "$LARGE_SCRATCH_DEV"  = yes ] || LARGE_SCRATCH_DEV=no
81         [ "$USE_ATTR_SECURE" = yes ] || USE_ATTR_SECURE=no
82         [ -z "$FSTYP" ] && FSTYP="xfs"
83
84         cat <<EOF
85 SECTION       -- $section
86
87 TEST: DIR=$TEST_DIR DEV=$TEST_DEV rt=[$TEST_RTDEV] log=[$TEST_LOGDEV]
88 TAPE: dev=[$TAPE_DEV] rmt=[$RMT_TAPE_DEV] rmtirix=[$RMT_TAPE_USER@$RMT_IRIXTAPE_DEV]
89 SCRATCH: MNT=$SCRATCH_MNT DEV=$SCRATCH_DEV rt=[$SCRATCH_RTDEV] log=[$SCRATCH_LOGDEV]
90 VARIABLES: external=$USE_EXTERNAL largeblk=$USE_LBD_PATCH fstyp=$FSTYP
91            large_scratch_dev=$LARGE_SCRATCH_DEV attrsecure=$USE_ATTR_SECURE
92 --------
93 EOF
94 done