From patchwork Thu Oct 23 11:08:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Monakhov X-Patchwork-Id: 5139441 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3EE2F9F3ED for ; Thu, 23 Oct 2014 11:08:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3C9162026D for ; Thu, 23 Oct 2014 11:08:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2F5B82026C for ; Thu, 23 Oct 2014 11:08:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753944AbaJWLIo (ORCPT ); Thu, 23 Oct 2014 07:08:44 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:20847 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753351AbaJWLIn (ORCPT ); Thu, 23 Oct 2014 07:08:43 -0400 Received: from mct2.qa.sw.ru ([10.29.1.63]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id s9NB8dqU030587; Thu, 23 Oct 2014 15:08:40 +0400 (MSK) From: Dmitry Monakhov To: fstests@vger.kernel.org Cc: linux-ext4@vger.kernel.org, root Subject: [PATCH 1/2] xfstests: update 'new' script v3 Date: Thu, 23 Oct 2014 15:08:37 +0400 Message-Id: <1414062518-30942-1-git-send-email-dmonakhov@openvz.org> X-Mailer: git-send-email 1.9.3 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: root - Update script to support new test cheme tests/$fs_type/$TEST_IDX - Try to use first unused ID changes from v2 - gawk->$AWK_PROG Reviewed-by: Eryu Guan --- new | 85 ++++++++++++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 62 insertions(+), 23 deletions(-) diff --git a/new b/new index f3e6fa1..86f9075 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