X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=build%2Ftest-commit-msg.sh;h=facd9f3c547d25e5d7c477709e73d438c6c63b74;hb=49c1b76c043516d163f43742da69cdd5ea3874c6;hp=899f366fd9462cb9ce5ee55806b8c8ae3f13a231;hpb=f40494c72908d2fafd652c16cb8c093a981eb679;p=fs%2Flustre-release.git diff --git a/build/test-commit-msg.sh b/build/test-commit-msg.sh index 899f366..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 +if [ -n "$FAIL" ]; then + echo -e "\nerror: commit-msg test(s) failed!" 1>&2 + echo " $FAIL" +fi + rm -f $TEMPFILE $TEMPFILE.*