From: Dmitry Monakhov Date: Mon, 10 Nov 2014 07:01:10 +0000 (+1100) Subject: fstests: update 'new' script X-Git-Tag: v2022.05.01~3017 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=fd730cff4433755d5a2e7f84cfae8fc2a97e5a47;p=xfstests-dev.git fstests: update 'new' script - Update script to support new test cheme tests/$fs_type/$TEST_IDX - Try to use first unused ID Signed-off-by: Dmitry Monakhov Reviewed-by: Eryu Guan Signed-off-by: Dave Chinner --- diff --git a/new b/new index f3e6fa1f..86f90756 100755 --- a/new +++ b/new @@ -32,10 +32,22 @@ _cleanup() : } -if [ ! -f group ] +SRC_GROUPS=`find tests -not -path tests -type d -printf "%f "` +usage() +{ + echo "Usage $0 test_dir" + echo "Available dirs are: $SRC_GROUPS" + exit +} + +[ $# -eq 0 ] && usage +tdir=tests/$1 +shift + +if [ ! -f $tdir/group ] then - echo "Creating the group index ..." - cat <<'End-of-File' >group + echo "Creating the $tdir/group index ..." + cat <<'End-of-File' >$tdir/group # QA groups control # # define groups and default group owners @@ -51,10 +63,10 @@ other some-user-login End-of-File fi -if [ ! -w group ] +if [ ! -w $tdir/group ] then - chmod u+w group - echo "Warning: making the index file \"group\" writeable" + chmod u+w $tdir/group + echo "Warning: making the index file \"$tdir/group\" writeable" fi if make @@ -64,13 +76,33 @@ else echo "Warning: make failed -- some tests may be missing" fi -last=`grep '^[0-9][0-9]* ' group | sort | tail -1 | sed -e 's/[ ].*//'` -# get rid of leading 0s as can be interpreted as octal -last=`echo $last | sed 's/^0*//'` -id=`$AWK_PROG $id +cat <$tdir/$id #! /bin/bash # FS QA Test No. $id # @@ -146,11 +178,12 @@ End-of-File sleep 2 # latency to read messages to this point echo "" -chmod 755 $id -${EDITOR-vi} $id +chmod 755 $tdir/$id +${EDITOR-vi} $tdir/$id if [ $# -eq 0 ] then + while true do echo -n "Add to group(s) [other] (? for list): " @@ -158,12 +191,15 @@ then [ -z "$ans" ] && ans=other if [ "X$ans" = "X?" ] then - $AWK_PROG /dev/null + if grep "^$g[ ]" $tdir/group >/dev/null then : else - echo "Warning: group \"$g\" not defined in ./group" + echo "Warning: group \"$g\" not defined in $tdir/group" fi done ans="$*" fi echo -n "Adding $id to group index ..." -echo "$id $ans" >>group +head -n $(($line-1)) $tdir/group > /tmp/$$.group +echo "$id $ans" >> /tmp/$$.group +tail -n +$((line)) $tdir/group >> /tmp/$$.group +mv /tmp/$$.group $tdir/group echo " done." exit 0