3 # Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
5 # common procedures for QA scripts
7 # $Header: /disk7/depot/linux/pcp/dev/qa/RCS/common,v 2.52 2000/04/05 18:24:51 kenmcd Exp $
23 if [ ! -z "$DISPLAY" ]
25 which xdiff >/dev/null 2>&1 && diff=xdiff
26 which gdiff >/dev/null 2>&1 && diff=gdiff
27 which tkdiff >/dev/null 2>&1 && diff=tkdiff
28 which xxdiff >/dev/null 2>&1 && diff=xxdiff
37 rm -f $tmp.list $tmp.tmp $tmp.sed
47 group_list=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
50 if [ -z "$group_list" ]
52 echo "Group \"$r\" is empty or not defined?"
55 [ ! -s $tmp.list ] && touch $tmp.list
58 if grep -s "^$t\$" $tmp.list >/dev/null
71 [ ! -s $tmp.list ] && ls [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] >$tmp.list 2>/dev/null
72 group_list=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
75 if [ -z "$group_list" ]
77 echo "Group \"$r\" is empty or not defined?"
84 if [ $numsed -gt 100 ]
86 sed -f $tmp.sed <$tmp.list >$tmp.tmp
91 echo "/^$t\$/d" >>$tmp.sed
92 numsed=`expr $numsed + 1`
94 sed -f $tmp.sed <$tmp.list >$tmp.tmp
105 echo "Usage: $0 [options] [testlist]"'
114 -g group[,group...] include tests from these groups
115 -l line mode diff [xdiff]
116 -n show me, do not run tests
117 -q quick [deprecated]
119 -x group[,group...] exclude tests from these groups
125 -udf) # -udf ... set FSTYP to udf
130 -xfs) # -xfs ... set FSTYP to xfs
135 -nfs) # -nfs ... set FSTYP to nfs
140 -g) # -g group ... pick from group file
145 -l) # line mode for diff, not gdiff over modems
150 -q) # "quick", no longer used - always quick :-)
154 -n) # show me, don't do it
159 -T) # turn on timestamp output
168 -x) # -x group ... exclude from group file
172 '[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]')
179 eval `echo $r | sed -e 's/^/start=/' -e 's/-/ end=/'`
183 eval `echo $r | sed -e 's/^/start=/' -e 's/-//'`
184 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/.* //'`
187 echo "No tests in range \"$r\"?"
200 # get rid of leading 0s as can be interpreted as octal
201 start=`echo $start | sed 's/^0*//'`
202 end=`echo $end | sed 's/^0*//'`
207 $AWK_PROG </dev/null '
208 BEGIN { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
211 if grep -s "^$id " group >/dev/null
213 # in group file ... OK
216 if [ -f expunged ] && $expunge && egrep "^$id([ ]|\$)" expunged >/dev/null
218 # expunged ... will be reported, but not run, later
222 echo "$id - unknown test, ignored"
232 # found some valid test numbers ... this is good
237 # had test numbers, but none in group file ... do nothing
240 # no test numbers, do everything from group file
241 sed -n -e '/^[0-9][0-9][0-9]*/s/[ ].*//p' <group >$tmp.list
245 # should be sort -n, but this did not work for Linux when this
246 # was ported from IRIX
248 list=`sort $tmp.list`
249 rm -f $tmp.list $tmp.tmp $tmp.sed
253 [ "$XFS_LOGPRINT_PROG" = "" ] && _fatal "xfs_logprint not found"
254 [ "$XFS_REPAIR_PROG" = "" ] && _fatal "xfs_repair not found"
255 [ "$XFS_CHECK_PROG" = "" ] && _fatal "xfs_check not found"
256 [ "$XFS_DB_PROG" = "" ] && _fatal "xfs_db not found"
257 [ "$MKFS_XFS_PROG" = "" ] && _fatal "mkfs_xfs not found"
260 [ "$MKFS_UDF_PROG" = "" ] && _fatal "mkfs_udf/mkudffs not found"