Whamcloud - gitweb
LU-9619 misc: add Test-Parameters to git-hook 98/50298/3
authorTimothy Day <timday@amazon.com>
Tue, 14 Mar 2023 21:11:09 +0000 (21:11 +0000)
committerOleg Drokin <green@whamcloud.com>
Tue, 11 Apr 2023 20:10:26 +0000 (20:10 +0000)
Add commented out example Test-Parameters lines
to git hook. This makes it easier to add them
in when appropriate.

Add short explaination for test parameters and
for Developer Certificate of Origin.

Update the file header to have the SPDX
license and use the standard format.

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: I6af3075339f15a3c4fc4134111f47a2899005c56
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50298
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Charlie Olmstead <charlie@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
contrib/git-hooks/prepare-commit-msg

index 77caa69..d573ecc 100755 (executable)
@@ -1,4 +1,10 @@
 #!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+# contrib/git-hooks/prepare-commit-msg
 #
 # A Git hook script to prepare the commit log message.  Install into
 # lustre/.git/hooks/prepare-commit-msg to enable for Lustre commits.
@@ -12,6 +18,7 @@
 # Commit hook to check the patch against the Lustre coding style.
 # It adds any checkpatch warnings/errors as commit comments, which
 # means that they can currently be ignored, but are at least visible.
+#
 
 CHECKPATCH=${CHECKPATCH:-contrib/scripts/checkpatch.pl}
 CHECKPATCH_OPTS=${CHECKPATCH_OPTS:-"--no-signoff --no-tree"}
@@ -23,9 +30,30 @@ SHELLCHECK_RUN=${SHELLCHECK_RUN:-"yes"} # run everytime by default
 # this shouldn't be adding new comments, or they appear in the commit.
 grep -q "^#" "$1" || exit 0
 
+# Add a commented-out Test-Parameters: line. This will let the developer
+# uncomment it out if they think it's appropriate.
+echo "#" >> "$1"
+echo "# If this patch makes only non-functional changes, or test-only" >> "$1"
+echo "# changes, consider adding this 'Test-Parameters' in the" >> "$1"
+echo "# commit message:" >> "$1"
+echo "#" >> "$1"
+echo "# Test-Parameters: trivial" >> "$1"
+echo "#" >> "$1"
+echo "# If you need to repeat the same subtest many times, consider" >> "$1"
+echo "# this instead:" >> "$1"
+echo "#" >> "$1"
+echo "# Test-Parameters: trivial testlist=sanity env=ONLY=1,ONLY_REPEAT=100" >> "$1"
+echo "#" >> "$1"
+echo "# https://wiki.whamcloud.com/display/PUB/Changing+Test+Parameters+with+Gerrit+Commit+Messages" >> "$1"
+echo "#" >> "$1"
+
 # Add a commented-out Signed-off-by: line.  This shouldn't be added in an
 # uncommented form, otherwise sanity checking for an emtpy commit fails.
 # The developer should uncomment it to include it in the commit message.
+echo "#" >> "$1"
+echo "# The 'Signed-off-by' line signifies that you agree to the Developer" >> "$1"
+echo "# Certificate of Origin - https://developercertificate.org/" >> "$1"
+echo "#" >> "$1"
 SIGNOFF=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
 grep -qs "^$SIGNOFF" "$1" || echo "# $SIGNOFF" >> "$1"