summaryrefslogtreecommitdiff
path: root/new
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-07-19 18:08:22 -0700
committerEryu Guan <guaneryu@gmail.com>2021-07-22 23:43:57 +0800
commit54319929a08af34ae03a4e866cb6ce5d39a2bea3 (patch)
treeb41e44ff72da0ed07d874c1129e992d9636b8f66 /new
parent10f6b23121ea5ac9927e44eb15b128716139e2b8 (diff)
new: allow users to specify a new test id
Alter the ./new script so that one can set the test id explicitly. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Diffstat (limited to 'new')
-rwxr-xr-xnew16
1 files 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