Skip to contentSkip to conversation

new: Improvements to new script

PATCH Superseded Nirjhar Roy (IBM) 3 participants 10 messages May 15, 2025 – May 22, 2025

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover new: Improvements to new script

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

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

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

Nirjhar Roy (IBM) (2):
new: Add a new parameter (name/emailid) 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 v2 1/2 new: Add a new parameter (name/emailid) in the "new" script

This patch another optional interactive prompt to enter the author name and email id 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 <author_name> <email-id>: Nirjhar Roy <[email protected]> Creating skeletal script for you to edit ...
done.

...
...

---
 new | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
new +4 -1
index 6b50ffed..636648e2 100755
@@ -136,6 +136,9 @@ else
 	check_groups "${new_groups[@]}" || exit 1
 fi
 
+read -p "Enter <author_name>: " -r
+author_name="${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 $author_name.  All Rights Reserved.
 #
 # FS QA Test $id
 #
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 1/2] new: Add a new parameter (name/emailid) in the "new" script

Quoted 4 lines · Nirjhar Roy (IBM)

This patch another optional interactive prompt to enter the author name and email id for each new test file that is created using the "new" file.

Quoted 8 lines

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 <author_name> <email-id>: Nirjhar Roy <[email protected]>

I don't see much of a value add in this change here, as folks or atleast I prefer to quickly get into writing my test first and later worry about these details :). But I guess I understand where you are coming from, a lot of times people miss to update this and end up sending a test with "YOUR NAME HERE" placeholder.

So, sure if we are doing this - then please fix the commit message too, as it still shows <email-id> above.

-ritesh

Quoted 36 lines

Creating skeletal script for you to edit ...
done.

...
...

---
 new | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
new +4 -1
index 6b50ffed..636648e2 100755
@@ -136,6 +136,9 @@ else
 	check_groups "${new_groups[@]}" || exit 1
 fi
 
+read -p "Enter <author_name>: " -r
+author_name="${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 $author_name.  All Rights Reserved.
 #
 # FS QA Test $id
 #
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH v2 1/2] new: Add a new parameter (name/emailid) in the "new" script

Quoted 14 lines · Ritesh Harjani (IBM)
Quoted 4 lines · Nirjhar Roy (IBM)

This patch another optional interactive prompt to enter the author name and email id for each new test file that is created using the "new" file.

Quoted 8 lines

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 <author_name> <email-id>: Nirjhar Roy <[email protected]>

Quoted 8 lines

I don't see much of a value add in this change here, as folks or atleast I prefer to quickly get into writing my test first and later worry about these details :). But I guess I understand where you are coming from, a lot of times people miss to update this and end up sending a test with "YOUR NAME HERE" placeholder.

So, sure if we are doing this - then please fix the commit message too, as it still shows <email-id> above.

Sure. I will update the commit message in the next revision.

--NR

Quoted 39 lines

-ritesh

Quoted 36 lines

Creating skeletal script for you to edit ...
done.

...
...

---
  new | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
new +4 -1
index 6b50ffed..636648e2 100755
@@ -136,6 +136,9 @@ else
  	check_groups "${new_groups[@]}" || exit 1
  fi
 
+read -p "Enter <author_name>: " -r
+author_name="${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 $author_name.  All Rights Reserved.
  #
  # FS QA Test $id
  #
Signature · 1 line
2.34.1
Signature · 3 lines
Nirjhar Roy
Linux Kernel Developer
IBM, Bangalore
#4 lore raw

Re: [PATCH v2 1/2] new: Add a new parameter (name/emailid) in the "new" script

In reply to Nirjhar Roy (IBM)
Quoted 38 lines · Nirjhar Roy (IBM)

This patch another optional interactive prompt to enter the author name and email id 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 <author_name> <email-id>: Nirjhar Roy <[email protected]> Creating skeletal script for you to edit ...
done.

...
...

---
 new | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
new +3 -0
index 6b50ffed..636648e2 100755
@@ -136,6 +136,9 @@ else
 	check_groups "${new_groups[@]}" || exit 1
 fi
 
+read -p "Enter <author_name>: " -r
+author_name="${REPLY:=YOUR NAME HERE}"
+
 echo -n "Creating skeletal script for you to edit ..."
 
 year=`date +%Y`

new year=`date +%Y` · line 149

Quoted 5 lines
new +1 -1
@@ -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 $author_name.  All Rights Reserved.

In many cases, this is incorrect.

For people who are corporate employees, copyright for the code they write is typically owned by their employer, not the employee who wrote the code. i.e. this field generally contains something like "Red Hat, Inc", "Oracle, Inc", "IBM Corporation", etc in these cases, not the employee's name.

-Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#5 lore raw

Re: [PATCH v2 1/2] new: Add a new parameter (name/emailid) in the "new" script

Quoted 46 lines · Dave Chinner
Quoted 38 lines · Nirjhar Roy (IBM)

This patch another optional interactive prompt to enter the author name and email id 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 <author_name> <email-id>: Nirjhar Roy <[email protected]> Creating skeletal script for you to edit ...
done.

...
...

---
  new | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
new +3 -0
index 6b50ffed..636648e2 100755
@@ -136,6 +136,9 @@ else
  	check_groups "${new_groups[@]}" || exit 1
  fi
 
+read -p "Enter <author_name>: " -r
+author_name="${REPLY:=YOUR NAME HERE}"
+
  echo -n "Creating skeletal script for you to edit ..."
 
  year=`date +%Y`

new year=`date +%Y` · line 149

Quoted 5 lines
new +1 -1
@@ -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 $author_name.  All Rights Reserved.

In many cases, this is incorrect.

Quoted 5 lines

For people who are corporate employees, copyright for the code they write is typically owned by their employer, not the employee who wrote the code. i.e. this field generally contains something like "Red Hat, Inc", "Oracle, Inc", "IBM Corporation", etc in these cases, not the employee's name.

Yes. The existing placeholder is already "YOUR NAME HERE" (which I have kept unchanged). The author can always use the company's name from read -p prompt or simply chose to fill it up later, right? Or are you saying that the existing placeholder "YOUR NAME HERE" is incorrect?

--NR

Quoted 2 lines

-Dave.

Signature · 3 lines
Nirjhar Roy
Linux Kernel Developer
IBM, Bangalore
#6 lore raw

Re: [PATCH v2 1/2] new: Add a new parameter (name/emailid) in the "new" script

Quoted 52 lines · Nirjhar Roy (IBM)
Quoted 44 lines · Dave Chinner
Quoted 36 lines · Nirjhar Roy (IBM)

This patch another optional interactive prompt to enter the author name and email id 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 <author_name> <email-id>: Nirjhar Roy <[email protected]> Creating skeletal script for you to edit ...
done.

...
...

---
  new | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
new +3 -0
index 6b50ffed..636648e2 100755
@@ -136,6 +136,9 @@ else
  	check_groups "${new_groups[@]}" || exit 1
  fi
+read -p "Enter <author_name>: " -r
+author_name="${REPLY:=YOUR NAME HERE}"
+
  echo -n "Creating skeletal script for you to edit ..."
  year=`date +%Y`

new year=`date +%Y` · line 149

Quoted 5 lines
new +1 -1
@@ -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 $author_name.  All Rights Reserved.

In many cases, this is incorrect.

Quoted 5 lines

For people who are corporate employees, copyright for the code they write is typically owned by their employer, not the employee who wrote the code. i.e. this field generally contains something like "Red Hat, Inc", "Oracle, Inc", "IBM Corporation", etc in these cases, not the employee's name.

Quoted 4 lines

Yes. The existing placeholder is already "YOUR NAME HERE" (which I have kept unchanged). The author can always use the company's name from read -p prompt or simply chose to fill it up later, right? Or are you saying that the existing placeholder "YOUR NAME HERE" is incorrect?

I'm noting that your prompt - <author_name> - is incorrect for this "YOUR NAME HERE" field. That field is supposed to contain the -copyright owner-, not the author of the patch. Sometimes they are the same, but in many cases they are not.

-Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#7 lore raw

Re: [PATCH v2 1/2] new: Add a new parameter (name/emailid) in the "new" script

Quoted 51 lines · Dave Chinner
Quoted 50 lines · Nirjhar Roy (IBM)
Quoted 49 lines · Dave Chinner
Quoted 36 lines · Nirjhar Roy (IBM)

This patch another optional interactive prompt to enter the author name and email id 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 <author_name> <email-id>: Nirjhar Roy <[email protected]> Creating skeletal script for you to edit ...
done.

...
...

---
   new | 5 ++++-
   1 file changed, 4 insertions(+), 1 deletion(-)
new +3 -0
index 6b50ffed..636648e2 100755
@@ -136,6 +136,9 @@ else
   	check_groups "${new_groups[@]}" || exit 1
   fi
+read -p "Enter <author_name>: " -r
+author_name="${REPLY:=YOUR NAME HERE}"
+
   echo -n "Creating skeletal script for you to edit ..."
   year=`date +%Y`

new year=`date +%Y` · line 149

Quoted 5 lines
new +1 -1
@@ -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 $author_name.  All Rights Reserved.

In many cases, this is incorrect.

For people who are corporate employees, copyright for the code they write is typically owned by their employer, not the employee who wrote the code. i.e. this field generally contains something like "Red Hat, Inc", "Oracle, Inc", "IBM Corporation", etc in these cases, not the employee's name.

Quoted 8 lines
Quoted 4 lines

Yes. The existing placeholder is already "YOUR NAME HERE" (which I have kept unchanged). The author can always use the company's name from read -p prompt or simply chose to fill it up later, right? Or are you saying that the existing placeholder "YOUR NAME HERE" is incorrect?

I'm noting that your prompt - <author_name> - is incorrect for this "YOUR NAME HERE" field. That field is supposed to contain the -copyright owner-, not the author of the patch. Sometimes they are the same, but in many cases they are not.

Oh, okay. I can change the prompt to "Enter <copyright-owner>: ".

--NR

Quoted 2 lines

-Dave.

Signature · 3 lines
Nirjhar Roy
Linux Kernel Developer
IBM, Bangalore
#8 lore raw

PATCH v2 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 636648e2..dff69265 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
Reviewed-by on v2 2/2
#9 lore raw

Re: [PATCH v2 2/2] new: Replace "status=0; exit 0" with _exit 0

Quoted 3 lines · Nirjhar Roy (IBM)

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

Right every test now sources common/exit in _begin_test() preamble. So we may as well start using _exit for new tests.

Looks good to me. Please feel free to add:

Quoted 22 lines
---
 new | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
new +1 -2
index 636648e2..dff69265 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