X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=build%2Ftest-commit-msg.sh;h=facd9f3c547d25e5d7c477709e73d438c6c63b74;hb=c3d4fb2c9f4d22d4e08e2461d07b1f6fa3f7b8e5;hp=04f2f08998b2aa8086ad8c76b67a68e1fb9658b0;hpb=1c0e019d2fa853dd51c6369cbca16547939817ed;p=fs%2Flustre-release.git diff --git a/build/test-commit-msg.sh b/build/test-commit-msg.sh index 04f2f08..facd9f3 100755 --- a/build/test-commit-msg.sh +++ b/build/test-commit-msg.sh @@ -15,15 +15,15 @@ trap "rm -f $TEMPFILE COMMIT*" EXIT test $# -eq 0 && set -- ${progdir}/commit.* +export FAIL="" readonly report_fmt='%-20s %s\n' -for f -do +for f; do case "$f" in - ( *.orig | *.rej ) continue ;; + ( *.orig | *.rej ) continue ;; esac + cp $f $TEMPFILE - results=$(exec 2>&1 - ${SHELL:-sh} $progdir/commit-msg $TEMPFILE) + results=$(exec 2>&1 ${SHELL:-sh} $progdir/commit-msg $TEMPFILE) case $'\n'"$results" in ( *$'\nerror:'* ) OK=0 ;; ( * ) OK=1 ;; @@ -32,10 +32,15 @@ do f=$(basename $f) case $OK${f#*commit.} in 1ok*) printf "$report_fmt" $f: "PASS (was allowed)" ;; - 0ok*) printf "$report_fmt" $f: "FAIL (not allowed)" ;; + 0ok*) printf "$report_fmt" $f: "FAIL (not allowed)"; FAIL="$FAIL $f";; 0*) printf "$report_fmt" $f: "PASS (found error)" ;; - *) printf "$report_fmt" $f: "FAIL (no error)" ;; + *) printf "$report_fmt" $f: "FAIL (no error)" ; FAIL="$FAIL $f";; esac done -rm -f $TEMPFILE +if [ -n "$FAIL" ]; then + echo -e "\nerror: commit-msg test(s) failed!" 1>&2 + echo " $FAIL" +fi + +rm -f $TEMPFILE $TEMPFILE.*