Skip to contentSkip to conversation

new: Improvements to new script

PATCH In review Nirjhar Roy (IBM) 2 participants 4 messages May 22, 2025 – May 23, 2025

lore
Share & tools
lore
#0 lore raw

v4 cover new: Improvements to new script

This series adds a couple of improvements to the "new" script.
Patch-1/2 - Adds an optional copyright-owner parameter prompt to the new script while creating
a new test file using the "new" file.
Patch 2/2 - Replace "status=0;exit 0" with _exit 0 in the skeleton file in "new".

[v3] -> v4
- Modified the prompt message to "Enter <copyright owner>: " (Suggested by Dave)

[v2] -> v3
- Modified the commit message to remove "email-id" from it (patch 1).

[v1] -> [v2]
- Added RB of Zorro in patch 2 of [v1]
- Modified the prompt message for entering the author name (patch 1 of [v1])
- Removed patch 3 (Suggested by Zorro) of [v1]

[v1] https://lore.kernel.org/all/[email protected]/
[v2] https://lore.kernel.org/all/[email protected]/
[v3] https://lore.kernel.org/all/[email protected]/

Nirjhar Roy (IBM) (2):
new: Add a new parameter (copyright-owner) in the "new" script
new: Replace "status=0; exit 0" with _exit 0

 new | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--
2.34.1

#1 lore raw

PATCH v4 1/2 new: Add a new parameter (copyright-owner) in the "new" script

This patch another optional interactive prompt to enter the copyright-owner for each new test file that is created using the "new" file.

The sample output looks like something like the following:

./new selftest
Next test id is 007
Append a name to the ID? Test name will be 007-$name. y,[n]:
Creating test file '007'
Add to group(s) [auto] (separate by space, ? for list): selftest quick Enter <copyright owner>: IBM Corporation
Creating skeletal script for you to edit ...
done.

---
 new | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
new +4 -1
index 6b50ffed..a7ad7135 100755
@@ -136,6 +136,9 @@ else
 	check_groups "${new_groups[@]}" || exit 1
 fi
 
+read -p "Enter <copyright owner>: " -r
+copyright_owner="${REPLY:=YOUR NAME HERE}"
+
 echo -n "Creating skeletal script for you to edit ..."
 
 year=`date +%Y`
@@ -143,7 +146,7 @@ year=`date +%Y`
 cat <<End-of-File >$tdir/$id
 #! /bin/bash
 # SPDX-License-Identifier: GPL-2.0
-# Copyright (c) $year YOUR NAME HERE.  All Rights Reserved.
+# Copyright (c) $year $copyright_owner.  All Rights Reserved.
 #
 # FS QA Test $id
 #
Signature · 1 line
2.34.1
Reviewed-by on v4 1/2
#2 lore raw

Re: [PATCH v4 1/2] new: Add a new parameter (copyright-owner) in the "new" script

Quoted 15 lines · Nirjhar Roy (IBM)

This patch another optional interactive prompt to enter the copyright-owner for each new test file that is created using the "new" file.

The sample output looks like something like the following:

./new selftest
Next test id is 007
Append a name to the ID? Test name will be 007-$name. y,[n]:
Creating test file '007'
Add to group(s) [auto] (separate by space, ? for list): selftest quick Enter <copyright owner>: IBM Corporation
Creating skeletal script for you to edit ...
done.

Quoted 2 lines

---

Quoted 30 lines
 new | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
new +4 -1
index 6b50ffed..a7ad7135 100755
@@ -136,6 +136,9 @@ else
 	check_groups "${new_groups[@]}" || exit 1
 fi
 
+read -p "Enter <copyright owner>: " -r
+copyright_owner="${REPLY:=YOUR NAME HERE}"
+
 echo -n "Creating skeletal script for you to edit ..."
 
 year=`date +%Y`
@@ -143,7 +146,7 @@ year=`date +%Y`
 cat <<End-of-File >$tdir/$id
 #! /bin/bash
 # SPDX-License-Identifier: GPL-2.0
-# Copyright (c) $year YOUR NAME HERE.  All Rights Reserved.
+# Copyright (c) $year $copyright_owner.  All Rights Reserved.
 #
 # FS QA Test $id
 #
Signature · 1 line
2.34.1
#3 lore raw

PATCH v4 2/2 new: Replace "status=0; exit 0" with _exit 0

In reply to Nirjhar Roy (IBM)

We should now start using _exit 0 for every new test that we add.

---
 new | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
new +1 -2
index a7ad7135..60ace812 100755
@@ -176,8 +176,7 @@ exit
 #echo "If failure, check \$seqres.full (this) and \$seqres.full.ok (reference)"
 
 # success, all done
-status=0
-exit
+_exit 0
 End-of-File
 
 sleep 2		# latency to read messages to this point
Signature · 1 line
2.34.1