3 #-----------------------------------------------------------------------
4 # Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation.
10 # This program is distributed in the hope that it would be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write the Free Software Foundation,
17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #-----------------------------------------------------------------------
24 # generic initialization
28 trap "rm -f /tmp/$$.; exit" 0 1 2 3 15
35 SRC_GROUPS=`find tests -not -path tests -type d -printf "%f "`
38 echo "Usage $0 test_dir"
39 echo "Available dirs are: $SRC_GROUPS"
47 if [ ! -f $tdir/group ]
49 echo "Creating the $tdir/group index ..."
50 cat <<'End-of-File' >$tdir/group
53 # define groups and default group owners
54 # do not start group name with a digit
61 # test-group association ... one line per test
66 if [ ! -w $tdir/group ]
69 echo "Warning: making the index file \"$tdir/group\" writeable"
76 echo "Warning: make failed -- some tests may be missing"
82 [ -f "$tdir/group" ] || usage
84 for found in `cat $tdir/group | tr - ' ' | $AWK_PROG '{ print $1 }'`
87 if [ -z "$found" ] || [ "$found" == "#" ]; then
89 elif ! echo "$found" | grep -q "^$VALID_TEST_NAME$"; then
90 # this one is for tests not named by a number
95 if [ "$id" != "$found" ];then
100 if [ $eof -eq 1 ]; then
103 id=`printf "%03d" $i`
106 echo "Next test id is $id"
108 read -p "Append a name to the ID? Test name will be $id-\$name. y,[n]: " -r
109 if [[ $REPLY = [Yy] ]]; then
110 # get the new name from user
112 while [ "$name" = "" ]; do
113 read -p "Enter the name: "
114 if [ "$REPLY" = "" ]; then
115 echo "For canceling, use ctrl+c."
116 elif echo "$id-$REPLY" | grep -q "^$VALID_TEST_NAME$"; then
117 if [ -e "$tdir/$id-$REPLY" ]; then
118 echo "File '$id-$REPLY' already exists, use another one."
124 echo "A name can contain only alphanumeric symbols and dash!"
129 # now find where to insert this name
131 for found in `tail -n +$line $tdir/group | $AWK_PROG '{ print $1 }'`; do
132 found_id=$(echo "$found" | cut -d "-" -f 1 - )
134 if [ -z "$found" ] || [ "$found" == "#" ]; then
136 elif [ $found_id -gt $id ]; then
141 if [ $eof -eq 0 ]; then
142 # If place wasn't found, let $line be the end of the file
147 echo "Creating test file '$id'"
151 echo "Error: test $id already exists!"
156 echo -n "Creating skeletal script for you to edit ..."
160 cat <<End-of-File >$tdir/$id
164 # what am I here for?
166 #-----------------------------------------------------------------------
167 # Copyright (c) $year YOUR NAME HERE. All Rights Reserved.
169 # This program is free software; you can redistribute it and/or
170 # modify it under the terms of the GNU General Public License as
171 # published by the Free Software Foundation.
173 # This program is distributed in the hope that it would be useful,
174 # but WITHOUT ANY WARRANTY; without even the implied warranty of
175 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
176 # GNU General Public License for more details.
178 # You should have received a copy of the GNU General Public License
179 # along with this program; if not, write the Free Software Foundation,
180 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
181 #-----------------------------------------------------------------------
185 seqres=\$RESULT_DIR/\$seq
186 echo "QA output created by \$seq"
190 status=1 # failure is the default!
191 trap "_cleanup; exit \\\$status" 0 1 2 3 15
199 # get standard environment, filters and checks
203 # remove previous \$seqres.full before test
206 # real QA test starts here
208 # Modify as appropriate.
209 _supported_fs generic
216 # optional stuff if your test has verbose output to help resolve problems
218 #echo "If failure, check \$seqres.full (this) and \$seqres.full.ok (reference)"
225 sleep 2 # latency to read messages to this point
229 ${EDITOR-vi} $tdir/$id
231 # Create default .out file
232 cat <<End-of-File >$tdir/$id.out
233 QA output created by $id
242 echo -n "Add to group(s) [other] (? for list): "
244 [ -z "$ans" ] && ans=other
245 if [ "X$ans" = "X?" ]
247 for d in $SRC_GROUPS; do
248 l=$(sed -n < tests/$d/group \
251 -e 's;\(^[0-9][0-9][0-9]\)\(.*$\);\2;p')
254 lst=`for word in $grpl; do echo $word; done | sort| uniq `
261 # expert mode, groups are on the command line
265 if grep "^$g[ ]" $tdir/group >/dev/null
269 echo "Warning: group \"$g\" not defined in $tdir/group"
275 echo -n "Adding $id to group index ..."
276 head -n $(($line-1)) $tdir/group > /tmp/$$.group
277 echo "$id $ans" >> /tmp/$$.group
278 tail -n +$((line)) $tdir/group >> /tmp/$$.group
279 mv /tmp/$$.group $tdir/group