3 # Copyright (c) 2000-2005 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
38 rm -f $tmp.list $tmp.tmp $tmp.sed
48 group_list=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
51 if [ -z "$group_list" ]
53 echo "Group \"$r\" is empty or not defined?"
56 [ ! -s $tmp.list ] && touch $tmp.list
59 if grep -s "^$t\$" $tmp.list >/dev/null
72 [ ! -s $tmp.list ] && ls [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] >$tmp.list 2>/dev/null
73 group_list=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
76 if [ -z "$group_list" ]
78 echo "Group \"$r\" is empty or not defined?"
85 if [ $numsed -gt 100 ]
87 sed -f $tmp.sed <$tmp.list >$tmp.tmp
92 echo "/^$t\$/d" >>$tmp.sed
93 numsed=`expr $numsed + 1`
95 sed -f $tmp.sed <$tmp.list >$tmp.tmp
105 -\? | -h | --help) # usage
106 echo "Usage: $0 [options] [testlist]"'
112 -xfs test XFS (default)
115 -l line mode diff [xdiff]
116 -n show me, do not run tests
117 -q quick [deprecated]
119 -r randomize test order
122 -g group[,group...] include tests from these groups
123 -x group[,group...] exclude tests from these groups
125 NNN-NNN include test range (eg. 012-021)
130 -udf) # -udf ... set FSTYP to udf
135 -xfs) # -xfs ... set FSTYP to xfs
140 -nfs) # -nfs ... set FSTYP to nfs
145 -g) # -g group ... pick from group file
150 -l) # line mode for diff, not gdiff over modems
155 -q) # "quick", no longer used - always quick :-)
159 -n) # show me, don't do it
163 -r) # randomize test order
168 -T) # turn on timestamp output
177 -x) # -x group ... exclude from group file
181 '[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]')
188 eval `echo $r | sed -e 's/^/start=/' -e 's/-/ end=/'`
192 eval `echo $r | sed -e 's/^/start=/' -e 's/-//'`
193 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/.* //'`
196 echo "No tests in range \"$r\"?"
209 # get rid of leading 0s as can be interpreted as octal
210 start=`echo $start | sed 's/^0*//'`
211 end=`echo $end | sed 's/^0*//'`
216 $AWK_PROG </dev/null '
217 BEGIN { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
220 if grep -s "^$id " group >/dev/null
222 # in group file ... OK
225 if [ -f expunged ] && $expunge && egrep "^$id([ ]|\$)" expunged >/dev/null
227 # expunged ... will be reported, but not run, later
231 echo "$id - unknown test, ignored"
241 # found some valid test numbers ... this is good
246 # had test numbers, but none in group file ... do nothing
249 # no test numbers, do everything from group file
250 sed -n -e '/^[0-9][0-9][0-9]*/s/[ ].*//p' <group >$tmp.list
254 # should be sort -n, but this did not work for Linux when this
255 # was ported from IRIX
257 list=`sort $tmp.list`
258 rm -f $tmp.list $tmp.tmp $tmp.sed
262 list=`echo $list | awk -f randomize.awk`
267 [ "$XFS_LOGPRINT_PROG" = "" ] && _fatal "xfs_logprint not found"
268 [ "$XFS_REPAIR_PROG" = "" ] && _fatal "xfs_repair not found"
269 [ "$XFS_CHECK_PROG" = "" ] && _fatal "xfs_check not found"
270 [ "$XFS_DB_PROG" = "" ] && _fatal "xfs_db not found"
271 [ "$MKFS_XFS_PROG" = "" ] && _fatal "mkfs_xfs not found"
274 [ "$MKFS_UDF_PROG" = "" ] && _fatal "mkfs_udf/mkudffs not found"