All of lore.kernel.org
 help / color / mirror / Atom feed
From: JWP <elseifthen@gmx.com>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org, Sami Kerola <kerolasa@iki.fi>
Subject: [PATCH 4/4] tools: checkmans.sh add stats
Date: Tue, 13 Jan 2015 14:02:20 -0500	[thread overview]
Message-ID: <54B56BBC.5000602@gmx.com> (raw)
In-Reply-To: <54B56822.40805@gmx.com>

Add test results statistics.
Fix-up 'KNOWN_REPEATS'.
Version bump.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
---
 tools/checkmans.sh | 33 ++++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 11 deletions(-)

diff --git a/tools/checkmans.sh b/tools/checkmans.sh
index bd2bc43..618f8ba 100755
--- a/tools/checkmans.sh
+++ b/tools/checkmans.sh
@@ -26,7 +26,7 @@ while getopts vVh OPTIONS; do
 			VERBOSE='true'
 			;;
 		V)
-			echo "util-linux: ${SCRIPT_INVOCATION_SHORT_NAME}: 2"
+			echo "util-linux: ${SCRIPT_INVOCATION_SHORT_NAME}: v2.1"
 			exit 0
 			;;
 		h)
@@ -43,11 +43,13 @@ done
 declare -A MAN_LIST BIN_LIST
 
 declare -i ITER
-declare -i COUNT_ERRORS=0
+declare -i COUNT_GROG=0
+declare -i COUNT_TROFF=0
+declare -i COUNT_REPEATS=0
 declare -a REPEATS
 declare -A KNOWN_REPEATS
-KNOWN_REPEATS[mount.8]='foo'
-KNOWN_REPEATS[sfdisk.8]="0 <c,h,s>"
+KNOWN_REPEATS[mount.8]='foo l2 l c'
+KNOWN_REPEATS[hexdump.1]='l'
 KNOWN_REPEATS[flock.1]='"$0"'
 KNOWN_REPEATS[switch_root.8]='$DIR'
 
@@ -81,7 +83,6 @@ for I in $(
 		fi
 		continue
 	fi
-	I_ERR=0
 	if ${VERBOSE}; then
 		echo "testing: ${I}"
 	fi
@@ -90,22 +91,23 @@ for I in $(
 	if [ $RET = 0 ]; then
 	echo "From: cat ${I} | troff -mandoc -ww -z"
 	echo "=================================================="
+	((++COUNT_TROFF))
 	fi
 	GROG=1
 	if command -v lexgrog &> /dev/null; then
 		if ! lexgrog ${I} >/dev/null; then
 			echo "error: run: lexgrog ${I}"
 			echo "=================================================="
-			((++COUNT_ERRORS))
+			((++COUNT_GROG))
 		fi
 	elif command -v grog &> /dev/null; then
 		if ! grog ${I} | grep man >/dev/null; then
 			echo "error: grog ${I} is not a man file"
 			echo "=================================================="
-			((++COUNT_ERRORS))
+			((++COUNT_GROG))
 		fi
 	else
-	GROG=0
+		GROG=0
 	fi
 	REPEATS=( $(cat ${I} | troff -mandoc -Tascii 2>/dev/null | grotty |
 		col -b |
@@ -118,6 +120,8 @@ for I in $(
 		done
 		if [ 0 -lt "${#REPEATS[@]}" ]; then
 			echo "warning: ${I} has repeating words: ${REPEATS[@]}"
+			echo "=================================================="
+			((++COUNT_REPEATS))
 		fi
 	fi
 done
@@ -148,17 +152,24 @@ done
 set +u
 for I in ${!BIN_LIST[@]}; do
 	if [ -v ${MAN_LIST[$I]} ]; then
-		echo "warning: ${I} does not have man page"
+		echo "warning: ${SCRIPT_INVOCATION_SHORT_NAME}: ${I} does not have man page"
 	fi
 done
 set -u
 
+echo "${SCRIPT_INVOCATION_SHORT_NAME}: ${#BIN_LIST[*]} build targets were found"
+echo "${SCRIPT_INVOCATION_SHORT_NAME}: ${#MAN_LIST[*]} files were tested"
+
 if [ ${GROG} = 0 ]; then
 echo "warning: neither grog nor lexgrog commands were found"
 fi
 
-if [ ${COUNT_ERRORS} -ne 0 ]; then
-	echo "error: ${SCRIPT_INVOCATION_SHORT_NAME}: ${COUNT_ERRORS} manuals failed"
+if [ ${COUNT_GROG} -ne 0 -o ${COUNT_TROFF} -ne 0 -o ${COUNT_REPEATS} -ne 0 ]; then
+	echo "error: ${SCRIPT_INVOCATION_SHORT_NAME}: ${COUNT_GROG} files failed (lex)grog man-page test"
+	echo "error: ${SCRIPT_INVOCATION_SHORT_NAME}: ${COUNT_TROFF} files failed troff parsing test"
+	echo "error: ${SCRIPT_INVOCATION_SHORT_NAME}: ${COUNT_REPEATS} files have repeating words"
+	ITER=${#MAN_LIST[*]}-${COUNT_GROG}-${COUNT_TROFF}-${COUNT_REPEATS}
+	echo "${SCRIPT_INVOCATION_SHORT_NAME}: ${ITER} man-pages approved"
 	exit 1
 fi
 

  parent reply	other threads:[~2015-01-13 19:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 18:46 [PATCH 0/4] tools: checkman.sh portability JWP
2015-01-13 18:55 ` [PATCH 1/4] " JWP
2015-01-13 18:57 ` [PATCH 2/4] tools: checkman.sh portability lexgrog JWP
2015-01-13 18:59 ` [PATCH 3/4] tools: checkmans.sh clean up 'let' JWP
2015-01-13 19:02 ` JWP [this message]
2015-01-14  9:26 ` [PATCH 0/4] tools: checkman.sh portability Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54B56BBC.5000602@gmx.com \
    --to=elseifthen@gmx.com \
    --cc=kerolasa@iki.fi \
    --cc=kzak@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.