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 $
31 rm -f $tmp.list $tmp.tmp $tmp.sed
41 group_list=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
44 if [ -z "$group_list" ]
46 echo "Group \"$r\" is empty or not defined?"
49 [ ! -s $tmp.list ] && touch $tmp.list
52 if grep -s "^$t\$" $tmp.list >/dev/null
65 [ ! -s $tmp.list ] && ls [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] >$tmp.list 2>/dev/null
66 group_list=`sed -n <group -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
69 if [ -z "$group_list" ]
71 echo "Group \"$r\" is empty or not defined?"
78 if [ $numsed -gt 100 ]
80 sed -f $tmp.sed <$tmp.list >$tmp.tmp
85 echo "/^$t\$/d" >>$tmp.sed
86 numsed=`expr $numsed + 1`
88 sed -f $tmp.sed <$tmp.list >$tmp.tmp
98 -\? | -h | --help) # usage
99 echo "Usage: $0 [options] [testlist]"'
105 -xfs test XFS (default)
108 -l line mode diff (default)
109 -xdiff graphical mode diff
110 -n show me, do not run tests
111 -q quick [deprecated]
113 -r randomize test order
116 -g group[,group...] include tests from these groups
117 -x group[,group...] exclude tests from these groups
119 NNN-NNN include test range (eg. 012-021)
124 -udf) # -udf ... set FSTYP to udf
129 -xfs) # -xfs ... set FSTYP to xfs
134 -nfs) # -nfs ... set FSTYP to nfs
139 -g) # -g group ... pick from group file
144 -l) # line mode for diff, default now, keep for backward compat
148 -xdiff) # graphical diff mode
151 if [ ! -z "$DISPLAY" ]
153 which xdiff >/dev/null 2>&1 && diff=xdiff
154 which gdiff >/dev/null 2>&1 && diff=gdiff
155 which tkdiff >/dev/null 2>&1 && diff=tkdiff
156 which xxdiff >/dev/null 2>&1 && diff=xxdiff
160 -q) # "quick", no longer used - always quick :-)
164 -n) # show me, don't do it
168 -r) # randomize test order
173 -T) # turn on timestamp output
182 -x) # -x group ... exclude from group file
186 '[0-9][0-9][0-9] [0-9][0-9][0-9][0-9]')
193 eval `echo $r | sed -e 's/^/start=/' -e 's/-/ end=/'`
197 eval `echo $r | sed -e 's/^/start=/' -e 's/-//'`
198 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/.* //'`
201 echo "No tests in range \"$r\"?"
214 # get rid of leading 0s as can be interpreted as octal
215 start=`echo $start | sed 's/^0*//'`
216 end=`echo $end | sed 's/^0*//'`
221 $AWK_PROG </dev/null '
222 BEGIN { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
225 if grep -s "^$id " group >/dev/null
227 # in group file ... OK
230 if [ -f expunged ] && $expunge && egrep "^$id([ ]|\$)" expunged >/dev/null
232 # expunged ... will be reported, but not run, later
236 echo "$id - unknown test, ignored"
246 # found some valid test numbers ... this is good
251 # had test numbers, but none in group file ... do nothing
254 # no test numbers, do everything from group file
255 sed -n -e '/^[0-9][0-9][0-9]*/s/[ ].*//p' <group >$tmp.list
259 # should be sort -n, but this did not work for Linux when this
260 # was ported from IRIX
262 list=`sort $tmp.list`
263 rm -f $tmp.list $tmp.tmp $tmp.sed
267 list=`echo $list | awk -f randomize.awk`
272 [ "$XFS_LOGPRINT_PROG" = "" ] && _fatal "xfs_logprint not found"
273 [ "$XFS_REPAIR_PROG" = "" ] && _fatal "xfs_repair not found"
274 [ "$XFS_CHECK_PROG" = "" ] && _fatal "xfs_check not found"
275 [ "$XFS_DB_PROG" = "" ] && _fatal "xfs_db not found"
276 [ "$MKFS_XFS_PROG" = "" ] && _fatal "mkfs_xfs not found"
279 [ "$MKFS_UDF_PROG" = "" ] && _fatal "mkfs_udf/mkudffs not found"