test-manpages.sh: make more robust & more easily readable

Call the tools to be tested with option '--help' to avoid
triggering automatic actions when no option is given.

Exampleswhy the old behaviour is bad:
- opensc-notify: blocks the build
- opensc-explorer: tries to open the card
This commit is contained in:
Peter Marschall 2018-05-27 14:04:28 +02:00 committed by Frank Morgner
parent 59412aeee3
commit dbe2fcef2c
1 changed files with 5 additions and 1 deletions

View File

@ -6,7 +6,11 @@ TOOLS=`find "${SOURCE_PATH}/doc/tools" -name "*.1.xml" | sed -E -e "s|.*/([a-z0-
ALL=1
for T in $TOOLS; do
SWITCHES=`${SOURCE_PATH}/src/tools/${T} 2>&1 | awk '{if (match($0,"--[a-zA-Z0-9-]*",a) != 0) print a[0]} {if (match($0," -[a-zA-Z0-9]",a) != 0) print a[0]}'`
SWITCHES=$( ${SOURCE_PATH}/src/tools/${T} --help 2>&1 \
| grep -v "unrecognized option '--help'" \
| awk '{if (match($0,"--[a-zA-Z0-9-]*",a) != 0) print a[0]}
{if (match($0," -[a-zA-Z0-9]",a) != 0) print a[0]}' )
for S in $SWITCHES; do
grep -q -- "$S" ${SOURCE_PATH}/doc/tools/${T}.1.xml || { echo "${T}: missing switch $S"; ALL=0; };
done