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 $
52 if make >/tmp/$$.make 2>&1
57 echo "Warning: make failed -- some tests may be missing"
64 if [ ! -z "$DISPLAY" ]
66 which xdiff >/dev/null 2>&1 && diff=xdiff
67 which gdiff >/dev/null 2>&1 && diff=gdiff
68 which tkdiff >/dev/null 2>&1 && diff=tkdiff
78 rm -f $tmp.list $tmp.tmp $tmp.sed
86 group_list=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
89 if [ -z "$group_list" ]
91 echo "Group \"$r\" is empty or not defined?"
94 [ ! -s $tmp.list ] && touch $tmp.list
97 if grep -s "^$t\$" $tmp.list >/dev/null
101 echo "$t" >>$tmp.list
110 [ ! -s $tmp.list ] && ls [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] >$tmp.list 2>/dev/null
111 group_list=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
114 if [ -z "$group_list" ]
116 echo "Group \"$r\" is empty or not defined?"
123 if [ $numsed -gt 100 ]
125 sed -f $tmp.sed <$tmp.list >$tmp.tmp
126 mv $tmp.tmp $tmp.list
130 echo "/^$t\$/d" >>$tmp.sed
131 numsed=`expr $numsed + 1`
133 sed -f $tmp.sed <$tmp.list >$tmp.tmp
134 mv $tmp.tmp $tmp.list
144 echo "Usage: $0 [options] [testlist]"'
150 -g group[,group...] include tests from these groups
151 -l line mode diff [xdiff]
152 -n show me, do not run tests
153 -q quick, no checks (you are on your own)
155 -x group[,group...] exclude tests from these groups
160 -g) # -g group ... pick from group file
165 -l) # line mode for diff, not gdiff over modems
170 -q) # "quick", no checks (you are on your own)
175 -n) # show me, don't do it
180 -T) # turn on timestamp output
190 -x) # -x group ... exclude from group file
195 '[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]')
202 eval `echo $r | sed -e 's/^/start=/' -e 's/-/ end=/'`
206 eval `echo $r | sed -e 's/^/start=/' -e 's/-//'`
207 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/.* //'`
210 echo "No tests in range \"$r\"?"
223 # get rid of leading 0s as can be interpreted as octal
224 start=`echo $start | sed 's/^0*//'`
225 end=`echo $end | sed 's/^0*//'`
230 $AWK_PROG </dev/null '
231 BEGIN { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
234 if grep -s "^$id " group >/dev/null
236 # in group file ... OK
239 if [ -f expunged ] && $expunge && egrep "^$id([ ]|\$)" expunged >/dev/null
241 # expunged ... will be reported, but not run, later
245 echo "$id - unknown test, ignored"
255 # found some valid test numbers ... this is good
260 # had test numbers, but none in group file ... do nothing
263 # no test numbers, do everything from group file
264 sed -n -e '/^[0-9][0-9][0-9]*/s/[ ].*//p' <group >$tmp.list
268 # should be sort -n, but this did not work for Linux when this
269 # was ported from IRIX
271 list=`sort $tmp.list`
272 rm -f $tmp.list $tmp.tmp $tmp.sed
279 if ( cd src; make -i )
284 echo ":----------------------------------------------"
285 echo ": Warning: make failed in src -- some tests may fail as a result"
286 echo ":----------------------------------------------"