specify dump tape for _require_tape.
[xfstests-dev.git] / new
1 #! /bin/sh
2 #
3 # Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
4
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of version 2 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, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 # Further, this software is distributed without any warranty that it is
14 # free of the rightful claim of any third person regarding infringement
15 # or the like.  Any license provided herein, whether implied or
16 # otherwise, applies only to this software file.  Patent licenses, if
17 # any, provided herein do not apply to combinations of this program with
18 # other software, or any other product whatsoever.
19
20 # You should have received a copy of the GNU General Public License along
21 # with this program; if not, write the Free Software Foundation, Inc., 59
22 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
23
24 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
25 # Mountain View, CA  94043, or:
26
27 # http://www.sgi.com 
28
29 # For further information regarding this notice, see: 
30
31 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
32 #
33 #
34 # Make a new test
35 #
36 # $Header: /build2/depot/linux/pcp/dev/qa/RCS/new,v 2.22 1999/10/06 19:16:53 kenmcd Exp $
37 #
38
39 # generic initialization
40 iam=new
41 . ./common.rc
42
43 trap "rm -f /tmp/$$.; exit" 0 1 2 3 15
44
45 _cleanup()
46 {
47     :
48 }
49
50 if [ ! -f group ]
51 then
52     echo "Creating the group index ..."
53     cat <<'End-of-File' >group
54 # QA groups control
55 #
56 # $Id: new,v 2.22 1999/10/06 19:16:53 kenmcd Exp $
57 #
58 # define groups and default group owners
59 # do not start group name with a digit
60 #
61
62 # catch-all
63 #
64 other           some-user-login
65
66 # test-group association ... one line per test
67 #
68 End-of-File
69 fi
70
71 if [ ! -w group ]
72 then
73     chmod u+w group
74     echo "Warning: making the index file \"group\" writeable"
75 fi
76
77 if make
78 then
79     :
80 else
81     echo "Warning: make failed -- some tests may be missing"
82 fi
83
84 last=`grep '^[0-9][0-9]* ' group | sort | tail -1 | sed -e 's/[         ].*//'`
85 id=`$AWK_PROG </dev/null 'BEGIN{printf "%03d\n",'$last'+1}'`
86 echo "Next test is $id"
87
88 if [ -f $id ]
89 then
90     echo "Error: test $id already exists!"
91     _cleanup
92     exit 1
93 fi
94
95 echo -n "Creating skeletal script for you to edit ..."
96
97 cat <<End-of-File | sed -e '/rcsId/s//Id: 1.1 /' >$id
98 #! /bin/sh
99 # XFS QA Test No. $id
100 # \$rcsId\$
101 #
102 # what am I here for?
103 #
104 #-----------------------------------------------------------------------
105 # Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
106
107 # This program is free software; you can redistribute it and/or modify it
108 # under the terms of version 2 of the GNU General Public License as
109 # published by the Free Software Foundation.
110
111 # This program is distributed in the hope that it would be useful, but
112 # WITHOUT ANY WARRANTY; without even the implied warranty of
113 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
114
115 # Further, this software is distributed without any warranty that it is
116 # free of the rightful claim of any third person regarding infringement
117 # or the like.  Any license provided herein, whether implied or
118 # otherwise, applies only to this software file.  Patent licenses, if
119 # any, provided herein do not apply to combinations of this program with
120 # other software, or any other product whatsoever.
121
122 # You should have received a copy of the GNU General Public License along
123 # with this program; if not, write the Free Software Foundation, Inc., 59
124 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
125
126 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
127 # Mountain View, CA  94043, or:
128
129 # http://www.sgi.com 
130
131 # For further information regarding this notice, see: 
132
133 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
134 #-----------------------------------------------------------------------
135 #
136 # creator
137 owner=$USER@`_get_fqdn`
138
139 seq=\`basename \$0\`
140 echo "QA output created by \$seq"
141
142 here=\`pwd\`
143 tmp=/tmp/\$\$
144 status=1        # failure is the default!
145 trap "rm -f \$tmp.*; exit \\\$status" 0 1 2 3 15
146
147 # get standard environment, filters and checks
148 . ./common.rc
149 . ./common.filter
150
151 # real QA test starts here
152
153 # if error
154 exit
155
156 # optional stuff if your test has verbose output to help resolve problems
157 #echo
158 #echo "If failure, check \$seq.full (this) and \$seq.full.ok (reference)"
159
160 # success, all done
161 status=0
162 exit
163 End-of-File
164
165 sleep 2         # latency to read messages to this point
166 echo ""
167
168 chmod 755 $id
169 ${EDITOR-vi} $id
170
171 if [ $# -eq 0 ]
172 then
173     while true
174     do
175         echo -n "Add to group(s) [other] (? for list): "
176         read ans
177         [ -z "$ans" ] && ans=other
178         if [ "X$ans" = "X?" ]
179         then
180             $AWK_PROG <group '
181 BEGIN           { text = "# ???" }
182 /^[a-zA-z]/     { printf "%-16.16s %s\n",$1,text; text = "# ???"; next }
183 NF < 2          { next }
184                 { text = $0 }' \
185             | sort
186         else
187             break
188         fi
189     done
190 else
191     # expert mode, groups are on the command line
192     #
193     for g in $*
194     do
195         if grep "^$g[   ]" group >/dev/null
196         then
197             :
198         else
199             echo "Warning: group \"$g\" not defined in ./group"
200         fi
201     done
202     ans="$*"
203 fi
204
205 echo -n "Adding $id to group index ..."
206 echo "$id $ans" >>group
207 echo " done."
208
209 exit 0