All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org, guaneryu@gmail.com
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me
Subject: [PATCH 1/1] new: allow users to specify a new test id
Date: Mon, 19 Jul 2021 18:08:22 -0700	[thread overview]
Message-ID: <162674330211.2650678.4087092414669814557.stgit@magnolia> (raw)
In-Reply-To: <162674329655.2650678.3298345419686024312.stgit@magnolia>

From: Darrick J. Wong <djwong@kernel.org>

Alter the ./new script so that one can set the test id explicitly.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 new |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)


diff --git a/new b/new
index 07144399..2097a883 100755
--- a/new
+++ b/new
@@ -20,13 +20,24 @@ _cleanup()
 SRC_GROUPS=`find tests -not -path tests -type d -printf "%f "`
 usage()
 {
-    echo "Usage $0 test_dir"
+    echo "Usage $0 test_dir|test_dir_and_name"
     echo "Available dirs are: $SRC_GROUPS"
     exit
 }
 
 [ $# -eq 0 ] && usage
-tdir=tests/$1
+
+if echo "$1" | grep -q '/'; then
+	if [ -e "tests/$1" ]; then
+		echo "$1: test already exists."
+		exit 1
+	fi
+	tdir="tests/$(echo "$1" | cut -d '/' -f 1)"
+	id="$(echo "$1" | cut -d '/' -f 2)"
+else
+	tdir=tests/$1
+	id="$(basename "$(./tools/nextid "$1")")"
+fi
 
 i=0
 line=0
@@ -36,7 +47,6 @@ eof=1
 export AWK_PROG="$(type -P awk)"
 [ "$AWK_PROG" = "" ] && { echo "awk not found"; exit; }
 
-id="$(basename "$(./tools/nextid "$1")")"
 echo "Next test id is $id"
 shift
 


  reply	other threads:[~2021-07-20  1:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20  1:08 [PATCHSET v2 0/1] fstests: fixes for test control code Darrick J. Wong
2021-07-20  1:08 ` Darrick J. Wong [this message]
2021-07-22  6:35   ` [PATCH 1/1] new: allow users to specify a new test id Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2021-07-07  0:20 [PATCHSET 0/1] fstests: fixes for test control code Darrick J. Wong
2021-07-07  0:21 ` [PATCH 1/1] new: allow users to specify a new test id Darrick J. Wong
2021-07-18 13:57   ` Eryu Guan
2021-07-18 16:23     ` Darrick J. Wong

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=162674330211.2650678.4087092414669814557.stgit@magnolia \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=guaneryu@gmail.com \
    --cc=linux-xfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.