3 # Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
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.
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.
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.
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.
24 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
25 # Mountain View, CA 94043, or:
29 # For further information regarding this notice, see:
31 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
33 # common procedures for QA scripts
35 # $Header: /disk7/depot/linux/pcp/dev/qa/RCS/common,v 2.52 2000/04/05 18:24:51 kenmcd Exp $
51 if [ ! -z "$DISPLAY" ]
53 which xdiff >/dev/null 2>&1 && diff=xdiff
54 which gdiff >/dev/null 2>&1 && diff=gdiff
55 which tkdiff >/dev/null 2>&1 && diff=tkdiff
56 which xxdiff >/dev/null 2>&1 && diff=xxdiff
65 rm -f $tmp.list $tmp.tmp $tmp.sed
75 group_list=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
78 if [ -z "$group_list" ]
80 echo "Group \"$r\" is empty or not defined?"
83 [ ! -s $tmp.list ] && touch $tmp.list
86 if grep -s "^$t\$" $tmp.list >/dev/null
99 [ ! -s $tmp.list ] && ls [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] >$tmp.list 2>/dev/null
100 group_list=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
103 if [ -z "$group_list" ]
105 echo "Group \"$r\" is empty or not defined?"
112 if [ $numsed -gt 100 ]
114 sed -f $tmp.sed <$tmp.list >$tmp.tmp
115 mv $tmp.tmp $tmp.list
119 echo "/^$t\$/d" >>$tmp.sed
120 numsed=`expr $numsed + 1`
122 sed -f $tmp.sed <$tmp.list >$tmp.tmp
123 mv $tmp.tmp $tmp.list
133 echo "Usage: $0 [options] [testlist]"'
142 -g group[,group...] include tests from these groups
143 -l line mode diff [xdiff]
144 -n show me, do not run tests
145 -q quick [deprecated]
147 -x group[,group...] exclude tests from these groups
153 -udf) # -udf ... set FSTYP to udf
158 -xfs) # -xfs ... set FSTYP to xfs
163 -nfs) # -nfs ... set FSTYP to nfs
168 -g) # -g group ... pick from group file
173 -l) # line mode for diff, not gdiff over modems
178 -q) # "quick", no longer used - always quick :-)
182 -n) # show me, don't do it
187 -T) # turn on timestamp output
196 -x) # -x group ... exclude from group file
200 '[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]')
207 eval `echo $r | sed -e 's/^/start=/' -e 's/-/ end=/'`
211 eval `echo $r | sed -e 's/^/start=/' -e 's/-//'`
212 end=`echo [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] | sed -e 's/\[0-9]//g' -e 's/ *$//' -e 's/.* //'`
215 echo "No tests in range \"$r\"?"
228 # get rid of leading 0s as can be interpreted as octal
229 start=`echo $start | sed 's/^0*//'`
230 end=`echo $end | sed 's/^0*//'`
235 $AWK_PROG </dev/null '
236 BEGIN { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
239 if grep -s "^$id " group >/dev/null
241 # in group file ... OK
244 if [ -f expunged ] && $expunge && egrep "^$id([ ]|\$)" expunged >/dev/null
246 # expunged ... will be reported, but not run, later
250 echo "$id - unknown test, ignored"
260 # found some valid test numbers ... this is good
265 # had test numbers, but none in group file ... do nothing
268 # no test numbers, do everything from group file
269 sed -n -e '/^[0-9][0-9][0-9]*/s/[ ].*//p' <group >$tmp.list
273 # should be sort -n, but this did not work for Linux when this
274 # was ported from IRIX
276 list=`sort $tmp.list`
277 rm -f $tmp.list $tmp.tmp $tmp.sed
281 [ "$XFS_LOGPRINT_PROG" = "" ] && _fatal "xfs_logprint not found"
282 [ "$XFS_REPAIR_PROG" = "" ] && _fatal "xfs_repair not found"
283 [ "$XFS_CHECK_PROG" = "" ] && _fatal "xfs_check not found"
284 [ "$XFS_DB_PROG" = "" ] && _fatal "xfs_db not found"
285 [ "$MKFS_XFS_PROG" = "" ] && _fatal "mkfs_xfs not found"
288 [ "$MKFS_UDF_PROG" = "" ] && _fatal "mkfs_udf/mkudffs not found"