linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Monakhov <dmonakhov@openvz.org>
To: Eryu Guan <eguan@redhat.com>
Cc: fstests@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/2] xfstests: update 'new' script
Date: Fri, 17 Oct 2014 11:56:33 +0400	[thread overview]
Message-ID: <87wq7zt9hq.fsf@openvz.org> (raw)
In-Reply-To: <20141017073600.GM13912@dhcp-13-216.nay.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 5050 bytes --]

Eryu Guan <eguan@redhat.com> writes:

> On Tue, Oct 14, 2014 at 05:59:48PM +0400, Dmitry Monakhov wrote:
>> - Update script to support new test cheme tests/$fs_type/$TEST_IDX
>> - Try to use first unused ID
>> 
>> Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
>> ---
>>  new |   78 +++++++++++++++++++++++++++++++++++++++++++++++-------------------
>>  1 files changed, 55 insertions(+), 23 deletions(-)
>> 
>> diff --git a/new b/new
>> index f3e6fa1..9fa522e 100755
>> --- a/new
>> +++ b/new
>> @@ -32,10 +32,22 @@ _cleanup()
>>      :
>>  }
>>  
>> -if [ ! -f group ]
>> +SRC_GROUPS=`find tests -not -path tests -type d -printf "%f "`
>> +function usage 
>
> Trailing whitespace here.
>
>> +{
>> +    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,26 @@ 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 </dev/null 'BEGIN{printf "%03d\n",'$last'+1}'`
>> +i=0
>> +line=0
>> +[ -f "$tdir/group" ] || usage
>> +
>> +for found in `cat $tdir/group | gawk '{ print $1 }'`
>> +do
>> +    line=$((line+1))
>> +    if [ -z "$found" ] || [ "$found" == "#" ];then
>> +	continue
>> +    fi
>> +    i=$((i+1))
>> +    id=`printf "%03d" $i`
>> +    if [ "$id" != "$found" ];then
>> +	break
>> +    fi
>> +done
>> +
>
> If the group file is all in shape and first unused id is the lastid+1,
> the script fails here, ./new btrfs could reproduce this
>
Ohh, Indeed. I've missed that case, sorry. Will resend the path shortly.
>  # ./new btrfs
>  .....
>  Next test is 078
>  Error: test 078 already exists!
>
> Thanks,
> Eryu
>>  echo "Next test is $id"
>>  
>> -if [ -f $id ]
>> +if [ -f $tdir/$id ]
>>  then
>>      echo "Error: test $id already exists!"
>>      _cleanup
>> @@ -81,7 +106,7 @@ echo -n "Creating skeletal script for you to edit ..."
>>  
>>  year=`date +%Y`
>>  
>> -cat <<End-of-File >$id
>> +cat <<End-of-File >$tdir/$id
>>  #! /bin/bash
>>  # FS QA Test No. $id
>>  #
>> @@ -146,11 +171,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 +184,15 @@ then
>>  	[ -z "$ans" ] && ans=other
>>  	if [ "X$ans" = "X?" ]
>>  	then
>> -	    $AWK_PROG <group '
>> -BEGIN		{ text = "# ???" }
>> -/^[a-z]/	{ printf "%-16.16s %s\n",$1,text; text = "# ???"; next }
>> -NF < 2		{ next }
>> -		{ text = $0 }' \
>> -	    | sort
>> +	    for d in $SRC_GROUPS; do
>> +		l=$(sed -n < tests/$d/group \
>> +		    -e 's/#.*//' \
>> +		    -e 's/$/ /' \
>> +		    -e 's;\(^[0-9][0-9][0-9]\)\(.*$\);\2;p')
>> +		grpl="$grpl $l"
>> +	    done
>> +	    lst=`for word in $grpl; do echo $word; done | sort| uniq `
>> +	    echo $lst
>>  	else
>>  	    break
>>  	fi
>> @@ -173,18 +202,21 @@ else
>>      #
>>      for g in $*
>>      do
>> -	if grep "^$g[ 	]" group >/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
>> -- 
>> 1.7.1
>> 
>> --
>> To unsubscribe from this list: send the line "unsubscribe fstests" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: Type: application/pgp-signature, Size: 818 bytes --]

      reply	other threads:[~2014-10-17  7:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-14 13:59 [PATCH 1/2] xfstests: update 'new' script Dmitry Monakhov
2014-10-14 13:59 ` [PATCH 2/2] add aio/dio regression test race between write and fcntl V3 Dmitry Monakhov
2014-10-17  7:48   ` Eryu Guan
2014-10-16 15:55 ` [PATCH 1/2] xfstests: update 'new' script Albino Biasutti Neto
2014-10-17  7:36 ` Eryu Guan
2014-10-17  7:56   ` Dmitry Monakhov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wq7zt9hq.fsf@openvz.org \
    --to=dmonakhov@openvz.org \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).